31 lines
622 B
C
31 lines
622 B
C
#include <ft/test.h>
|
|
#include <ft/all-tests.h>
|
|
#include <stdlib.h>
|
|
|
|
void _ft_stdlib_rand(ft_test *t)
|
|
{
|
|
srand(0xdeadbeef);
|
|
ft_assert(t, rand() == 0x797dd849);
|
|
ft_assert(t, rand() == 0x02687112);
|
|
ft_assert(t, rand() == 0x2222a00d);
|
|
ft_assert(t, rand() == 0x67c2ff94);
|
|
|
|
unsigned int seed = 0xc0ffee;
|
|
srand(seed);
|
|
ft_log(t, "Seed: %#x\n\n", seed);
|
|
|
|
for(int i = 0; i < 8; i++) {
|
|
int i1 = rand();
|
|
int i2 = rand();
|
|
int i3 = rand();
|
|
int i4 = rand();
|
|
|
|
ft_log(t, " %08X %08X %08X %08X\n", i1, i2, i3, i4);
|
|
}
|
|
}
|
|
|
|
ft_test ft_stdlib_rand = {
|
|
.name = "TinyMT random numbers",
|
|
.function = _ft_stdlib_rand,
|
|
};
|