aboutsummaryrefslogtreecommitdiff
path: root/test/090_allowedmoves
diff options
context:
space:
mode:
Diffstat (limited to 'test/090_allowedmoves')
-rw-r--r--test/090_allowedmoves/00_empty.in1
-rw-r--r--test/090_allowedmoves/00_empty.out1
-rw-r--r--test/090_allowedmoves/01_onemove.in2
-rw-r--r--test/090_allowedmoves/01_onemove.out1
-rw-r--r--test/090_allowedmoves/02_F_F2.in3
-rw-r--r--test/090_allowedmoves/02_F_F2.out1
-rw-r--r--test/090_allowedmoves/03_U_F.in3
-rw-r--r--test/090_allowedmoves/03_U_F.out1
-rw-r--r--test/090_allowedmoves/04_R_L_R.in4
-rw-r--r--test/090_allowedmoves/04_R_L_R.out1
-rw-r--r--test/090_allowedmoves/05_longer_true.in12
-rw-r--r--test/090_allowedmoves/05_longer_true.out1
-rw-r--r--test/090_allowedmoves/06_longer_false.in12
-rw-r--r--test/090_allowedmoves/06_longer_false.out1
-rw-r--r--test/090_allowedmoves/07_D_U_false_order.in3
-rw-r--r--test/090_allowedmoves/07_D_U_false_order.out1
-rw-r--r--test/090_allowedmoves/allowedmoves_tests.c31
17 files changed, 79 insertions, 0 deletions
diff --git a/test/090_allowedmoves/00_empty.in b/test/090_allowedmoves/00_empty.in
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/test/090_allowedmoves/00_empty.in
@@ -0,0 +1 @@
0
diff --git a/test/090_allowedmoves/00_empty.out b/test/090_allowedmoves/00_empty.out
new file mode 100644
index 0000000..27ba77d
--- /dev/null
+++ b/test/090_allowedmoves/00_empty.out
@@ -0,0 +1 @@
true
diff --git a/test/090_allowedmoves/01_onemove.in b/test/090_allowedmoves/01_onemove.in
new file mode 100644
index 0000000..aac8dac
--- /dev/null
+++ b/test/090_allowedmoves/01_onemove.in
@@ -0,0 +1,2 @@
11
2B'
diff --git a/test/090_allowedmoves/01_onemove.out b/test/090_allowedmoves/01_onemove.out
new file mode 100644
index 0000000..27ba77d
--- /dev/null
+++ b/test/090_allowedmoves/01_onemove.out
@@ -0,0 +1 @@
true
diff --git a/test/090_allowedmoves/02_F_F2.in b/test/090_allowedmoves/02_F_F2.in
new file mode 100644
index 0000000..93f0a9c
--- /dev/null
+++ b/test/090_allowedmoves/02_F_F2.in
@@ -0,0 +1,3 @@
12
2F
3F2
diff --git a/test/090_allowedmoves/02_F_F2.out b/test/090_allowedmoves/02_F_F2.out
new file mode 100644
index 0000000..c508d53
--- /dev/null
+++ b/test/090_allowedmoves/02_F_F2.out
@@ -0,0 +1 @@
false
diff --git a/test/090_allowedmoves/03_U_F.in b/test/090_allowedmoves/03_U_F.in
new file mode 100644
index 0000000..ad3607e
--- /dev/null
+++ b/test/090_allowedmoves/03_U_F.in
@@ -0,0 +1,3 @@
12
2U
3F
diff --git a/test/090_allowedmoves/03_U_F.out b/test/090_allowedmoves/03_U_F.out
new file mode 100644
index 0000000..27ba77d
--- /dev/null
+++ b/test/090_allowedmoves/03_U_F.out
@@ -0,0 +1 @@
true
diff --git a/test/090_allowedmoves/04_R_L_R.in b/test/090_allowedmoves/04_R_L_R.in
new file mode 100644
index 0000000..ffd9542
--- /dev/null
+++ b/test/090_allowedmoves/04_R_L_R.in
@@ -0,0 +1,4 @@
13
2R
3L'
4R2
diff --git a/test/090_allowedmoves/04_R_L_R.out b/test/090_allowedmoves/04_R_L_R.out
new file mode 100644
index 0000000..c508d53
--- /dev/null
+++ b/test/090_allowedmoves/04_R_L_R.out
@@ -0,0 +1 @@
false
diff --git a/test/090_allowedmoves/05_longer_true.in b/test/090_allowedmoves/05_longer_true.in
new file mode 100644
index 0000000..1d9999c
--- /dev/null
+++ b/test/090_allowedmoves/05_longer_true.in
@@ -0,0 +1,12 @@
111
2F2
3B
4U
5D'
6R
7L2
8F
9U'
10D
11F
12L
diff --git a/test/090_allowedmoves/05_longer_true.out b/test/090_allowedmoves/05_longer_true.out
new file mode 100644
index 0000000..27ba77d
--- /dev/null
+++ b/test/090_allowedmoves/05_longer_true.out
@@ -0,0 +1 @@
true
diff --git a/test/090_allowedmoves/06_longer_false.in b/test/090_allowedmoves/06_longer_false.in
new file mode 100644
index 0000000..00fe94f
--- /dev/null
+++ b/test/090_allowedmoves/06_longer_false.in
@@ -0,0 +1,12 @@
18
2D
3F'
4B2
5L'
6F'
7R'
8L2
9R
10B
11U2
12D
diff --git a/test/090_allowedmoves/06_longer_false.out b/test/090_allowedmoves/06_longer_false.out
new file mode 100644
index 0000000..c508d53
--- /dev/null
+++ b/test/090_allowedmoves/06_longer_false.out
@@ -0,0 +1 @@
false
diff --git a/test/090_allowedmoves/07_D_U_false_order.in b/test/090_allowedmoves/07_D_U_false_order.in
new file mode 100644
index 0000000..680d1a1
--- /dev/null
+++ b/test/090_allowedmoves/07_D_U_false_order.in
@@ -0,0 +1,3 @@
12
2D
3U
diff --git a/test/090_allowedmoves/07_D_U_false_order.out b/test/090_allowedmoves/07_D_U_false_order.out
new file mode 100644
index 0000000..c508d53
--- /dev/null
+++ b/test/090_allowedmoves/07_D_U_false_order.out
@@ -0,0 +1 @@
false
diff --git a/test/090_allowedmoves/allowedmoves_tests.c b/test/090_allowedmoves/allowedmoves_tests.c
new file mode 100644
index 0000000..aa6bda7
--- /dev/null
+++ b/test/090_allowedmoves/allowedmoves_tests.c
@@ -0,0 +1,31 @@
1#include "../test.h"
2
3bool allowedmoves(size_t n, const uint8_t [n]);
4
5static 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
14void run(void) {
15 char movestr[STRLENMAX];
16 uint8_t m[100];
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
30 printf("%s\n", allowedmoves(n, m) ? "true" : "false");
31}

Generated with cgit - Back to sebastiano.tronto.net