aboutsummaryrefslogtreecommitdiff
path: root/test/080_allowednext
diff options
context:
space:
mode:
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.in2
-rw-r--r--test/080_allowednext/03_R_L_R.in2
-rw-r--r--test/080_allowednext/04_longer_true.in2
-rw-r--r--test/080_allowednext/05_longer_false.in2
-rw-r--r--test/080_allowednext/06_D_U_false_order.in2
-rw-r--r--test/080_allowednext/allowednext_tests.c15
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 @@
11 12
2F 2F
3F2 3F2
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 @@
11 12
2U 2U
3F 3F
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 @@
12 13
2R 2R
3L' 3L'
4R2 4R2
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 @@
110 111
2F2 2F2
3B 3B
4D2 4D2
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 @@
17 18
2D 2D
3B2 3B2
4F' 4F'
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 @@
11 12
2D 2D
3U 3U
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
3bool allowednextmove(uint8_t *, int, uint8_t); 3bool allowednextmove(uint8_t *, uint8_t);
4 4
5static char *moves[] = { 5static char *moves[] = {
6 "U", "U2", "U'", 6 "U", "U2", "U'",
@@ -13,7 +13,7 @@ static char *moves[] = {
13 13
14int main(void) { 14int 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}

Generated with cgit - Back to sebastiano.tronto.net