invcoord_cp_tests.c (584B)
1 #include "../test.h" 2 3 #define FACT_8 40320 4 5 int64_t coord_cp(cube_t); 6 cube_t invcoord_cp(int64_t); 7 8 void run(void) { 9 oriented_cube_t cube; 10 int64_t coord, coord2; 11 12 cube.orientation = 0; 13 14 /* Test all possible values for CP coordinate */ 15 for (coord = 0; coord < FACT_8; coord++) { 16 cube.cube = invcoord_cp(coord); 17 18 if (!isconsistent(cube)) { 19 printf("Not consistent\n"); 20 return; 21 } 22 23 coord2 = coord_cp(cube.cube); 24 if (coord != coord2) { 25 printf("Error: invcoord of %" PRId64 26 " returns %" PRId64 "\n", coord, coord2); 27 return; 28 } 29 } 30 31 printf("All good\n"); 32 }