diff options
Diffstat (limited to 'test/01_io')
| -rw-r--r-- | test/01_io/00_garbage.in | 3 | ||||
| -rw-r--r-- | test/01_io/00_garbage.out | 1 | ||||
| -rw-r--r-- | test/01_io/01_solved_oneline.in | 1 | ||||
| -rw-r--r-- | test/01_io/01_solved_oneline.out | 1 | ||||
| -rw-r--r-- | test/01_io/02_solved_oneline_whitespace.in | 1 | ||||
| -rw-r--r-- | test/01_io/02_solved_oneline_whitespace.out | 1 | ||||
| -rw-r--r-- | test/01_io/03_solved_multiline.in | 9 | ||||
| -rw-r--r-- | test/01_io/03_solved_multiline.out | 1 | ||||
| -rw-r--r-- | test/01_io/04_inconsistent_ep.in | 1 | ||||
| -rw-r--r-- | test/01_io/04_inconsistent_ep.out | 1 | ||||
| -rw-r--r-- | test/01_io/05_inconsistent_eo.in | 1 | ||||
| -rw-r--r-- | test/01_io/05_inconsistent_eo.out | 1 | ||||
| -rw-r--r-- | test/01_io/06_inconsistent_cp.in | 1 | ||||
| -rw-r--r-- | test/01_io/06_inconsistent_cp.out | 1 | ||||
| -rw-r--r-- | test/01_io/07_inconsistent_co.in | 1 | ||||
| -rw-r--r-- | test/01_io/07_inconsistent_co.out | 1 | ||||
| -rw-r--r-- | test/01_io/08_unsolved.in | 6 | ||||
| -rw-r--r-- | test/01_io/08_unsolved.out | 1 | ||||
| -rw-r--r-- | test/01_io/io_tests.c | 28 |
19 files changed, 61 insertions, 0 deletions
diff --git a/test/01_io/00_garbage.in b/test/01_io/00_garbage.in new file mode 100644 index 0000000..9ac203a --- /dev/null +++ b/test/01_io/00_garbage.in | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | FUF0 UBBBR2 k4 | ||
| 2 | hello | ||
| 3 | garbage | ||
diff --git a/test/01_io/00_garbage.out b/test/01_io/00_garbage.out new file mode 100644 index 0000000..5b9114e --- /dev/null +++ b/test/01_io/00_garbage.out | |||
| @@ -0,0 +1 @@ | |||
| Error reading cube | |||
diff --git a/test/01_io/01_solved_oneline.in b/test/01_io/01_solved_oneline.in new file mode 100644 index 0000000..dff224d --- /dev/null +++ b/test/01_io/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/01_io/01_solved_oneline.out b/test/01_io/01_solved_oneline.out new file mode 100644 index 0000000..dff224d --- /dev/null +++ b/test/01_io/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/01_io/02_solved_oneline_whitespace.in b/test/01_io/02_solved_oneline_whitespace.in new file mode 100644 index 0000000..5d10368 --- /dev/null +++ b/test/01_io/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/01_io/02_solved_oneline_whitespace.out b/test/01_io/02_solved_oneline_whitespace.out new file mode 100644 index 0000000..dff224d --- /dev/null +++ b/test/01_io/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/01_io/03_solved_multiline.in b/test/01_io/03_solved_multiline.in new file mode 100644 index 0000000..9f9652b --- /dev/null +++ b/test/01_io/03_solved_multiline.in | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | UF0 UB0 | ||
| 2 | DB0 DF0 UR0 UL0 DL0 | ||
| 3 | DR0 FR0 FL0 BL0 BR0 UFR0 | ||
| 4 | |||
| 5 | UBL0 DFL0 DBR0 | ||
| 6 | |||
| 7 | |||
| 8 | UFL0 UBR0 DFR0 | ||
| 9 | DBL0 | ||
diff --git a/test/01_io/03_solved_multiline.out b/test/01_io/03_solved_multiline.out new file mode 100644 index 0000000..dff224d --- /dev/null +++ b/test/01_io/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/01_io/04_inconsistent_ep.in b/test/01_io/04_inconsistent_ep.in new file mode 100644 index 0000000..8483962 --- /dev/null +++ b/test/01_io/04_inconsistent_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/01_io/04_inconsistent_ep.out b/test/01_io/04_inconsistent_ep.out new file mode 100644 index 0000000..cb70902 --- /dev/null +++ b/test/01_io/04_inconsistent_ep.out | |||
| @@ -0,0 +1 @@ | |||
| Cube is inconsistent | |||
diff --git a/test/01_io/05_inconsistent_eo.in b/test/01_io/05_inconsistent_eo.in new file mode 100644 index 0000000..a92089d --- /dev/null +++ b/test/01_io/05_inconsistent_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/01_io/05_inconsistent_eo.out b/test/01_io/05_inconsistent_eo.out new file mode 100644 index 0000000..cb70902 --- /dev/null +++ b/test/01_io/05_inconsistent_eo.out | |||
| @@ -0,0 +1 @@ | |||
| Cube is inconsistent | |||
diff --git a/test/01_io/06_inconsistent_cp.in b/test/01_io/06_inconsistent_cp.in new file mode 100644 index 0000000..2085dd5 --- /dev/null +++ b/test/01_io/06_inconsistent_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/01_io/06_inconsistent_cp.out b/test/01_io/06_inconsistent_cp.out new file mode 100644 index 0000000..cb70902 --- /dev/null +++ b/test/01_io/06_inconsistent_cp.out | |||
| @@ -0,0 +1 @@ | |||
| Cube is inconsistent | |||
diff --git a/test/01_io/07_inconsistent_co.in b/test/01_io/07_inconsistent_co.in new file mode 100644 index 0000000..abd74e2 --- /dev/null +++ b/test/01_io/07_inconsistent_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/01_io/07_inconsistent_co.out b/test/01_io/07_inconsistent_co.out new file mode 100644 index 0000000..cb70902 --- /dev/null +++ b/test/01_io/07_inconsistent_co.out | |||
| @@ -0,0 +1 @@ | |||
| Cube is inconsistent | |||
diff --git a/test/01_io/08_unsolved.in b/test/01_io/08_unsolved.in new file mode 100644 index 0000000..c992ce7 --- /dev/null +++ b/test/01_io/08_unsolved.in | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | UL1 DR0 UB0 DL1 | ||
| 2 | UR0 FR1 DB0 BR0 | ||
| 3 | UF1 DF0 BL0 FL0 | ||
| 4 | |||
| 5 | UBL0 DLF1 DBR2 UFR1 | ||
| 6 | DFR1 UBR1 UFL0 DBL0 | ||
diff --git a/test/01_io/08_unsolved.out b/test/01_io/08_unsolved.out new file mode 100644 index 0000000..8c132cf --- /dev/null +++ b/test/01_io/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/01_io/io_tests.c b/test/01_io/io_tests.c new file mode 100644 index 0000000..1ef99d0 --- /dev/null +++ b/test/01_io/io_tests.c | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | #include <stdbool.h> | ||
| 2 | #include <stdint.h> | ||
| 3 | #include <stdio.h> | ||
| 4 | |||
| 5 | #include "../../src/cube.h" | ||
| 6 | |||
| 7 | #define STRLENMAX 10000 | ||
| 8 | |||
| 9 | int main() { | ||
| 10 | char *c, str[STRLENMAX]; | ||
| 11 | cube_t cube; | ||
| 12 | |||
| 13 | for (c = str; (*c = getchar()) != EOF; c++) ; | ||
| 14 | *c = '\0'; | ||
| 15 | |||
| 16 | cube = readcube(str); | ||
| 17 | |||
| 18 | if (cube.e == errorcube.e && cube.c == errorcube.c) { | ||
| 19 | printf("Error reading cube\n"); | ||
| 20 | } else if (!isconsistent(cube)) { | ||
| 21 | printf("Cube is inconsistent\n"); | ||
| 22 | } else { | ||
| 23 | writecube(cube, str); | ||
| 24 | printf("%s\n", str); | ||
| 25 | } | ||
| 26 | |||
| 27 | return 0; | ||
| 28 | } | ||
