aboutsummaryrefslogtreecommitdiff
path: root/test/020_io_H48_read_write
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-06-11 12:05:24 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-06-11 12:05:24 +0200
commitb4d33513bd44c82426ef9e3c6daf5b8046672514 (patch)
treedb64d441059897974d270614cd1ad22d15fc8e56 /test/020_io_H48_read_write
parentc89c5a1832354d656757c5aff49018d0313838e0 (diff)
downloadnissy-core-b4d33513bd44c82426ef9e3c6daf5b8046672514.tar.gz
nissy-core-b4d33513bd44c82426ef9e3c6daf5b8046672514.zip
Finished refactor
Diffstat (limited to 'test/020_io_H48_read_write')
-rw-r--r--test/020_io_H48_read_write/00_garbage.in3
-rw-r--r--test/020_io_H48_read_write/00_garbage.out1
-rw-r--r--test/020_io_H48_read_write/01_solved_oneline.in1
-rw-r--r--test/020_io_H48_read_write/01_solved_oneline.out1
-rw-r--r--test/020_io_H48_read_write/02_solved_oneline_whitespace.in1
-rw-r--r--test/020_io_H48_read_write/02_solved_oneline_whitespace.out1
-rw-r--r--test/020_io_H48_read_write/03_solved_multiline.in9
-rw-r--r--test/020_io_H48_read_write/03_solved_multiline.out1
-rw-r--r--test/020_io_H48_read_write/04_unsolvable_ep.in1
-rw-r--r--test/020_io_H48_read_write/04_unsolvable_ep.out1
-rw-r--r--test/020_io_H48_read_write/05_unsolvable_eo.in1
-rw-r--r--test/020_io_H48_read_write/05_unsolvable_eo.out1
-rw-r--r--test/020_io_H48_read_write/06_unsolvable_cp.in1
-rw-r--r--test/020_io_H48_read_write/06_unsolvable_cp.out1
-rw-r--r--test/020_io_H48_read_write/07_unsolvable_co.in1
-rw-r--r--test/020_io_H48_read_write/07_unsolvable_co.out1
-rw-r--r--test/020_io_H48_read_write/08_unsolved.in6
-rw-r--r--test/020_io_H48_read_write/08_unsolved.out1
-rw-r--r--test/020_io_H48_read_write/io_H48_tests.c24
19 files changed, 57 insertions, 0 deletions
diff --git a/test/020_io_H48_read_write/00_garbage.in b/test/020_io_H48_read_write/00_garbage.in
new file mode 100644
index 0000000..9ac203a
--- /dev/null
+++ b/test/020_io_H48_read_write/00_garbage.in
@@ -0,0 +1,3 @@
1FUF0 UBBBR2 k4
2hello
3garbage
diff --git a/test/020_io_H48_read_write/00_garbage.out b/test/020_io_H48_read_write/00_garbage.out
new file mode 100644
index 0000000..5b9114e
--- /dev/null
+++ b/test/020_io_H48_read_write/00_garbage.out
@@ -0,0 +1 @@
Error reading cube
diff --git a/test/020_io_H48_read_write/01_solved_oneline.in b/test/020_io_H48_read_write/01_solved_oneline.in
new file mode 100644
index 0000000..dff224d
--- /dev/null
+++ b/test/020_io_H48_read_write/01_solved_oneline.in
@@ -0,0 +1 @@
UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
diff --git a/test/020_io_H48_read_write/01_solved_oneline.out b/test/020_io_H48_read_write/01_solved_oneline.out
new file mode 100644
index 0000000..dff224d
--- /dev/null
+++ b/test/020_io_H48_read_write/01_solved_oneline.out
@@ -0,0 +1 @@
UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
diff --git a/test/020_io_H48_read_write/02_solved_oneline_whitespace.in b/test/020_io_H48_read_write/02_solved_oneline_whitespace.in
new file mode 100644
index 0000000..5d10368
--- /dev/null
+++ b/test/020_io_H48_read_write/02_solved_oneline_whitespace.in
@@ -0,0 +1 @@
UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
diff --git a/test/020_io_H48_read_write/02_solved_oneline_whitespace.out b/test/020_io_H48_read_write/02_solved_oneline_whitespace.out
new file mode 100644
index 0000000..dff224d
--- /dev/null
+++ b/test/020_io_H48_read_write/02_solved_oneline_whitespace.out
@@ -0,0 +1 @@
UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
diff --git a/test/020_io_H48_read_write/03_solved_multiline.in b/test/020_io_H48_read_write/03_solved_multiline.in
new file mode 100644
index 0000000..9f9652b
--- /dev/null
+++ b/test/020_io_H48_read_write/03_solved_multiline.in
@@ -0,0 +1,9 @@
1UF0 UB0
2DB0 DF0 UR0 UL0 DL0
3DR0 FR0 FL0 BL0 BR0 UFR0
4
5UBL0 DFL0 DBR0
6
7
8UFL0 UBR0 DFR0
9 DBL0
diff --git a/test/020_io_H48_read_write/03_solved_multiline.out b/test/020_io_H48_read_write/03_solved_multiline.out
new file mode 100644
index 0000000..dff224d
--- /dev/null
+++ b/test/020_io_H48_read_write/03_solved_multiline.out
@@ -0,0 +1 @@
UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
diff --git a/test/020_io_H48_read_write/04_unsolvable_ep.in b/test/020_io_H48_read_write/04_unsolvable_ep.in
new file mode 100644
index 0000000..8483962
--- /dev/null
+++ b/test/020_io_H48_read_write/04_unsolvable_ep.in
@@ -0,0 +1 @@
UB0 UF0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
diff --git a/test/020_io_H48_read_write/04_unsolvable_ep.out b/test/020_io_H48_read_write/04_unsolvable_ep.out
new file mode 100644
index 0000000..e35c6e4
--- /dev/null
+++ b/test/020_io_H48_read_write/04_unsolvable_ep.out
@@ -0,0 +1 @@
Cube is not solvable
diff --git a/test/020_io_H48_read_write/05_unsolvable_eo.in b/test/020_io_H48_read_write/05_unsolvable_eo.in
new file mode 100644
index 0000000..a92089d
--- /dev/null
+++ b/test/020_io_H48_read_write/05_unsolvable_eo.in
@@ -0,0 +1 @@
UF1 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
diff --git a/test/020_io_H48_read_write/05_unsolvable_eo.out b/test/020_io_H48_read_write/05_unsolvable_eo.out
new file mode 100644
index 0000000..e35c6e4
--- /dev/null
+++ b/test/020_io_H48_read_write/05_unsolvable_eo.out
@@ -0,0 +1 @@
Cube is not solvable
diff --git a/test/020_io_H48_read_write/06_unsolvable_cp.in b/test/020_io_H48_read_write/06_unsolvable_cp.in
new file mode 100644
index 0000000..2085dd5
--- /dev/null
+++ b/test/020_io_H48_read_write/06_unsolvable_cp.in
@@ -0,0 +1 @@
UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UBL0 UFR0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
diff --git a/test/020_io_H48_read_write/06_unsolvable_cp.out b/test/020_io_H48_read_write/06_unsolvable_cp.out
new file mode 100644
index 0000000..e35c6e4
--- /dev/null
+++ b/test/020_io_H48_read_write/06_unsolvable_cp.out
@@ -0,0 +1 @@
Cube is not solvable
diff --git a/test/020_io_H48_read_write/07_unsolvable_co.in b/test/020_io_H48_read_write/07_unsolvable_co.in
new file mode 100644
index 0000000..abd74e2
--- /dev/null
+++ b/test/020_io_H48_read_write/07_unsolvable_co.in
@@ -0,0 +1 @@
UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR1 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
diff --git a/test/020_io_H48_read_write/07_unsolvable_co.out b/test/020_io_H48_read_write/07_unsolvable_co.out
new file mode 100644
index 0000000..e35c6e4
--- /dev/null
+++ b/test/020_io_H48_read_write/07_unsolvable_co.out
@@ -0,0 +1 @@
Cube is not solvable
diff --git a/test/020_io_H48_read_write/08_unsolved.in b/test/020_io_H48_read_write/08_unsolved.in
new file mode 100644
index 0000000..c992ce7
--- /dev/null
+++ b/test/020_io_H48_read_write/08_unsolved.in
@@ -0,0 +1,6 @@
1UL1 DR0 UB0 DL1
2UR0 FR1 DB0 BR0
3UF1 DF0 BL0 FL0
4
5UBL0 DLF1 DBR2 UFR1
6DFR1 UBR1 UFL0 DBL0
diff --git a/test/020_io_H48_read_write/08_unsolved.out b/test/020_io_H48_read_write/08_unsolved.out
new file mode 100644
index 0000000..8c132cf
--- /dev/null
+++ b/test/020_io_H48_read_write/08_unsolved.out
@@ -0,0 +1 @@
UL1 DR0 UB0 DL1 UR0 FR1 DB0 BR0 UF1 DF0 BL0 FL0 UBL0 DFL1 DBR2 UFR1 DFR1 UBR1 UFL0 DBL0
diff --git a/test/020_io_H48_read_write/io_H48_tests.c b/test/020_io_H48_read_write/io_H48_tests.c
new file mode 100644
index 0000000..705356c
--- /dev/null
+++ b/test/020_io_H48_read_write/io_H48_tests.c
@@ -0,0 +1,24 @@
1#include "../test.h"
2
3int main(void) {
4 char str[STRLENMAX], *aux;
5 cube_t cube;
6
7 aux = str;
8 while (fgets(aux, STRLENMAX, stdin) != NULL)
9 while (*aux != '\n')
10 aux++;
11
12 cube = readcube("H48", str);
13
14 if (iserror(cube)) {
15 printf("Error reading cube\n");
16 } else if (!issolvable(cube)) {
17 printf("Cube is not solvable\n");
18 } else {
19 writecube("H48", cube, str);
20 printf("%s\n", str);
21 }
22
23 return 0;
24}

Generated with cgit - Back to sebastiano.tronto.net