diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-13 21:49:30 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-13 21:49:30 +0100 |
| commit | 4444e53eaadf33aa309a40849730be332ca6d0de (patch) | |
| tree | 0dca7c5d0a83b28f5010f12dae8e74caff7e05fe /test/070_solve_simple | |
| parent | d0c592bdc3beb12074f085ab085dd90de9b8e643 (diff) | |
| download | nissy-core-4444e53eaadf33aa309a40849730be332ca6d0de.tar.gz nissy-core-4444e53eaadf33aa309a40849730be332ca6d0de.zip | |
Tidy up; made things testable
Diffstat (limited to 'test/070_solve_simple')
| -rw-r--r-- | test/070_solve_simple/01_U_U3.in | 8 | ||||
| -rw-r--r-- | test/070_solve_simple/01_U_U3.out | 1 | ||||
| -rw-r--r-- | test/070_solve_simple/02_MUMU_alloptimal.in | 8 | ||||
| -rw-r--r-- | test/070_solve_simple/02_MUMU_alloptimal.out | 4 | ||||
| -rw-r--r-- | test/070_solve_simple/solve_simple_tests.c | 58 |
5 files changed, 79 insertions, 0 deletions
diff --git a/test/070_solve_simple/01_U_U3.in b/test/070_solve_simple/01_U_U3.in new file mode 100644 index 0000000..c0f7930 --- /dev/null +++ b/test/070_solve_simple/01_U_U3.in | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | UR0 UL0 DB0 DF0 UB0 UF0 DL0 DR0 FR0 FL0 BL0 BR0 UBR0 UFL0 DFL0 DBR0 UFR0 UBL0 DFR0 DBL0 | ||
| 2 | simple | ||
| 3 | |||
| 4 | normal | ||
| 5 | 0 | ||
| 6 | 3 | ||
| 7 | 3 | ||
| 8 | -1 | ||
diff --git a/test/070_solve_simple/01_U_U3.out b/test/070_solve_simple/01_U_U3.out new file mode 100644 index 0000000..ca934b4 --- /dev/null +++ b/test/070_solve_simple/01_U_U3.out | |||
| @@ -0,0 +1 @@ | |||
| U' | |||
diff --git a/test/070_solve_simple/02_MUMU_alloptimal.in b/test/070_solve_simple/02_MUMU_alloptimal.in new file mode 100644 index 0000000..f97c95f --- /dev/null +++ b/test/070_solve_simple/02_MUMU_alloptimal.in | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | UB0 DF0 DB0 UF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 | ||
| 2 | simple | ||
| 3 | |||
| 4 | normal | ||
| 5 | 0 | ||
| 6 | -1 | ||
| 7 | 10 | ||
| 8 | 0 | ||
diff --git a/test/070_solve_simple/02_MUMU_alloptimal.out b/test/070_solve_simple/02_MUMU_alloptimal.out new file mode 100644 index 0000000..06cd521 --- /dev/null +++ b/test/070_solve_simple/02_MUMU_alloptimal.out | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | U2 R' L F2 R L' | ||
| 2 | R U2 R' L F2 L' | ||
| 3 | R L' U2 R' L F2 | ||
| 4 | L' U2 R' L F2 R | ||
diff --git a/test/070_solve_simple/solve_simple_tests.c b/test/070_solve_simple/solve_simple_tests.c new file mode 100644 index 0000000..14a1674 --- /dev/null +++ b/test/070_solve_simple/solve_simple_tests.c | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | #include <stdbool.h> | ||
| 2 | #include <stdint.h> | ||
| 3 | #include <stdio.h> | ||
| 4 | #include <stdlib.h> | ||
| 5 | #include <string.h> | ||
| 6 | |||
| 7 | #ifdef CUBE_AVX2 | ||
| 8 | #include <immintrin.h> | ||
| 9 | #endif | ||
| 10 | |||
| 11 | #include "../../cube.h" | ||
| 12 | |||
| 13 | #define S 10000 | ||
| 14 | |||
| 15 | int main() { | ||
| 16 | char cubestr[S], solverstr[S], optionsstr[S], nisstypestr[S]; | ||
| 17 | char minmovesstr[S], maxmovesstr[S], maxsolsstr[S], optimalstr[S]; | ||
| 18 | char solutionsstr[S]; | ||
| 19 | cube_t cube; | ||
| 20 | int64_t maxsols; | ||
| 21 | int8_t minmoves, maxmoves, optimal; | ||
| 22 | |||
| 23 | fgets(cubestr, S, stdin); | ||
| 24 | fgets(solverstr, S, stdin); | ||
| 25 | fgets(optionsstr, S, stdin); | ||
| 26 | fgets(nisstypestr, S, stdin); | ||
| 27 | fgets(minmovesstr, S, stdin); | ||
| 28 | fgets(maxmovesstr, S, stdin); | ||
| 29 | fgets(maxsolsstr, S, stdin); | ||
| 30 | fgets(optimalstr, S, stdin); | ||
| 31 | |||
| 32 | solverstr[strcspn(solverstr, "\n")] = 0; | ||
| 33 | optionsstr[strcspn(optionsstr, "\n")] = 0; | ||
| 34 | nisstypestr[strcspn(nisstypestr, "\n")] = 0; | ||
| 35 | |||
| 36 | cube = readcube("H48", cubestr); | ||
| 37 | minmoves = atoi(minmovesstr); | ||
| 38 | maxmoves = atoi(maxmovesstr); | ||
| 39 | maxsols = atoi(maxsolsstr); | ||
| 40 | optimal = atoi(optimalstr); | ||
| 41 | |||
| 42 | solve( | ||
| 43 | cube, | ||
| 44 | solverstr, | ||
| 45 | optionsstr, | ||
| 46 | nisstypestr, | ||
| 47 | minmoves, | ||
| 48 | maxmoves, | ||
| 49 | maxsols, | ||
| 50 | optimal, | ||
| 51 | NULL, | ||
| 52 | solutionsstr | ||
| 53 | ); | ||
| 54 | |||
| 55 | printf("%s", solutionsstr); | ||
| 56 | |||
| 57 | return 0; | ||
| 58 | } | ||
