Update tests base

This commit is contained in:
Gregory Lirent 2022-06-03 19:29:06 +03:00
parent c32d771793
commit 25bb390408
2 changed files with 32 additions and 0 deletions

View File

@ -23,4 +23,6 @@ extern vtype_int16 random_int16();
extern vtype_int32 random_int32();
extern vtype_int64 random_int64();
extern char random_ascii_char();
extern unsigned int random_unicode_symbol();
#endif /* LIBCDSB_TESTS_RANDOM_H */

View File

@ -79,3 +79,33 @@ vtype_uint64 random_uint64() {
vtype_int64 random_int64() {
return random_uint32() * random_uint32();
}
char random_ascii_char() {
return (rand()%0x5f) + 0x20;
}
unsigned int random_unicode_symbol() {
switch (rand()%20) {
default:
case 0: return (random_uint16()%0x005f) + 0x000020;
case 1: return (random_uint16()%0x020f) + 0x0000a1;
case 2: return (random_uint16()%0x01a8) + 0x000388;
case 3: return (random_uint16()%0x0026) + 0x000531;
case 4: return (random_uint16()%0x002a) + 0x000560;
case 5: return (random_uint16()%0x00c6) + 0x001000;
case 6: return (random_uint16()%0x0030) + 0x0010d0;
case 7: return (random_uint16()%0x029d) + 0x001400;
case 8: return (random_uint16()%0x0058) + 0x0016a0;
case 9: return (random_uint16()%0x0074) + 0x001b80;
case 10: return (random_uint16()%0x00f4) + 0x001d00;
case 11: return (random_uint16()%0x0115) + 0x001e00;
case 12: return (random_uint16()%0x008b) + 0x002100;
case 13: return (random_uint16()%0x0297) + 0x002190;
case 14: return (random_uint16()%0x0714) + 0x002460;
case 15: return (random_uint16()%0x00b7) + 0x00a640;
case 16: return (random_uint16()%0x0074) + 0x00a8e0;
case 17: return (random_uint16()%0x009e) + 0x010400;
case 18: return (random_uint16()%0x0137) + 0x010600;
case 19: return (random_uint16()%0x03d8) + 0x01f300;
}
}