inverse_trans_tests.c (779B)
1 #include "../test.h" 2 3 int main(void) { 4 uint8_t t, tinv, tt; 5 cube_t cube; 6 7 for (t = 0; t < 48; t++) { 8 cube = cube_new(); 9 cube = cube_move(cube, R); 10 cube = cube_move(cube, U); 11 cube = cube_move(cube, F); 12 13 tt = cube_readtrans(cube_transstr(t)); 14 cube = cube_transform(cube, tt); 15 tinv = cube_inversetrans(t); 16 tt = cube_readtrans(cube_transstr(tinv)); 17 cube = cube_transform(cube, tt); 18 19 if (cube_error(cube)) { 20 printf("Error transforming cube\n"); 21 } else if (!cube_solvable(cube)) { 22 printf("Transformed cube is not solvable\n"); 23 } else { 24 cube = cube_move(cube, F3); 25 cube = cube_move(cube, U3); 26 cube = cube_move(cube, R3); 27 if (!cube_solved(cube)) 28 printf("%s: Error! Got %" PRIu8 "\n", 29 cube_transstr(t), tinv); 30 } 31 } 32 33 return 0; 34 }