diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-10-29 10:29:27 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-10-29 10:31:38 +0100 |
| commit | 80ec600701aae54350679bbf5e0ce874c915506e (patch) | |
| tree | 137007693afb0d12b0886990b4bfb6d7278bfa22 /test/020_move/move_tests.c | |
| parent | f2dd7feb819fe4a8a4181dd1d04488e31f4b63a1 (diff) | |
| download | nissy-core-80ec600701aae54350679bbf5e0ce874c915506e.tar.gz nissy-core-80ec600701aae54350679bbf5e0ce874c915506e.zip | |
AVX2 compiles, fails all tests; + some renaming
Diffstat (limited to 'test/020_move/move_tests.c')
| -rw-r--r-- | test/020_move/move_tests.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/020_move/move_tests.c b/test/020_move/move_tests.c new file mode 100644 index 0000000..054466b --- /dev/null +++ b/test/020_move/move_tests.c | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | #include <stdbool.h> | ||
| 2 | #include <stdint.h> | ||
| 3 | #include <stdio.h> | ||
| 4 | |||
| 5 | #include "../../src/cube.h" | ||
| 6 | |||
| 7 | #define STRLENMAX 10000 | ||
| 8 | #define MOVESMAX 1000 | ||
| 9 | |||
| 10 | int main() { | ||
| 11 | char str[STRLENMAX]; | ||
| 12 | int i, n; | ||
| 13 | move_t moves[MOVESMAX]; | ||
| 14 | cube_t cube; | ||
| 15 | |||
| 16 | fgets(str, STRLENMAX, stdin); | ||
| 17 | n = readmoves(str, moves); | ||
| 18 | |||
| 19 | if (n == -1) { | ||
| 20 | printf("Error reading moves\n"); | ||
| 21 | return 1; | ||
| 22 | } | ||
| 23 | |||
| 24 | fgets(str, STRLENMAX, stdin); | ||
| 25 | cube = readcube(H48, str); | ||
| 26 | |||
| 27 | for (i = 0; i < n; i++) | ||
| 28 | cube = move(cube, moves[i]); | ||
| 29 | |||
| 30 | if (iserror(cube)) { | ||
| 31 | printf("Error moving cube\n"); | ||
| 32 | } else if (!issolvable(cube)) { | ||
| 33 | printf("Moved cube is not solvable\n"); | ||
| 34 | } else { | ||
| 35 | writecube(H48, cube, str); | ||
| 36 | printf("%s\n", str); | ||
| 37 | } | ||
| 38 | |||
| 39 | return 0; | ||
| 40 | } | ||
