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/appendsolution_tests.c | |
| parent | 17e5a9e1e2b241c67956651f87f40236467fe7d8 (diff) | |
| download | nissy-core-7faca28009c5efb0ba2b897b34dbdcac47a1a6f3.tar.gz nissy-core-7faca28009c5efb0ba2b897b34dbdcac47a1a6f3.zip | |
NISS
Diffstat (limited to 'test/130_appendsolution/appendsolution_tests.c')
| -rw-r--r-- | test/130_appendsolution/appendsolution_tests.c | 21 |
1 files changed, 15 insertions, 6 deletions
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 | ||
