diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-04-12 20:22:01 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-04-12 20:22:01 +0200 |
| commit | 72e018b066bd5cc3ce0181b43865a227e8b9b6ec (patch) | |
| tree | 60b2e8dbe7fd2dd7cf58ecd1606e03146329b516 /test/030_move/move_tests.c | |
| download | cubecore-72e018b066bd5cc3ce0181b43865a227e8b9b6ec.tar.gz cubecore-72e018b066bd5cc3ce0181b43865a227e8b9b6ec.zip | |
Initial fork from H48
Diffstat (limited to 'test/030_move/move_tests.c')
| -rw-r--r-- | test/030_move/move_tests.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/030_move/move_tests.c b/test/030_move/move_tests.c new file mode 100644 index 0000000..73e9dbe --- /dev/null +++ b/test/030_move/move_tests.c | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | cube_t applymoves(cube_t, char *); | ||
| 4 | |||
| 5 | int main(void) { | ||
| 6 | char movestr[STRLENMAX], cubestr[STRLENMAX]; | ||
| 7 | cube_t cube; | ||
| 8 | |||
| 9 | fgets(movestr, STRLENMAX, stdin); | ||
| 10 | fgets(cubestr, STRLENMAX, stdin); | ||
| 11 | cube = readcube("H48", cubestr); | ||
| 12 | |||
| 13 | cube = applymoves(cube, movestr); | ||
| 14 | |||
| 15 | if (iserror(cube)) { | ||
| 16 | printf("Error moving cube\n"); | ||
| 17 | } else if (!issolvable(cube)) { | ||
| 18 | printf("Moved cube is not solvable\n"); | ||
| 19 | } else { | ||
| 20 | writecube("H48", cube, cubestr); | ||
| 21 | printf("%s\n", cubestr); | ||
| 22 | } | ||
| 23 | |||
| 24 | return 0; | ||
| 25 | } | ||
