diff options
Diffstat (limited to 'test/080_allowednext')
| -rw-r--r-- | test/080_allowednext/00_empty_U.in | 2 | ||||
| -rw-r--r-- | test/080_allowednext/00_empty_U.out | 1 | ||||
| -rw-r--r-- | test/080_allowednext/02_F_F2.in | 3 | ||||
| -rw-r--r-- | test/080_allowednext/02_F_F2.out | 1 | ||||
| -rw-r--r-- | test/080_allowednext/02_U_F.in | 3 | ||||
| -rw-r--r-- | test/080_allowednext/02_U_F.out | 1 | ||||
| -rw-r--r-- | test/080_allowednext/03_R_L_R.in | 4 | ||||
| -rw-r--r-- | test/080_allowednext/03_R_L_R.out | 1 | ||||
| -rw-r--r-- | test/080_allowednext/04_longer_true.in | 12 | ||||
| -rw-r--r-- | test/080_allowednext/04_longer_true.out | 1 | ||||
| -rw-r--r-- | test/080_allowednext/05_longer_false.in | 9 | ||||
| -rw-r--r-- | test/080_allowednext/05_longer_false.out | 1 | ||||
| -rw-r--r-- | test/080_allowednext/06_D_U_false_order.in | 3 | ||||
| -rw-r--r-- | test/080_allowednext/06_D_U_false_order.out | 1 | ||||
| -rw-r--r-- | test/080_allowednext/allowednext_tests.c | 42 |
15 files changed, 85 insertions, 0 deletions
diff --git a/test/080_allowednext/00_empty_U.in b/test/080_allowednext/00_empty_U.in new file mode 100644 index 0000000..feb4bc3 --- /dev/null +++ b/test/080_allowednext/00_empty_U.in | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | 0 | ||
| 2 | U | ||
diff --git a/test/080_allowednext/00_empty_U.out b/test/080_allowednext/00_empty_U.out new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/test/080_allowednext/00_empty_U.out | |||
| @@ -0,0 +1 @@ | |||
| true | |||
diff --git a/test/080_allowednext/02_F_F2.in b/test/080_allowednext/02_F_F2.in new file mode 100644 index 0000000..06f504f --- /dev/null +++ b/test/080_allowednext/02_F_F2.in | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | 1 | ||
| 2 | F | ||
| 3 | F2 | ||
diff --git a/test/080_allowednext/02_F_F2.out b/test/080_allowednext/02_F_F2.out new file mode 100644 index 0000000..c508d53 --- /dev/null +++ b/test/080_allowednext/02_F_F2.out | |||
| @@ -0,0 +1 @@ | |||
| false | |||
diff --git a/test/080_allowednext/02_U_F.in b/test/080_allowednext/02_U_F.in new file mode 100644 index 0000000..3a41149 --- /dev/null +++ b/test/080_allowednext/02_U_F.in | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | 1 | ||
| 2 | U | ||
| 3 | F | ||
diff --git a/test/080_allowednext/02_U_F.out b/test/080_allowednext/02_U_F.out new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/test/080_allowednext/02_U_F.out | |||
| @@ -0,0 +1 @@ | |||
| true | |||
diff --git a/test/080_allowednext/03_R_L_R.in b/test/080_allowednext/03_R_L_R.in new file mode 100644 index 0000000..e215381 --- /dev/null +++ b/test/080_allowednext/03_R_L_R.in | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | 2 | ||
| 2 | R | ||
| 3 | L' | ||
| 4 | R2 | ||
diff --git a/test/080_allowednext/03_R_L_R.out b/test/080_allowednext/03_R_L_R.out new file mode 100644 index 0000000..c508d53 --- /dev/null +++ b/test/080_allowednext/03_R_L_R.out | |||
| @@ -0,0 +1 @@ | |||
| false | |||
diff --git a/test/080_allowednext/04_longer_true.in b/test/080_allowednext/04_longer_true.in new file mode 100644 index 0000000..e1f1d62 --- /dev/null +++ b/test/080_allowednext/04_longer_true.in | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | 10 | ||
| 2 | F2 | ||
| 3 | B | ||
| 4 | D2 | ||
| 5 | D' | ||
| 6 | L | ||
| 7 | R2 | ||
| 8 | U | ||
| 9 | U' | ||
| 10 | D | ||
| 11 | F | ||
| 12 | L | ||
diff --git a/test/080_allowednext/04_longer_true.out b/test/080_allowednext/04_longer_true.out new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/test/080_allowednext/04_longer_true.out | |||
| @@ -0,0 +1 @@ | |||
| true | |||
diff --git a/test/080_allowednext/05_longer_false.in b/test/080_allowednext/05_longer_false.in new file mode 100644 index 0000000..6befeff --- /dev/null +++ b/test/080_allowednext/05_longer_false.in | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | 7 | ||
| 2 | D | ||
| 3 | B2 | ||
| 4 | F' | ||
| 5 | L' | ||
| 6 | F' | ||
| 7 | L' | ||
| 8 | R2 | ||
| 9 | L | ||
diff --git a/test/080_allowednext/05_longer_false.out b/test/080_allowednext/05_longer_false.out new file mode 100644 index 0000000..c508d53 --- /dev/null +++ b/test/080_allowednext/05_longer_false.out | |||
| @@ -0,0 +1 @@ | |||
| false | |||
diff --git a/test/080_allowednext/06_D_U_false_order.in b/test/080_allowednext/06_D_U_false_order.in new file mode 100644 index 0000000..7bfd8c2 --- /dev/null +++ b/test/080_allowednext/06_D_U_false_order.in | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | 1 | ||
| 2 | D | ||
| 3 | U | ||
diff --git a/test/080_allowednext/06_D_U_false_order.out b/test/080_allowednext/06_D_U_false_order.out new file mode 100644 index 0000000..c508d53 --- /dev/null +++ b/test/080_allowednext/06_D_U_false_order.out | |||
| @@ -0,0 +1 @@ | |||
| false | |||
diff --git a/test/080_allowednext/allowednext_tests.c b/test/080_allowednext/allowednext_tests.c new file mode 100644 index 0000000..98a437f --- /dev/null +++ b/test/080_allowednext/allowednext_tests.c | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | bool allowednextmove(uint8_t *, int, uint8_t); | ||
| 4 | |||
| 5 | static char *moves[] = { | ||
| 6 | "U", "U2", "U'", | ||
| 7 | "D", "D2", "D'", | ||
| 8 | "R", "R2", "R'", | ||
| 9 | "L", "L2", "L'", | ||
| 10 | "F", "F2", "F'", | ||
| 11 | "B", "B2", "B'", | ||
| 12 | }; | ||
| 13 | |||
| 14 | int main() { | ||
| 15 | char movestr[STRLENMAX]; | ||
| 16 | uint8_t m[100], next; | ||
| 17 | int n, i, j; | ||
| 18 | |||
| 19 | fgets(movestr, STRLENMAX, stdin); | ||
| 20 | n = atoi(movestr); | ||
| 21 | |||
| 22 | for (i = 0; i < n; i++) { | ||
| 23 | fgets(movestr, STRLENMAX, stdin); | ||
| 24 | movestr[strcspn(movestr, "\n")] = 0; | ||
| 25 | for (j = 0; j < 18; j++) | ||
| 26 | if (!strcmp(movestr, moves[j])) | ||
| 27 | m[i] = j; | ||
| 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 | |||
| 35 | fprintf(stderr, "Last two: %s, %s\nNext: %s\n", | ||
| 36 | n > 1 ? moves[m[n-2]] : "-", | ||
| 37 | n > 0 ? moves[m[n-1]] : "-", | ||
| 38 | moves[next]); | ||
| 39 | printf("%s\n", allowednextmove(m, n, next) ? "true" : "false"); | ||
| 40 | |||
| 41 | return 0; | ||
| 42 | } | ||
