aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorenricotenuti <tenutz_27@outlook.it>2024-08-30 12:03:03 +0200
committerenricotenuti <tenutz_27@outlook.it>2024-08-30 12:03:03 +0200
commit754e632241859b224497ee4e0239670d5d90759f (patch)
tree385bfa98001fd8c3547185357d47578c2ed314c7 /test
parent0a45da13ca06f7884872160a6756a04d1eb849c5 (diff)
downloadnissy-core-754e632241859b224497ee4e0239670d5d90759f.tar.gz
nissy-core-754e632241859b224497ee4e0239670d5d90759f.zip
allowedH48 tests
Diffstat (limited to 'test')
-rw-r--r--test/082_allowednext_h48/00_empty_U.in3
-rw-r--r--test/082_allowednext_h48/00_empty_U.out1
-rw-r--r--test/082_allowednext_h48/01_F.in4
-rw-r--r--test/082_allowednext_h48/01_F.out1
-rw-r--r--test/082_allowednext_h48/02_U2.in3
-rw-r--r--test/082_allowednext_h48/02_U2.out1
-rw-r--r--test/082_allowednext_h48/03_R_L.in5
-rw-r--r--test/082_allowednext_h48/03_R_L.out1
-rw-r--r--test/082_allowednext_h48/04_D.in3
-rw-r--r--test/082_allowednext_h48/04_D.out1
-rw-r--r--test/082_allowednext_h48/05_U_F_B2.in5
-rw-r--r--test/082_allowednext_h48/05_U_F_B2.out1
-rw-r--r--test/082_allowednext_h48/06_empty_bound.in2
-rw-r--r--test/082_allowednext_h48/06_empty_bound.out1
-rw-r--r--test/082_allowednext_h48/07_F_bound.in3
-rw-r--r--test/082_allowednext_h48/07_F_bound.out1
-rw-r--r--test/082_allowednext_h48/08_U_D_bound_inverse.in4
-rw-r--r--test/082_allowednext_h48/08_U_D_bound_inverse.out1
-rw-r--r--test/082_allowednext_h48/09_R_false_bound.in3
-rw-r--r--test/082_allowednext_h48/09_R_false_bound.out1
-rw-r--r--test/082_allowednext_h48/allowednext_h48_tests.c38
21 files changed, 83 insertions, 0 deletions
diff --git a/test/082_allowednext_h48/00_empty_U.in b/test/082_allowednext_h48/00_empty_U.in
new file mode 100644
index 0000000..28271a6
--- /dev/null
+++ b/test/082_allowednext_h48/00_empty_U.in
@@ -0,0 +1,3 @@
10
20
3
diff --git a/test/082_allowednext_h48/00_empty_U.out b/test/082_allowednext_h48/00_empty_U.out
new file mode 100644
index 0000000..8607955
--- /dev/null
+++ b/test/082_allowednext_h48/00_empty_U.out
@@ -0,0 +1 @@
0x3FFFF
diff --git a/test/082_allowednext_h48/01_F.in b/test/082_allowednext_h48/01_F.in
new file mode 100644
index 0000000..e7ae375
--- /dev/null
+++ b/test/082_allowednext_h48/01_F.in
@@ -0,0 +1,4 @@
10
21
3F
4
diff --git a/test/082_allowednext_h48/01_F.out b/test/082_allowednext_h48/01_F.out
new file mode 100644
index 0000000..5d6f843
--- /dev/null
+++ b/test/082_allowednext_h48/01_F.out
@@ -0,0 +1 @@
0x38FFF
diff --git a/test/082_allowednext_h48/02_U2.in b/test/082_allowednext_h48/02_U2.in
new file mode 100644
index 0000000..2c5ee5f
--- /dev/null
+++ b/test/082_allowednext_h48/02_U2.in
@@ -0,0 +1,3 @@
10
21
3U
diff --git a/test/082_allowednext_h48/02_U2.out b/test/082_allowednext_h48/02_U2.out
new file mode 100644
index 0000000..a9a5adb
--- /dev/null
+++ b/test/082_allowednext_h48/02_U2.out
@@ -0,0 +1 @@
0x3FFF8
diff --git a/test/082_allowednext_h48/03_R_L.in b/test/082_allowednext_h48/03_R_L.in
new file mode 100644
index 0000000..b6c0625
--- /dev/null
+++ b/test/082_allowednext_h48/03_R_L.in
@@ -0,0 +1,5 @@
10
22
3R
4L'
5
diff --git a/test/082_allowednext_h48/03_R_L.out b/test/082_allowednext_h48/03_R_L.out
new file mode 100644
index 0000000..a4aa4b2
--- /dev/null
+++ b/test/082_allowednext_h48/03_R_L.out
@@ -0,0 +1 @@
0x3F03F
diff --git a/test/082_allowednext_h48/04_D.in b/test/082_allowednext_h48/04_D.in
new file mode 100644
index 0000000..83da556
--- /dev/null
+++ b/test/082_allowednext_h48/04_D.in
@@ -0,0 +1,3 @@
10
21
3D
diff --git a/test/082_allowednext_h48/04_D.out b/test/082_allowednext_h48/04_D.out
new file mode 100644
index 0000000..fe91843
--- /dev/null
+++ b/test/082_allowednext_h48/04_D.out
@@ -0,0 +1 @@
0x3FFC0
diff --git a/test/082_allowednext_h48/05_U_F_B2.in b/test/082_allowednext_h48/05_U_F_B2.in
new file mode 100644
index 0000000..67e090f
--- /dev/null
+++ b/test/082_allowednext_h48/05_U_F_B2.in
@@ -0,0 +1,5 @@
10
22
3U
4F
5
diff --git a/test/082_allowednext_h48/05_U_F_B2.out b/test/082_allowednext_h48/05_U_F_B2.out
new file mode 100644
index 0000000..5d6f843
--- /dev/null
+++ b/test/082_allowednext_h48/05_U_F_B2.out
@@ -0,0 +1 @@
0x38FFF
diff --git a/test/082_allowednext_h48/06_empty_bound.in b/test/082_allowednext_h48/06_empty_bound.in
new file mode 100644
index 0000000..389e262
--- /dev/null
+++ b/test/082_allowednext_h48/06_empty_bound.in
@@ -0,0 +1,2 @@
12
20
diff --git a/test/082_allowednext_h48/06_empty_bound.out b/test/082_allowednext_h48/06_empty_bound.out
new file mode 100644
index 0000000..eb601fc
--- /dev/null
+++ b/test/082_allowednext_h48/06_empty_bound.out
@@ -0,0 +1 @@
0x2DB6D
diff --git a/test/082_allowednext_h48/07_F_bound.in b/test/082_allowednext_h48/07_F_bound.in
new file mode 100644
index 0000000..b3ae33d
--- /dev/null
+++ b/test/082_allowednext_h48/07_F_bound.in
@@ -0,0 +1,3 @@
12
21
3F
diff --git a/test/082_allowednext_h48/07_F_bound.out b/test/082_allowednext_h48/07_F_bound.out
new file mode 100644
index 0000000..0dc8997
--- /dev/null
+++ b/test/082_allowednext_h48/07_F_bound.out
@@ -0,0 +1 @@
0x28B6D
diff --git a/test/082_allowednext_h48/08_U_D_bound_inverse.in b/test/082_allowednext_h48/08_U_D_bound_inverse.in
new file mode 100644
index 0000000..707f7e0
--- /dev/null
+++ b/test/082_allowednext_h48/08_U_D_bound_inverse.in
@@ -0,0 +1,4 @@
13
22
3U
4D2 \ No newline at end of file
diff --git a/test/082_allowednext_h48/08_U_D_bound_inverse.out b/test/082_allowednext_h48/08_U_D_bound_inverse.out
new file mode 100644
index 0000000..6f47cf0
--- /dev/null
+++ b/test/082_allowednext_h48/08_U_D_bound_inverse.out
@@ -0,0 +1 @@
0x2DB40
diff --git a/test/082_allowednext_h48/09_R_false_bound.in b/test/082_allowednext_h48/09_R_false_bound.in
new file mode 100644
index 0000000..0b1d441
--- /dev/null
+++ b/test/082_allowednext_h48/09_R_false_bound.in
@@ -0,0 +1,3 @@
11
21
3R \ No newline at end of file
diff --git a/test/082_allowednext_h48/09_R_false_bound.out b/test/082_allowednext_h48/09_R_false_bound.out
new file mode 100644
index 0000000..121bfeb
--- /dev/null
+++ b/test/082_allowednext_h48/09_R_false_bound.out
@@ -0,0 +1 @@
0x3FE3F
diff --git a/test/082_allowednext_h48/allowednext_h48_tests.c b/test/082_allowednext_h48/allowednext_h48_tests.c
new file mode 100644
index 0000000..4cee695
--- /dev/null
+++ b/test/082_allowednext_h48/allowednext_h48_tests.c
@@ -0,0 +1,38 @@
1#include "../test.h"
2
3uint32_t allowednextmoveH48(uint8_t *, uint8_t, uint32_t);
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, bound;
18
19 fgets(movestr, STRLENMAX, stdin);
20 bound = atoi(movestr);
21
22 fgets(movestr, STRLENMAX, stdin);
23 n = atoi(movestr);
24
25 for (i = 0; i < n; i++) {
26 fgets(movestr, STRLENMAX, stdin);
27 movestr[strcspn(movestr, "\n")] = 0;
28 for (j = 0; j < 18; j++)
29 if (!strcmp(movestr, moves[j]))
30 m[i] = j;
31 }
32
33 fprintf(stderr, "Last two: %s, %s\n",
34 n > 1 ? moves[m[n-2]] : "-",
35 n > 0 ? moves[m[n-1]] : "-");
36 uint32_t allowed = allowednextmoveH48(m, n, bound);
37 printf("0x%05X\n", allowed);
38}

Generated with cgit - Back to sebastiano.tronto.net