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/060_solve_simple/01_U_U3.in | 8 ---- test/060_solve_simple/01_U_U3.out | 1 - test/060_solve_simple/02_MUMU_alloptimal.in | 8 ---- test/060_solve_simple/02_MUMU_alloptimal.out | 4 -- test/060_solve_simple/solve_simple_tests.c | 58 ---------------------------- test/061_coord_eo/00_solved.in | 1 + test/061_coord_eo/00_solved.out | 1 + test/061_coord_eo/01_U.in | 1 + test/061_coord_eo/01_U.out | 1 + test/061_coord_eo/02_U2.in | 1 + test/061_coord_eo/02_U2.out | 1 + test/061_coord_eo/03_U3.in | 1 + test/061_coord_eo/03_U3.out | 1 + test/061_coord_eo/04_D.in | 1 + test/061_coord_eo/04_D.out | 1 + test/061_coord_eo/07_R.in | 1 + test/061_coord_eo/07_R.out | 1 + test/061_coord_eo/08_R2.in | 1 + test/061_coord_eo/08_R2.out | 1 + test/061_coord_eo/10_L.in | 1 + test/061_coord_eo/10_L.out | 1 + test/061_coord_eo/13_F.in | 1 + test/061_coord_eo/13_F.out | 1 + test/061_coord_eo/14_F2.in | 1 + test/061_coord_eo/14_F2.out | 1 + test/061_coord_eo/15_F3.in | 1 + test/061_coord_eo/15_F3.out | 1 + test/061_coord_eo/16_B.in | 1 + test/061_coord_eo/16_B.out | 1 + test/061_coord_eo/17_B2.in | 1 + test/061_coord_eo/17_B2.out | 1 + test/061_coord_eo/18_B3.in | 1 + test/061_coord_eo/18_B3.out | 1 + test/061_coord_eo/20_scrambled.in | 3 ++ test/061_coord_eo/20_scrambled.out | 1 + test/061_coord_eo/coord_eo_tests.c | 31 +++++++++++++++ test/070_solve_simple/01_U_U3.in | 8 ++++ test/070_solve_simple/01_U_U3.out | 1 + test/070_solve_simple/02_MUMU_alloptimal.in | 8 ++++ test/070_solve_simple/02_MUMU_alloptimal.out | 4 ++ test/070_solve_simple/solve_simple_tests.c | 58 ++++++++++++++++++++++++++++ test/test.h | 7 ++++ 42 files changed, 149 insertions(+), 79 deletions(-) delete mode 100644 test/060_solve_simple/01_U_U3.in delete mode 100644 test/060_solve_simple/01_U_U3.out delete mode 100644 test/060_solve_simple/02_MUMU_alloptimal.in delete mode 100644 test/060_solve_simple/02_MUMU_alloptimal.out delete mode 100644 test/060_solve_simple/solve_simple_tests.c create mode 100644 test/061_coord_eo/00_solved.in create mode 100644 test/061_coord_eo/00_solved.out create mode 100644 test/061_coord_eo/01_U.in create mode 100644 test/061_coord_eo/01_U.out create mode 100644 test/061_coord_eo/02_U2.in create mode 100644 test/061_coord_eo/02_U2.out create mode 100644 test/061_coord_eo/03_U3.in create mode 100644 test/061_coord_eo/03_U3.out create mode 100644 test/061_coord_eo/04_D.in create mode 100644 test/061_coord_eo/04_D.out create mode 100644 test/061_coord_eo/07_R.in create mode 100644 test/061_coord_eo/07_R.out create mode 100644 test/061_coord_eo/08_R2.in create mode 100644 test/061_coord_eo/08_R2.out create mode 100644 test/061_coord_eo/10_L.in create mode 100644 test/061_coord_eo/10_L.out create mode 100644 test/061_coord_eo/13_F.in create mode 100644 test/061_coord_eo/13_F.out create mode 100644 test/061_coord_eo/14_F2.in create mode 100644 test/061_coord_eo/14_F2.out create mode 100644 test/061_coord_eo/15_F3.in create mode 100644 test/061_coord_eo/15_F3.out create mode 100644 test/061_coord_eo/16_B.in create mode 100644 test/061_coord_eo/16_B.out create mode 100644 test/061_coord_eo/17_B2.in create mode 100644 test/061_coord_eo/17_B2.out create mode 100644 test/061_coord_eo/18_B3.in create mode 100644 test/061_coord_eo/18_B3.out create mode 100644 test/061_coord_eo/20_scrambled.in create mode 100644 test/061_coord_eo/20_scrambled.out create mode 100644 test/061_coord_eo/coord_eo_tests.c create mode 100644 test/070_solve_simple/01_U_U3.in create mode 100644 test/070_solve_simple/01_U_U3.out create mode 100644 test/070_solve_simple/02_MUMU_alloptimal.in create mode 100644 test/070_solve_simple/02_MUMU_alloptimal.out create mode 100644 test/070_solve_simple/solve_simple_tests.c create mode 100644 test/test.h (limited to 'test') diff --git a/test/060_solve_simple/01_U_U3.in b/test/060_solve_simple/01_U_U3.in deleted file mode 100644 index c0f7930..0000000 --- a/test/060_solve_simple/01_U_U3.in +++ /dev/null @@ -1,8 +0,0 @@ -UR0 UL0 DB0 DF0 UB0 UF0 DL0 DR0 FR0 FL0 BL0 BR0 UBR0 UFL0 DFL0 DBR0 UFR0 UBL0 DFR0 DBL0 -simple - -normal -0 -3 -3 --1 diff --git a/test/060_solve_simple/01_U_U3.out b/test/060_solve_simple/01_U_U3.out deleted file mode 100644 index ca934b4..0000000 --- a/test/060_solve_simple/01_U_U3.out +++ /dev/null @@ -1 +0,0 @@ -U' diff --git a/test/060_solve_simple/02_MUMU_alloptimal.in b/test/060_solve_simple/02_MUMU_alloptimal.in deleted file mode 100644 index f97c95f..0000000 --- a/test/060_solve_simple/02_MUMU_alloptimal.in +++ /dev/null @@ -1,8 +0,0 @@ -UB0 DF0 DB0 UF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 -simple - -normal -0 --1 -10 -0 diff --git a/test/060_solve_simple/02_MUMU_alloptimal.out b/test/060_solve_simple/02_MUMU_alloptimal.out deleted file mode 100644 index 06cd521..0000000 --- a/test/060_solve_simple/02_MUMU_alloptimal.out +++ /dev/null @@ -1,4 +0,0 @@ -U2 R' L F2 R L' -R U2 R' L F2 L' -R L' U2 R' L F2 -L' U2 R' L F2 R diff --git a/test/060_solve_simple/solve_simple_tests.c b/test/060_solve_simple/solve_simple_tests.c deleted file mode 100644 index 14a1674..0000000 --- a/test/060_solve_simple/solve_simple_tests.c +++ /dev/null @@ -1,58 +0,0 @@ -#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; -} diff --git a/test/061_coord_eo/00_solved.in b/test/061_coord_eo/00_solved.in new file mode 100644 index 0000000..dff224d --- /dev/null +++ b/test/061_coord_eo/00_solved.in @@ -0,0 +1 @@ +UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 diff --git a/test/061_coord_eo/00_solved.out b/test/061_coord_eo/00_solved.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/061_coord_eo/00_solved.out @@ -0,0 +1 @@ +0 diff --git a/test/061_coord_eo/01_U.in b/test/061_coord_eo/01_U.in new file mode 100644 index 0000000..b5b36ad --- /dev/null +++ b/test/061_coord_eo/01_U.in @@ -0,0 +1 @@ +UR0 UL0 DB0 DF0 UB0 UF0 DL0 DR0 FR0 FL0 BL0 BR0 UBR0 UFL0 DFL0 DBR0 UFR0 UBL0 DFR0 DBL0 diff --git a/test/061_coord_eo/01_U.out b/test/061_coord_eo/01_U.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/061_coord_eo/01_U.out @@ -0,0 +1 @@ +0 diff --git a/test/061_coord_eo/02_U2.in b/test/061_coord_eo/02_U2.in new file mode 100644 index 0000000..316ad57 --- /dev/null +++ b/test/061_coord_eo/02_U2.in @@ -0,0 +1 @@ +UB0 UF0 DB0 DF0 UL0 UR0 DL0 DR0 FR0 FL0 BL0 BR0 UBL0 UFR0 DFL0 DBR0 UBR0 UFL0 DFR0 DBL0 diff --git a/test/061_coord_eo/02_U2.out b/test/061_coord_eo/02_U2.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/061_coord_eo/02_U2.out @@ -0,0 +1 @@ +0 diff --git a/test/061_coord_eo/03_U3.in b/test/061_coord_eo/03_U3.in new file mode 100644 index 0000000..7721ab5 --- /dev/null +++ b/test/061_coord_eo/03_U3.in @@ -0,0 +1 @@ +UL0 UR0 DB0 DF0 UF0 UB0 DL0 DR0 FR0 FL0 BL0 BR0 UFL0 UBR0 DFL0 DBR0 UBL0 UFR0 DFR0 DBL0 diff --git a/test/061_coord_eo/03_U3.out b/test/061_coord_eo/03_U3.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/061_coord_eo/03_U3.out @@ -0,0 +1 @@ +0 diff --git a/test/061_coord_eo/04_D.in b/test/061_coord_eo/04_D.in new file mode 100644 index 0000000..cf4f816 --- /dev/null +++ b/test/061_coord_eo/04_D.in @@ -0,0 +1 @@ +UF0 UB0 DR0 DL0 UR0 UL0 DB0 DF0 FR0 FL0 BL0 BR0 UFR0 UBL0 DBL0 DFR0 UFL0 UBR0 DFL0 DBR0 diff --git a/test/061_coord_eo/04_D.out b/test/061_coord_eo/04_D.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/061_coord_eo/04_D.out @@ -0,0 +1 @@ +0 diff --git a/test/061_coord_eo/07_R.in b/test/061_coord_eo/07_R.in new file mode 100644 index 0000000..8c8fcb3 --- /dev/null +++ b/test/061_coord_eo/07_R.in @@ -0,0 +1 @@ +UF0 UB0 DB0 DF0 FR0 UL0 DL0 BR0 DR0 FL0 BL0 UR0 DFR2 UBL0 DFL0 UBR2 UFL0 UFR1 DBR1 DBL0 diff --git a/test/061_coord_eo/07_R.out b/test/061_coord_eo/07_R.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/061_coord_eo/07_R.out @@ -0,0 +1 @@ +0 diff --git a/test/061_coord_eo/08_R2.in b/test/061_coord_eo/08_R2.in new file mode 100644 index 0000000..90765e2 --- /dev/null +++ b/test/061_coord_eo/08_R2.in @@ -0,0 +1 @@ +UF0 UB0 DB0 DF0 DR0 UL0 DL0 UR0 BR0 FL0 BL0 FR0 DBR0 UBL0 DFL0 UFR0 UFL0 DFR0 UBR0 DBL0 diff --git a/test/061_coord_eo/08_R2.out b/test/061_coord_eo/08_R2.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/061_coord_eo/08_R2.out @@ -0,0 +1 @@ +0 diff --git a/test/061_coord_eo/10_L.in b/test/061_coord_eo/10_L.in new file mode 100644 index 0000000..0b0565c --- /dev/null +++ b/test/061_coord_eo/10_L.in @@ -0,0 +1 @@ +UF0 UB0 DB0 DF0 UR0 BL0 FL0 DR0 FR0 UL0 DL0 BR0 UFR0 DBL2 UFL2 DBR0 UBL1 UBR0 DFR0 DFL1 diff --git a/test/061_coord_eo/10_L.out b/test/061_coord_eo/10_L.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/061_coord_eo/10_L.out @@ -0,0 +1 @@ +0 diff --git a/test/061_coord_eo/13_F.in b/test/061_coord_eo/13_F.in new file mode 100644 index 0000000..e805af8 --- /dev/null +++ b/test/061_coord_eo/13_F.in @@ -0,0 +1 @@ +FL1 UB0 DB0 FR1 UR0 UL0 DL0 DR0 UF1 DF1 BL0 BR0 UFL1 UBL0 DFR1 DBR0 DFL2 UBR0 UFR2 DBL0 diff --git a/test/061_coord_eo/13_F.out b/test/061_coord_eo/13_F.out new file mode 100644 index 0000000..2c60641 --- /dev/null +++ b/test/061_coord_eo/13_F.out @@ -0,0 +1 @@ +388 diff --git a/test/061_coord_eo/14_F2.in b/test/061_coord_eo/14_F2.in new file mode 100644 index 0000000..8aa701f --- /dev/null +++ b/test/061_coord_eo/14_F2.in @@ -0,0 +1 @@ +DF0 UB0 DB0 UF0 UR0 UL0 DL0 DR0 FL0 FR0 BL0 BR0 DFL0 UBL0 UFR0 DBR0 DFR0 UBR0 UFL0 DBL0 diff --git a/test/061_coord_eo/14_F2.out b/test/061_coord_eo/14_F2.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/061_coord_eo/14_F2.out @@ -0,0 +1 @@ +0 diff --git a/test/061_coord_eo/15_F3.in b/test/061_coord_eo/15_F3.in new file mode 100644 index 0000000..40f1260 --- /dev/null +++ b/test/061_coord_eo/15_F3.in @@ -0,0 +1 @@ +FR1 UB0 DB0 FL1 UR0 UL0 DL0 DR0 DF1 UF1 BL0 BR0 DFR1 UBL0 UFL1 DBR0 UFR2 UBR0 DFL2 DBL0 diff --git a/test/061_coord_eo/15_F3.out b/test/061_coord_eo/15_F3.out new file mode 100644 index 0000000..2c60641 --- /dev/null +++ b/test/061_coord_eo/15_F3.out @@ -0,0 +1 @@ +388 diff --git a/test/061_coord_eo/16_B.in b/test/061_coord_eo/16_B.in new file mode 100644 index 0000000..f7fb13c --- /dev/null +++ b/test/061_coord_eo/16_B.in @@ -0,0 +1 @@ +UF0 BR1 BL1 DF0 UR0 UL0 DL0 DR0 FR0 FL0 UB1 DB1 UFR0 UBR1 DFL0 DBL1 UFL0 DBR2 DFR0 UBL2 diff --git a/test/061_coord_eo/16_B.out b/test/061_coord_eo/16_B.out new file mode 100644 index 0000000..1fd9918 --- /dev/null +++ b/test/061_coord_eo/16_B.out @@ -0,0 +1 @@ +1539 diff --git a/test/061_coord_eo/17_B2.in b/test/061_coord_eo/17_B2.in new file mode 100644 index 0000000..9b33e35 --- /dev/null +++ b/test/061_coord_eo/17_B2.in @@ -0,0 +1 @@ +UF0 DB0 UB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BR0 BL0 UFR0 DBR0 DFL0 UBL0 UFL0 DBL0 DFR0 UBR0 diff --git a/test/061_coord_eo/17_B2.out b/test/061_coord_eo/17_B2.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/061_coord_eo/17_B2.out @@ -0,0 +1 @@ +0 diff --git a/test/061_coord_eo/18_B3.in b/test/061_coord_eo/18_B3.in new file mode 100644 index 0000000..1367517 --- /dev/null +++ b/test/061_coord_eo/18_B3.in @@ -0,0 +1 @@ +UF0 BL1 BR1 DF0 UR0 UL0 DL0 DR0 FR0 FL0 DB1 UB1 UFR0 DBL1 DFL0 UBR1 UFL0 UBL2 DFR0 DBR2 diff --git a/test/061_coord_eo/18_B3.out b/test/061_coord_eo/18_B3.out new file mode 100644 index 0000000..1fd9918 --- /dev/null +++ b/test/061_coord_eo/18_B3.out @@ -0,0 +1 @@ +1539 diff --git a/test/061_coord_eo/20_scrambled.in b/test/061_coord_eo/20_scrambled.in new file mode 100644 index 0000000..274d30b --- /dev/null +++ b/test/061_coord_eo/20_scrambled.in @@ -0,0 +1,3 @@ +UL0 BL0 BR1 DL0 FR0 DF0 DB1 DR1 UB0 FL0 UF0 UR1 DFL0 UFR1 DBR1 UBR2 DBL2 DFR0 UFL1 UBL2 + +// Scramble: U R D' L D' F L2 D L F B D2 B' L2 F U2 L2 D2 R2 L2 B' diff --git a/test/061_coord_eo/20_scrambled.out b/test/061_coord_eo/20_scrambled.out new file mode 100644 index 0000000..aa309cc --- /dev/null +++ b/test/061_coord_eo/20_scrambled.out @@ -0,0 +1 @@ +1122 diff --git a/test/061_coord_eo/coord_eo_tests.c b/test/061_coord_eo/coord_eo_tests.c new file mode 100644 index 0000000..bd3db8a --- /dev/null +++ b/test/061_coord_eo/coord_eo_tests.c @@ -0,0 +1,31 @@ +#include +#include +#include + +#ifdef CUBE_AVX2 +#include +#endif + +#include "../test.h" + +#define STRLENMAX 10000 + +int64_t coord_fast_eo(cube_fast_t); +cube_fast_t cubetofast(cube_t); + +int main() { + char str[STRLENMAX]; + cube_t cube; + cube_fast_t fast; + int16_t result; + + fgets(str, STRLENMAX, stdin); + cube = readcube("H48", str); + fast = cubetofast(cube); + + result = coord_fast_eo(fast); + + printf("%" PRId16 "\n", result); + + return 0; +} 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 @@ +UR0 UL0 DB0 DF0 UB0 UF0 DL0 DR0 FR0 FL0 BL0 BR0 UBR0 UFL0 DFL0 DBR0 UFR0 UBL0 DFR0 DBL0 +simple + +normal +0 +3 +3 +-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 @@ +UB0 DF0 DB0 UF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 +simple + +normal +0 +-1 +10 +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 @@ +U2 R' L F2 R L' +R U2 R' L F2 L' +R L' U2 R' L F2 +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 @@ +#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; +} diff --git a/test/test.h b/test/test.h new file mode 100644 index 0000000..607a52d --- /dev/null +++ b/test/test.h @@ -0,0 +1,7 @@ +#include "../cube.h" + +#ifdef CUBE_AVX2 +typedef __m256i cube_fast_t; +#else +typedef cube_t cube_fast_t; +#endif -- cgit v1.3