compose_tests.c (539B)
1 #include "../test.h" 2 3 cube_t compose(cube_t, cube_t); 4 5 void run(void) { 6 char str[STRLENMAX]; 7 oriented_cube_t c1, c2, c3; 8 9 fgets(str, STRLENMAX, stdin); 10 c1 = readcube(str); 11 fgets(str, STRLENMAX, stdin); 12 c2 = readcube(str); 13 14 c3 = (oriented_cube_t) { 15 .cube = compose(c1.cube, c2.cube), 16 .orientation = c1.orientation 17 }; 18 19 if (iserror(c3)) { 20 printf("Error composing cubes\n"); 21 } else if (!issolvable(c3)) { 22 printf("Composed cube is not solvable\n"); 23 } else { 24 writecube(c3, NISSY_SIZE_CUBE, str); 25 printf("%s\n", str); 26 } 27 }