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/solve_simple_tests.c | |
| 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/solve_simple_tests.c')
| -rw-r--r-- | test/070_solve_simple/solve_simple_tests.c | 58 |
1 files changed, 58 insertions, 0 deletions
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 | } | ||
