diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-04-16 17:51:05 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-04-16 17:51:05 +0200 |
| commit | 81708be1d1784f41343530e8e01a68094bc50da6 (patch) | |
| tree | e9894214d6bdf551e6ef1496a7483bffd3e79a77 /test/080_allowednext | |
| parent | 5378be20bc24ea0c8681da17d0585ee6ff82f788 (diff) | |
| download | nissy-core-81708be1d1784f41343530e8e01a68094bc50da6.tar.gz nissy-core-81708be1d1784f41343530e8e01a68094bc50da6.zip | |
Failed attempts to fix / debug eoesep + other changes
Diffstat (limited to 'test/080_allowednext')
| -rw-r--r-- | test/080_allowednext/01_F_F2.in (renamed from test/080_allowednext/02_F_F2.in) | 2 | ||||
| -rw-r--r-- | test/080_allowednext/01_F_F2.out (renamed from test/080_allowednext/02_F_F2.out) | 0 | ||||
| -rw-r--r-- | test/080_allowednext/02_U_F.in | 2 | ||||
| -rw-r--r-- | test/080_allowednext/03_R_L_R.in | 2 | ||||
| -rw-r--r-- | test/080_allowednext/04_longer_true.in | 2 | ||||
| -rw-r--r-- | test/080_allowednext/05_longer_false.in | 2 | ||||
| -rw-r--r-- | test/080_allowednext/06_D_U_false_order.in | 2 | ||||
| -rw-r--r-- | test/080_allowednext/allowednext_tests.c | 15 |
8 files changed, 11 insertions, 16 deletions
diff --git a/test/080_allowednext/02_F_F2.in b/test/080_allowednext/01_F_F2.in index 06f504f..93f0a9c 100644 --- a/test/080_allowednext/02_F_F2.in +++ b/test/080_allowednext/01_F_F2.in | |||
| @@ -1,3 +1,3 @@ | |||
| 1 | 1 | 1 | 2 |
| 2 | F | 2 | F |
| 3 | F2 | 3 | F2 |
diff --git a/test/080_allowednext/02_F_F2.out b/test/080_allowednext/01_F_F2.out index c508d53..c508d53 100644 --- a/test/080_allowednext/02_F_F2.out +++ b/test/080_allowednext/01_F_F2.out | |||
diff --git a/test/080_allowednext/02_U_F.in b/test/080_allowednext/02_U_F.in index 3a41149..ad3607e 100644 --- a/test/080_allowednext/02_U_F.in +++ b/test/080_allowednext/02_U_F.in | |||
| @@ -1,3 +1,3 @@ | |||
| 1 | 1 | 1 | 2 |
| 2 | U | 2 | U |
| 3 | F | 3 | F |
diff --git a/test/080_allowednext/03_R_L_R.in b/test/080_allowednext/03_R_L_R.in index e215381..ffd9542 100644 --- a/test/080_allowednext/03_R_L_R.in +++ b/test/080_allowednext/03_R_L_R.in | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | 2 | 1 | 3 |
| 2 | R | 2 | R |
| 3 | L' | 3 | L' |
| 4 | R2 | 4 | R2 |
diff --git a/test/080_allowednext/04_longer_true.in b/test/080_allowednext/04_longer_true.in index e1f1d62..0360619 100644 --- a/test/080_allowednext/04_longer_true.in +++ b/test/080_allowednext/04_longer_true.in | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | 10 | 1 | 11 |
| 2 | F2 | 2 | F2 |
| 3 | B | 3 | B |
| 4 | D2 | 4 | D2 |
diff --git a/test/080_allowednext/05_longer_false.in b/test/080_allowednext/05_longer_false.in index 6befeff..6cf8ecd 100644 --- a/test/080_allowednext/05_longer_false.in +++ b/test/080_allowednext/05_longer_false.in | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | 7 | 1 | 8 |
| 2 | D | 2 | D |
| 3 | B2 | 3 | B2 |
| 4 | F' | 4 | F' |
diff --git a/test/080_allowednext/06_D_U_false_order.in b/test/080_allowednext/06_D_U_false_order.in index 7bfd8c2..680d1a1 100644 --- a/test/080_allowednext/06_D_U_false_order.in +++ b/test/080_allowednext/06_D_U_false_order.in | |||
| @@ -1,3 +1,3 @@ | |||
| 1 | 1 | 1 | 2 |
| 2 | D | 2 | D |
| 3 | U | 3 | U |
diff --git a/test/080_allowednext/allowednext_tests.c b/test/080_allowednext/allowednext_tests.c index 7ae7f66..e531911 100644 --- a/test/080_allowednext/allowednext_tests.c +++ b/test/080_allowednext/allowednext_tests.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | bool allowednextmove(uint8_t *, int, uint8_t); | 3 | bool allowednextmove(uint8_t *, uint8_t); |
| 4 | 4 | ||
| 5 | static char *moves[] = { | 5 | static char *moves[] = { |
| 6 | "U", "U2", "U'", | 6 | "U", "U2", "U'", |
| @@ -13,7 +13,7 @@ static char *moves[] = { | |||
| 13 | 13 | ||
| 14 | int main(void) { | 14 | int main(void) { |
| 15 | char movestr[STRLENMAX]; | 15 | char movestr[STRLENMAX]; |
| 16 | uint8_t m[100], next; | 16 | uint8_t m[100]; |
| 17 | int n, i, j; | 17 | int n, i, j; |
| 18 | 18 | ||
| 19 | fgets(movestr, STRLENMAX, stdin); | 19 | fgets(movestr, STRLENMAX, stdin); |
| @@ -26,17 +26,12 @@ int main(void) { | |||
| 26 | if (!strcmp(movestr, moves[j])) | 26 | if (!strcmp(movestr, moves[j])) |
| 27 | m[i] = j; | 27 | m[i] = j; |
| 28 | } | 28 | } |
| 29 | fgets(movestr, STRLENMAX, stdin); | ||
| 30 | movestr[strcspn(movestr, "\n")] = 0; | ||
| 31 | for (j = 0; j < 18; j++) | ||
| 32 | if (!strcmp(movestr, moves[j])) | ||
| 33 | next = j; | ||
| 34 | 29 | ||
| 35 | fprintf(stderr, "Last two: %s, %s\nNext: %s\n", | 30 | fprintf(stderr, "Last two: %s, %s\nNext: %s\n", |
| 31 | n > 2 ? moves[m[n-3]] : "-", | ||
| 36 | n > 1 ? moves[m[n-2]] : "-", | 32 | n > 1 ? moves[m[n-2]] : "-", |
| 37 | n > 0 ? moves[m[n-1]] : "-", | 33 | n > 0 ? moves[m[n-1]] : "-"); |
| 38 | moves[next]); | 34 | printf("%s\n", allowednextmove(m, n) ? "true" : "false"); |
| 39 | printf("%s\n", allowednextmove(m, n, next) ? "true" : "false"); | ||
| 40 | 35 | ||
| 41 | return 0; | 36 | return 0; |
| 42 | } | 37 | } |
