diff options
Diffstat (limited to 'test/140_appendsolution')
23 files changed, 171 insertions, 0 deletions
diff --git a/test/140_appendsolution/00_empty.in b/test/140_appendsolution/00_empty.in new file mode 100644 index 0000000..1100b95 --- /dev/null +++ b/test/140_appendsolution/00_empty.in | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | |||
| 2 | 0 | ||
| 3 | 1 | ||
| 4 | rotation UF | ||
| 5 | 0 | ||
diff --git a/test/140_appendsolution/00_empty.out b/test/140_appendsolution/00_empty.out new file mode 100644 index 0000000..8581416 --- /dev/null +++ b/test/140_appendsolution/00_empty.out | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | |||
| 2 | Number of solutions: 1 | ||
| 3 | Shortest solution length: 0 | ||
| 4 | Used bytes: 1 | ||
diff --git a/test/140_appendsolution/01_simple_onlynormal_nounniss.in b/test/140_appendsolution/01_simple_onlynormal_nounniss.in new file mode 100644 index 0000000..fb1eaed --- /dev/null +++ b/test/140_appendsolution/01_simple_onlynormal_nounniss.in | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | U F R D2 B' | ||
| 2 | 0 | ||
| 3 | 1 | ||
| 4 | rotation UF | ||
| 5 | 0 | ||
diff --git a/test/140_appendsolution/01_simple_onlynormal_nounniss.out b/test/140_appendsolution/01_simple_onlynormal_nounniss.out new file mode 100644 index 0000000..b577962 --- /dev/null +++ b/test/140_appendsolution/01_simple_onlynormal_nounniss.out | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | U F R D2 B' | ||
| 2 | Number of solutions: 1 | ||
| 3 | Shortest solution length: 5 | ||
| 4 | Used bytes: 12 | ||
diff --git a/test/140_appendsolution/02_simple_onlynormal_nounnis_multitrans.in b/test/140_appendsolution/02_simple_onlynormal_nounnis_multitrans.in new file mode 100644 index 0000000..db5f074 --- /dev/null +++ b/test/140_appendsolution/02_simple_onlynormal_nounnis_multitrans.in | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | U F R | ||
| 2 | 0 | ||
| 3 | 4 | ||
| 4 | rotation UF | ||
| 5 | mirrored UR | ||
| 6 | rotation BD | ||
| 7 | mirrored LB | ||
| 8 | 0 | ||
diff --git a/test/140_appendsolution/02_simple_onlynormal_nounnis_multitrans.out b/test/140_appendsolution/02_simple_onlynormal_nounnis_multitrans.out new file mode 100644 index 0000000..e1b5631 --- /dev/null +++ b/test/140_appendsolution/02_simple_onlynormal_nounnis_multitrans.out | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | U F R | ||
| 2 | B D L | ||
| 3 | U' L' B' | ||
| 4 | R' B' D' | ||
| 5 | Number of solutions: 4 | ||
| 6 | Shortest solution length: 3 | ||
| 7 | Used bytes: 30 | ||
diff --git a/test/140_appendsolution/03_simple_unniss.in b/test/140_appendsolution/03_simple_unniss.in new file mode 100644 index 0000000..2c5a331 --- /dev/null +++ b/test/140_appendsolution/03_simple_unniss.in | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | U F B2 (R' F D) | ||
| 2 | 1 | ||
| 3 | 1 | ||
| 4 | rotation UF | ||
| 5 | 0 | ||
diff --git a/test/140_appendsolution/03_simple_unniss.out b/test/140_appendsolution/03_simple_unniss.out new file mode 100644 index 0000000..3ca210e --- /dev/null +++ b/test/140_appendsolution/03_simple_unniss.out | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | U F B2 D' F' R | ||
| 2 | Number of solutions: 1 | ||
| 3 | Shortest solution length: 6 | ||
| 4 | Used bytes: 15 | ||
diff --git a/test/140_appendsolution/04_niss_nounniss.in b/test/140_appendsolution/04_niss_nounniss.in new file mode 100644 index 0000000..b07f970 --- /dev/null +++ b/test/140_appendsolution/04_niss_nounniss.in | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | U F B2 (R' F D) | ||
| 2 | 0 | ||
| 3 | 1 | ||
| 4 | rotation UF | ||
| 5 | 0 | ||
diff --git a/test/140_appendsolution/04_niss_nounniss.out b/test/140_appendsolution/04_niss_nounniss.out new file mode 100644 index 0000000..a616b4c --- /dev/null +++ b/test/140_appendsolution/04_niss_nounniss.out | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | U F B2 (R' F D) | ||
| 2 | Number of solutions: 1 | ||
| 3 | Shortest solution length: 6 | ||
| 4 | Used bytes: 16 | ||
diff --git a/test/140_appendsolution/05_sort_parallel.in b/test/140_appendsolution/05_sort_parallel.in new file mode 100644 index 0000000..bc1cf0f --- /dev/null +++ b/test/140_appendsolution/05_sort_parallel.in | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | L R' B2 F | ||
| 2 | 0 | ||
| 3 | 1 | ||
| 4 | rotation UF | ||
| 5 | 0 | ||
diff --git a/test/140_appendsolution/05_sort_parallel.out b/test/140_appendsolution/05_sort_parallel.out new file mode 100644 index 0000000..fc09830 --- /dev/null +++ b/test/140_appendsolution/05_sort_parallel.out | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | R' L F B2 | ||
| 2 | Number of solutions: 1 | ||
| 3 | Shortest solution length: 4 | ||
| 4 | Used bytes: 10 | ||
diff --git a/test/140_appendsolution/06_unniss_trans_sort.in b/test/140_appendsolution/06_unniss_trans_sort.in new file mode 100644 index 0000000..2ffab93 --- /dev/null +++ b/test/140_appendsolution/06_unniss_trans_sort.in | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | B (R2 F2) | ||
| 2 | 1 | ||
| 3 | 1 | ||
| 4 | rotation UR | ||
| 5 | 0 | ||
diff --git a/test/140_appendsolution/06_unniss_trans_sort.out b/test/140_appendsolution/06_unniss_trans_sort.out new file mode 100644 index 0000000..28d7827 --- /dev/null +++ b/test/140_appendsolution/06_unniss_trans_sort.out | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | R2 L B2 | ||
| 2 | Number of solutions: 1 | ||
| 3 | Shortest solution length: 3 | ||
| 4 | Used bytes: 8 | ||
diff --git a/test/140_appendsolution/07_unniss_cancel_nosol.in b/test/140_appendsolution/07_unniss_cancel_nosol.in new file mode 100644 index 0000000..6883d05 --- /dev/null +++ b/test/140_appendsolution/07_unniss_cancel_nosol.in | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | B' F (R2 B2) | ||
| 2 | 1 | ||
| 3 | 1 | ||
| 4 | rotation UF | ||
| 5 | 0 | ||
diff --git a/test/140_appendsolution/07_unniss_cancel_nosol.out b/test/140_appendsolution/07_unniss_cancel_nosol.out new file mode 100644 index 0000000..ed5ea65 --- /dev/null +++ b/test/140_appendsolution/07_unniss_cancel_nosol.out | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | Number of solutions: 0 | ||
| 2 | Shortest solution length: 21 | ||
| 3 | Used bytes: 0 | ||
diff --git a/test/140_appendsolution/08_unniss_cancel_nosol_v2.in b/test/140_appendsolution/08_unniss_cancel_nosol_v2.in new file mode 100644 index 0000000..3d461f0 --- /dev/null +++ b/test/140_appendsolution/08_unniss_cancel_nosol_v2.in | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | F' B (R2 F2) | ||
| 2 | 1 | ||
| 3 | 1 | ||
| 4 | rotation UF | ||
| 5 | 0 | ||
diff --git a/test/140_appendsolution/08_unniss_cancel_nosol_v2.out b/test/140_appendsolution/08_unniss_cancel_nosol_v2.out new file mode 100644 index 0000000..ed5ea65 --- /dev/null +++ b/test/140_appendsolution/08_unniss_cancel_nosol_v2.out | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | Number of solutions: 0 | ||
| 2 | Shortest solution length: 21 | ||
| 3 | Used bytes: 0 | ||
diff --git a/test/140_appendsolution/09_fullinverse_niss.in b/test/140_appendsolution/09_fullinverse_niss.in new file mode 100644 index 0000000..bb2b640 --- /dev/null +++ b/test/140_appendsolution/09_fullinverse_niss.in | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | (F) | ||
| 2 | 0 | ||
| 3 | 1 | ||
| 4 | rotation UF | ||
| 5 | 0 | ||
diff --git a/test/140_appendsolution/09_fullinverse_niss.out b/test/140_appendsolution/09_fullinverse_niss.out new file mode 100644 index 0000000..9721085 --- /dev/null +++ b/test/140_appendsolution/09_fullinverse_niss.out | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | (F) | ||
| 2 | Number of solutions: 1 | ||
| 3 | Shortest solution length: 1 | ||
| 4 | Used bytes: 4 | ||
diff --git a/test/140_appendsolution/10_rotated.in b/test/140_appendsolution/10_rotated.in new file mode 100644 index 0000000..5210cd5 --- /dev/null +++ b/test/140_appendsolution/10_rotated.in | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | U2 F B L' | ||
| 2 | 1 | ||
| 3 | 1 | ||
| 4 | rotation UF | ||
| 5 | 7 | ||
diff --git a/test/140_appendsolution/10_rotated.out b/test/140_appendsolution/10_rotated.out new file mode 100644 index 0000000..e70b2fe --- /dev/null +++ b/test/140_appendsolution/10_rotated.out | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | D2 R L F' | ||
| 2 | Number of solutions: 1 | ||
| 3 | Shortest solution length: 4 | ||
| 4 | Used bytes: 10 | ||
diff --git a/test/140_appendsolution/appendsolution_tests.c b/test/140_appendsolution/appendsolution_tests.c new file mode 100644 index 0000000..e1b7e98 --- /dev/null +++ b/test/140_appendsolution/appendsolution_tests.c | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | /* | ||
| 2 | Input format for appendsolution tests: | ||
| 3 | |||
| 4 | moves on normal (with NISS notation) | ||
| 5 | unniss flag (0=false, 1=true) | ||
| 6 | number of transformations | ||
| 7 | transformations, one per line | ||
| 8 | the orientation of the cube, as a number from 0 to 23 | ||
| 9 | |||
| 10 | See below for the output format. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include "../test.h" | ||
| 14 | |||
| 15 | uint8_t readtrans(const char [NISSY_SIZE_TRANSFORMATION]); | ||
| 16 | int64_t readmoves(const char *, size_t n, size_t m, | ||
| 17 | uint64_t *, uint64_t *, uint8_t [n], uint8_t [m]); | ||
| 18 | void solution_moves_reset(solution_moves_t [static 1]); | ||
| 19 | bool solution_list_init(solution_list_t [static 1], size_t n, char [n]); | ||
| 20 | int64_t appendsolution(const solution_moves_t [static 1], | ||
| 21 | const solution_settings_t [static 1], solution_list_t [static 1], bool, | ||
| 22 | const char *); | ||
| 23 | |||
| 24 | void run(void) { | ||
| 25 | int i, ntrans; | ||
| 26 | int64_t tot; | ||
| 27 | uint64_t nm, np; | ||
| 28 | char str[STRLENMAX], buf[STRLENMAX]; | ||
| 29 | solution_moves_t moves; | ||
| 30 | solution_settings_t settings; | ||
| 31 | solution_list_t list; | ||
| 32 | |||
| 33 | solution_moves_reset(&moves); | ||
| 34 | solution_list_init(&list, STRLENMAX, buf); | ||
| 35 | settings = (solution_settings_t) { | ||
| 36 | .tmask = UINT64_C(0), | ||
| 37 | .unniss = false, | ||
| 38 | .maxmoves = 20, | ||
| 39 | .maxsolutions = 100, | ||
| 40 | .optimal = -1, | ||
| 41 | }; | ||
| 42 | |||
| 43 | fgets(str, STRLENMAX, stdin); | ||
| 44 | tot = readmoves(str, 20, 20, &nm, &np, moves.moves, moves.premoves); | ||
| 45 | if (tot < 0) { | ||
| 46 | printf("Test error reading moves\n"); | ||
| 47 | return; | ||
| 48 | } | ||
| 49 | moves.nmoves = nm; | ||
| 50 | moves.npremoves = np; | ||
| 51 | fgets(str, STRLENMAX, stdin); | ||
| 52 | settings.unniss = (bool)atoi(str); | ||
| 53 | fgets(str, STRLENMAX, stdin); | ||
| 54 | ntrans = atoi(str); | ||
| 55 | for (i = 0; i < ntrans; i++) { | ||
| 56 | fgets(str, STRLENMAX, stdin); | ||
| 57 | settings.tmask |= UINT64_C(1) << (uint64_t)readtrans(str); | ||
| 58 | } | ||
| 59 | fgets(str, STRLENMAX, stdin); | ||
| 60 | settings.orientation = atoi(str); | ||
| 61 | |||
| 62 | appendsolution(&moves, &settings, &list, false, "Test"); | ||
| 63 | |||
| 64 | printf("%s", list.buf); | ||
| 65 | printf("Number of solutions: %" PRIu64 "\n", list.nsols); | ||
| 66 | printf("Shortest solution length: %" PRIu8 "\n", list.shortest_sol); | ||
| 67 | printf("Used bytes: %zu\n", list.used); | ||
| 68 | } | ||
