Update tests base
This commit is contained in:
+23
-1
@@ -11,7 +11,7 @@
|
||||
static void init(unsigned int seed) {
|
||||
if (!seed) seed = time(0);
|
||||
printf("\e[36mRandom module initialized with seed: \e[m\e[32m%u\n\e[m", seed);
|
||||
put_separator();
|
||||
put_separator(0);
|
||||
srand(seed);
|
||||
}
|
||||
|
||||
@@ -109,3 +109,25 @@ unsigned int random_unicode_symbol() {
|
||||
case 19: return (random_uint16()%0x03d8) + 0x01f300;
|
||||
}
|
||||
}
|
||||
|
||||
value_t random_value() {
|
||||
value_t v;
|
||||
switch (random_uint8()%13) {
|
||||
default:
|
||||
case 0: v.value[0].b = random_boolean(); v.type = VTYPE_BOOLEAN; break;
|
||||
case 1: v.value[0].u8 = random_uint8 (); v.type = VTYPE_UINT8; break;
|
||||
case 2: v.value[0].u16 = random_uint16 (); v.type = VTYPE_UINT16; break;
|
||||
case 3: v.value[0].u32 = random_uint32 (); v.type = VTYPE_UINT32; break;
|
||||
case 4: v.value[0].u64 = random_uint64 (); v.type = VTYPE_UINT64; break;
|
||||
case 5: v.value[0].u8 = random_int8 (); v.type = VTYPE_INT8; break;
|
||||
case 6: v.value[0].u16 = random_int16 (); v.type = VTYPE_INT16; break;
|
||||
case 7: v.value[0].u32 = random_int32 (); v.type = VTYPE_INT32; break;
|
||||
case 8: v.value[0].u64 = random_int64 (); v.type = VTYPE_INT64; break;
|
||||
case 9: v.value[0].f = random_float (); v.type = VTYPE_FLOAT; break;
|
||||
case 10: v.value[0].d = random_double (); v.type = VTYPE_DOUBLE; break;
|
||||
case 11: v.value[0].ld = random_ldouble(); v.type = VTYPE_LDOUBLE; break;
|
||||
case 12: v.value[0].ptr = (void*)(uintptr_t)random_uint64(); v.type = VTYPE_POINTER; break;
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user