coord_invcoord_h48_tests.c (866B)
1 #include "../test.h" 2 3 #define COCSEP_CLASSES 3393 4 5 size_t gendata_cocsep(void *, uint64_t *, cube_t *); 6 int64_t coord_h48(cube_t, const uint32_t *, uint8_t); 7 cube_t invcoord_h48(int64_t, const cube_t *, uint8_t); 8 cube_t transform(cube_t, uint8_t); 9 10 void run(void) { 11 char str[STRLENMAX]; 12 int i; 13 bool found; 14 uint8_t h, t; 15 uint32_t cocsepdata[300000]; 16 uint64_t selfsim[COCSEP_CLASSES]; 17 int64_t c, cc; 18 cube_t cube, invc, rep[COCSEP_CLASSES]; 19 20 gendata_cocsep(cocsepdata, selfsim, rep); 21 22 i = 1; 23 h = 11; 24 while (fgets(str, STRLENMAX, stdin) != NULL) { 25 cube = readcube("H48", str); 26 c = coord_h48(cube, cocsepdata, h); 27 invc = invcoord_h48(c, rep, h); 28 for (t = 0, found = false; t < 48; t++) { 29 cube = transform(invc, t); 30 cc = coord_h48(cube, cocsepdata, h); 31 found = found || cc == c; 32 } 33 printf("%d %s\n", i, found ? "ok" : "ERROR"); 34 i++; 35 } 36 }