transform_move_tests.c (756B)
1 #include "../test.h" 2 3 #define MAXMOVES 150 4 5 cube_t applytrans(cube_t, const char *); 6 uint8_t transform_move(uint8_t, uint8_t); 7 int readmoves(const char *, int, uint8_t *); 8 cube_t move(cube_t, uint8_t); 9 cube_t applymoves(cube_t, const char *); 10 uint8_t readtrans(const char[static NISSY_SIZE_TRANSFORMATION]); 11 12 void run(void) { 13 char movestr[STRLENMAX], transtr[STRLENMAX], cubestr[STRLENMAX]; 14 uint8_t t, moves[MAXMOVES]; 15 int i, n; 16 cube_t cube; 17 18 fgets(transtr, STRLENMAX, stdin); 19 fgets(movestr, STRLENMAX, stdin); 20 21 cube = solvedcube(); 22 n = readmoves(movestr, MAXMOVES, moves); 23 t = readtrans(transtr); 24 for (i = 0; i < n; i++) 25 cube = move(cube, transform_move(moves[i], t)); 26 27 writecube("H48", cube, STRLENMAX, cubestr); 28 printf("%s\n", cubestr); 29 }