diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-25 10:09:22 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-25 10:09:22 +0200 |
| commit | 7faca28009c5efb0ba2b897b34dbdcac47a1a6f3 (patch) | |
| tree | fd507509d00d2926175c72f4c06b9158c3a331a7 /test/130_appendsolution | |
| parent | 17e5a9e1e2b241c67956651f87f40236467fe7d8 (diff) | |
| download | nissy-core-7faca28009c5efb0ba2b897b34dbdcac47a1a6f3.tar.gz nissy-core-7faca28009c5efb0ba2b897b34dbdcac47a1a6f3.zip | |
NISS
Diffstat (limited to '')
| -rw-r--r-- | test/130_appendsolution/00_empty.in | 2 | ||||
| -rw-r--r-- | test/130_appendsolution/01_simple_onlynormal_nounniss.in | 2 | ||||
| -rw-r--r-- | test/130_appendsolution/02_simple_onlynormal_nounnis_multitrans.in | 2 | ||||
| -rw-r--r-- | test/130_appendsolution/03_simple_unniss.in | 4 | ||||
| -rw-r--r-- | test/130_appendsolution/04_niss_nounniss.in | 4 | ||||
| -rw-r--r-- | test/130_appendsolution/05_sort_parallel.in | 2 | ||||
| -rw-r--r-- | test/130_appendsolution/06_unniss_trans_sort.in | 4 | ||||
| -rw-r--r-- | test/130_appendsolution/07_unniss_cancel_nosol.in | 4 | ||||
| -rw-r--r-- | test/130_appendsolution/08_unniss_cancel_nosol_v2.in | 4 | ||||
| -rw-r--r-- | test/130_appendsolution/09_fullinverse_niss.in | 4 | ||||
| -rw-r--r-- | test/130_appendsolution/10_rotated.in | 5 | ||||
| -rw-r--r-- | test/130_appendsolution/10_rotated.out | 4 | ||||
| -rw-r--r-- | test/130_appendsolution/appendsolution_tests.c | 21 |
13 files changed, 40 insertions, 22 deletions
diff --git a/test/130_appendsolution/00_empty.in b/test/130_appendsolution/00_empty.in index c4cad6e..1100b95 100644 --- a/test/130_appendsolution/00_empty.in +++ b/test/130_appendsolution/00_empty.in | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | |||
| 3 | 0 | 2 | 0 |
| 4 | 1 | 3 | 1 |
| 5 | rotation UF | 4 | rotation UF |
| 5 | 0 | ||
diff --git a/test/130_appendsolution/01_simple_onlynormal_nounniss.in b/test/130_appendsolution/01_simple_onlynormal_nounniss.in index 37b6f3d..fb1eaed 100644 --- a/test/130_appendsolution/01_simple_onlynormal_nounniss.in +++ b/test/130_appendsolution/01_simple_onlynormal_nounniss.in | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | U F R D2 B' | 1 | U F R D2 B' |
| 2 | |||
| 3 | 0 | 2 | 0 |
| 4 | 1 | 3 | 1 |
| 5 | rotation UF | 4 | rotation UF |
| 5 | 0 | ||
diff --git a/test/130_appendsolution/02_simple_onlynormal_nounnis_multitrans.in b/test/130_appendsolution/02_simple_onlynormal_nounnis_multitrans.in index c4ff41a..db5f074 100644 --- a/test/130_appendsolution/02_simple_onlynormal_nounnis_multitrans.in +++ b/test/130_appendsolution/02_simple_onlynormal_nounnis_multitrans.in | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | U F R | 1 | U F R |
| 2 | |||
| 3 | 0 | 2 | 0 |
| 4 | 4 | 3 | 4 |
| 5 | rotation UF | 4 | rotation UF |
| 6 | mirrored UR | 5 | mirrored UR |
| 7 | rotation BD | 6 | rotation BD |
| 8 | mirrored LB | 7 | mirrored LB |
| 8 | 0 | ||
diff --git a/test/130_appendsolution/03_simple_unniss.in b/test/130_appendsolution/03_simple_unniss.in index 231f60c..2c5a331 100644 --- a/test/130_appendsolution/03_simple_unniss.in +++ b/test/130_appendsolution/03_simple_unniss.in | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | U F B2 | 1 | U F B2 (R' F D) |
| 2 | R' F D | ||
| 3 | 1 | 2 | 1 |
| 4 | 1 | 3 | 1 |
| 5 | rotation UF | 4 | rotation UF |
| 5 | 0 | ||
diff --git a/test/130_appendsolution/04_niss_nounniss.in b/test/130_appendsolution/04_niss_nounniss.in index 39c6518..b07f970 100644 --- a/test/130_appendsolution/04_niss_nounniss.in +++ b/test/130_appendsolution/04_niss_nounniss.in | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | U F B2 | 1 | U F B2 (R' F D) |
| 2 | R' F D | ||
| 3 | 0 | 2 | 0 |
| 4 | 1 | 3 | 1 |
| 5 | rotation UF | 4 | rotation UF |
| 5 | 0 | ||
diff --git a/test/130_appendsolution/05_sort_parallel.in b/test/130_appendsolution/05_sort_parallel.in index 7c8c4f5..bc1cf0f 100644 --- a/test/130_appendsolution/05_sort_parallel.in +++ b/test/130_appendsolution/05_sort_parallel.in | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | L R' B2 F | 1 | L R' B2 F |
| 2 | |||
| 3 | 0 | 2 | 0 |
| 4 | 1 | 3 | 1 |
| 5 | rotation UF | 4 | rotation UF |
| 5 | 0 | ||
diff --git a/test/130_appendsolution/06_unniss_trans_sort.in b/test/130_appendsolution/06_unniss_trans_sort.in index 9be03a6..2ffab93 100644 --- a/test/130_appendsolution/06_unniss_trans_sort.in +++ b/test/130_appendsolution/06_unniss_trans_sort.in | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | B | 1 | B (R2 F2) |
| 2 | R2 F2 | ||
| 3 | 1 | 2 | 1 |
| 4 | 1 | 3 | 1 |
| 5 | rotation UR | 4 | rotation UR |
| 5 | 0 | ||
diff --git a/test/130_appendsolution/07_unniss_cancel_nosol.in b/test/130_appendsolution/07_unniss_cancel_nosol.in index 561c909..6883d05 100644 --- a/test/130_appendsolution/07_unniss_cancel_nosol.in +++ b/test/130_appendsolution/07_unniss_cancel_nosol.in | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | B' F | 1 | B' F (R2 B2) |
| 2 | R2 B2 | ||
| 3 | 1 | 2 | 1 |
| 4 | 1 | 3 | 1 |
| 5 | rotation UF | 4 | rotation UF |
| 5 | 0 | ||
diff --git a/test/130_appendsolution/08_unniss_cancel_nosol_v2.in b/test/130_appendsolution/08_unniss_cancel_nosol_v2.in index e707537..3d461f0 100644 --- a/test/130_appendsolution/08_unniss_cancel_nosol_v2.in +++ b/test/130_appendsolution/08_unniss_cancel_nosol_v2.in | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | F' B | 1 | F' B (R2 F2) |
| 2 | R2 F2 | ||
| 3 | 1 | 2 | 1 |
| 4 | 1 | 3 | 1 |
| 5 | rotation UF | 4 | rotation UF |
| 5 | 0 | ||
diff --git a/test/130_appendsolution/09_fullinverse_niss.in b/test/130_appendsolution/09_fullinverse_niss.in index 33f0a26..bb2b640 100644 --- a/test/130_appendsolution/09_fullinverse_niss.in +++ b/test/130_appendsolution/09_fullinverse_niss.in | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | 1 | (F) | |
| 2 | F | ||
| 3 | 0 | 2 | 0 |
| 4 | 1 | 3 | 1 |
| 5 | rotation UF | 4 | rotation UF |
| 5 | 0 | ||
diff --git a/test/130_appendsolution/10_rotated.in b/test/130_appendsolution/10_rotated.in new file mode 100644 index 0000000..5210cd5 --- /dev/null +++ b/test/130_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/130_appendsolution/10_rotated.out b/test/130_appendsolution/10_rotated.out new file mode 100644 index 0000000..e70b2fe --- /dev/null +++ b/test/130_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/130_appendsolution/appendsolution_tests.c b/test/130_appendsolution/appendsolution_tests.c index abff359..e1b7e98 100644 --- a/test/130_appendsolution/appendsolution_tests.c +++ b/test/130_appendsolution/appendsolution_tests.c | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Input format for appendsolution tests: | 2 | Input format for appendsolution tests: |
| 3 | 3 | ||
| 4 | moves on normal | 4 | moves on normal (with NISS notation) |
| 5 | moves on inverse (without parentheses) | ||
| 6 | unniss flag (0=false, 1=true) | 5 | unniss flag (0=false, 1=true) |
| 7 | number of transformations | 6 | number of transformations |
| 8 | transformations, one per line | 7 | transformations, one per line |
| 8 | the orientation of the cube, as a number from 0 to 23 | ||
| 9 | 9 | ||
| 10 | See below for the output format. | 10 | See below for the output format. |
| 11 | */ | 11 | */ |
| @@ -13,7 +13,8 @@ See below for the output format. | |||
| 13 | #include "../test.h" | 13 | #include "../test.h" |
| 14 | 14 | ||
| 15 | uint8_t readtrans(const char [NISSY_SIZE_TRANSFORMATION]); | 15 | uint8_t readtrans(const char [NISSY_SIZE_TRANSFORMATION]); |
| 16 | int64_t readmoves(const char *, size_t n, uint8_t [n]); | 16 | int64_t readmoves(const char *, size_t n, size_t m, |
| 17 | uint64_t *, uint64_t *, uint8_t [n], uint8_t [m]); | ||
| 17 | void solution_moves_reset(solution_moves_t [static 1]); | 18 | void solution_moves_reset(solution_moves_t [static 1]); |
| 18 | bool solution_list_init(solution_list_t [static 1], size_t n, char [n]); | 19 | bool solution_list_init(solution_list_t [static 1], size_t n, char [n]); |
| 19 | int64_t appendsolution(const solution_moves_t [static 1], | 20 | int64_t appendsolution(const solution_moves_t [static 1], |
| @@ -22,6 +23,8 @@ int64_t appendsolution(const solution_moves_t [static 1], | |||
| 22 | 23 | ||
| 23 | void run(void) { | 24 | void run(void) { |
| 24 | int i, ntrans; | 25 | int i, ntrans; |
| 26 | int64_t tot; | ||
| 27 | uint64_t nm, np; | ||
| 25 | char str[STRLENMAX], buf[STRLENMAX]; | 28 | char str[STRLENMAX], buf[STRLENMAX]; |
| 26 | solution_moves_t moves; | 29 | solution_moves_t moves; |
| 27 | solution_settings_t settings; | 30 | solution_settings_t settings; |
| @@ -38,9 +41,13 @@ void run(void) { | |||
| 38 | }; | 41 | }; |
| 39 | 42 | ||
| 40 | fgets(str, STRLENMAX, stdin); | 43 | fgets(str, STRLENMAX, stdin); |
| 41 | moves.nmoves = (uint8_t)readmoves(str, 20, moves.moves); | 44 | tot = readmoves(str, 20, 20, &nm, &np, moves.moves, moves.premoves); |
| 42 | fgets(str, STRLENMAX, stdin); | 45 | if (tot < 0) { |
| 43 | moves.npremoves = (uint8_t)readmoves(str, 20, moves.premoves); | 46 | printf("Test error reading moves\n"); |
| 47 | return; | ||
| 48 | } | ||
| 49 | moves.nmoves = nm; | ||
| 50 | moves.npremoves = np; | ||
| 44 | fgets(str, STRLENMAX, stdin); | 51 | fgets(str, STRLENMAX, stdin); |
| 45 | settings.unniss = (bool)atoi(str); | 52 | settings.unniss = (bool)atoi(str); |
| 46 | fgets(str, STRLENMAX, stdin); | 53 | fgets(str, STRLENMAX, stdin); |
| @@ -49,6 +56,8 @@ void run(void) { | |||
| 49 | fgets(str, STRLENMAX, stdin); | 56 | fgets(str, STRLENMAX, stdin); |
| 50 | settings.tmask |= UINT64_C(1) << (uint64_t)readtrans(str); | 57 | settings.tmask |= UINT64_C(1) << (uint64_t)readtrans(str); |
| 51 | } | 58 | } |
| 59 | fgets(str, STRLENMAX, stdin); | ||
| 60 | settings.orientation = atoi(str); | ||
| 52 | 61 | ||
| 53 | appendsolution(&moves, &settings, &list, false, "Test"); | 62 | appendsolution(&moves, &settings, &list, false, "Test"); |
| 54 | 63 | ||
