From 4444e53eaadf33aa309a40849730be332ca6d0de Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 13 Nov 2023 21:49:30 +0100 Subject: Tidy up; made things testable --- test/070_solve_simple/solve_simple_tests.c | 58 ++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 test/070_solve_simple/solve_simple_tests.c (limited to 'test/070_solve_simple/solve_simple_tests.c') 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 @@ +#include +#include +#include +#include +#include + +#ifdef CUBE_AVX2 +#include +#endif + +#include "../../cube.h" + +#define S 10000 + +int main() { + char cubestr[S], solverstr[S], optionsstr[S], nisstypestr[S]; + char minmovesstr[S], maxmovesstr[S], maxsolsstr[S], optimalstr[S]; + char solutionsstr[S]; + cube_t cube; + int64_t maxsols; + int8_t minmoves, maxmoves, optimal; + + fgets(cubestr, S, stdin); + fgets(solverstr, S, stdin); + fgets(optionsstr, S, stdin); + fgets(nisstypestr, S, stdin); + fgets(minmovesstr, S, stdin); + fgets(maxmovesstr, S, stdin); + fgets(maxsolsstr, S, stdin); + fgets(optimalstr, S, stdin); + + solverstr[strcspn(solverstr, "\n")] = 0; + optionsstr[strcspn(optionsstr, "\n")] = 0; + nisstypestr[strcspn(nisstypestr, "\n")] = 0; + + cube = readcube("H48", cubestr); + minmoves = atoi(minmovesstr); + maxmoves = atoi(maxmovesstr); + maxsols = atoi(maxsolsstr); + optimal = atoi(optimalstr); + + solve( + cube, + solverstr, + optionsstr, + nisstypestr, + minmoves, + maxmoves, + maxsols, + optimal, + NULL, + solutionsstr + ); + + printf("%s", solutionsstr); + + return 0; +} -- cgit v1.3