diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/010_io_H48/00_garbage.in (renamed from test/01_io/00_garbage.in) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/00_garbage.out (renamed from test/01_io/00_garbage.out) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/01_solved_oneline.in (renamed from test/01_io/01_solved_oneline.in) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/01_solved_oneline.out (renamed from test/01_io/01_solved_oneline.out) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/02_solved_oneline_whitespace.in (renamed from test/01_io/02_solved_oneline_whitespace.in) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/02_solved_oneline_whitespace.out (renamed from test/01_io/02_solved_oneline_whitespace.out) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/03_solved_multiline.in (renamed from test/01_io/03_solved_multiline.in) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/03_solved_multiline.out (renamed from test/01_io/03_solved_multiline.out) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/04_unsolvable_ep.in (renamed from test/01_io/04_unsolvable_ep.in) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/04_unsolvable_ep.out (renamed from test/01_io/04_unsolvable_ep.out) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/05_unsolvable_eo.in (renamed from test/01_io/05_unsolvable_eo.in) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/05_unsolvable_eo.out (renamed from test/01_io/05_unsolvable_eo.out) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/06_unsolvable_cp.in (renamed from test/01_io/06_unsolvable_cp.in) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/06_unsolvable_cp.out (renamed from test/01_io/06_unsolvable_cp.out) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/07_unsolvable_co.in (renamed from test/01_io/07_unsolvable_co.in) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/07_unsolvable_co.out (renamed from test/01_io/07_unsolvable_co.out) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/08_unsolved.in (renamed from test/01_io/08_unsolved.in) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/08_unsolved.out (renamed from test/01_io/08_unsolved.out) | 0 | ||||
| -rw-r--r-- | test/010_io_H48/io_H48_tests.c (renamed from test/01_io/io_tests.c) | 4 | ||||
| -rw-r--r-- | test/011_io_SRC/01_solved.in | 1 | ||||
| -rw-r--r-- | test/011_io_SRC/01_solved.out | 4 | ||||
| -rw-r--r-- | test/011_io_SRC/io_SRC_tests.c | 28 | ||||
| -rw-r--r-- | test/02_move/move_tests.c | 4 | ||||
| -rw-r--r-- | test/03_inverse/inverse_tests.c | 4 | ||||
| -rw-r--r-- | test/04_compose/compose_tests.c | 6 | ||||
| -rwxr-xr-x | test/test.sh | 2 |
26 files changed, 43 insertions, 10 deletions
diff --git a/test/01_io/00_garbage.in b/test/010_io_H48/00_garbage.in index 9ac203a..9ac203a 100644 --- a/test/01_io/00_garbage.in +++ b/test/010_io_H48/00_garbage.in | |||
diff --git a/test/01_io/00_garbage.out b/test/010_io_H48/00_garbage.out index 5b9114e..5b9114e 100644 --- a/test/01_io/00_garbage.out +++ b/test/010_io_H48/00_garbage.out | |||
diff --git a/test/01_io/01_solved_oneline.in b/test/010_io_H48/01_solved_oneline.in index dff224d..dff224d 100644 --- a/test/01_io/01_solved_oneline.in +++ b/test/010_io_H48/01_solved_oneline.in | |||
diff --git a/test/01_io/01_solved_oneline.out b/test/010_io_H48/01_solved_oneline.out index dff224d..dff224d 100644 --- a/test/01_io/01_solved_oneline.out +++ b/test/010_io_H48/01_solved_oneline.out | |||
diff --git a/test/01_io/02_solved_oneline_whitespace.in b/test/010_io_H48/02_solved_oneline_whitespace.in index 5d10368..5d10368 100644 --- a/test/01_io/02_solved_oneline_whitespace.in +++ b/test/010_io_H48/02_solved_oneline_whitespace.in | |||
diff --git a/test/01_io/02_solved_oneline_whitespace.out b/test/010_io_H48/02_solved_oneline_whitespace.out index dff224d..dff224d 100644 --- a/test/01_io/02_solved_oneline_whitespace.out +++ b/test/010_io_H48/02_solved_oneline_whitespace.out | |||
diff --git a/test/01_io/03_solved_multiline.in b/test/010_io_H48/03_solved_multiline.in index 9f9652b..9f9652b 100644 --- a/test/01_io/03_solved_multiline.in +++ b/test/010_io_H48/03_solved_multiline.in | |||
diff --git a/test/01_io/03_solved_multiline.out b/test/010_io_H48/03_solved_multiline.out index dff224d..dff224d 100644 --- a/test/01_io/03_solved_multiline.out +++ b/test/010_io_H48/03_solved_multiline.out | |||
diff --git a/test/01_io/04_unsolvable_ep.in b/test/010_io_H48/04_unsolvable_ep.in index 8483962..8483962 100644 --- a/test/01_io/04_unsolvable_ep.in +++ b/test/010_io_H48/04_unsolvable_ep.in | |||
diff --git a/test/01_io/04_unsolvable_ep.out b/test/010_io_H48/04_unsolvable_ep.out index e35c6e4..e35c6e4 100644 --- a/test/01_io/04_unsolvable_ep.out +++ b/test/010_io_H48/04_unsolvable_ep.out | |||
diff --git a/test/01_io/05_unsolvable_eo.in b/test/010_io_H48/05_unsolvable_eo.in index a92089d..a92089d 100644 --- a/test/01_io/05_unsolvable_eo.in +++ b/test/010_io_H48/05_unsolvable_eo.in | |||
diff --git a/test/01_io/05_unsolvable_eo.out b/test/010_io_H48/05_unsolvable_eo.out index e35c6e4..e35c6e4 100644 --- a/test/01_io/05_unsolvable_eo.out +++ b/test/010_io_H48/05_unsolvable_eo.out | |||
diff --git a/test/01_io/06_unsolvable_cp.in b/test/010_io_H48/06_unsolvable_cp.in index 2085dd5..2085dd5 100644 --- a/test/01_io/06_unsolvable_cp.in +++ b/test/010_io_H48/06_unsolvable_cp.in | |||
diff --git a/test/01_io/06_unsolvable_cp.out b/test/010_io_H48/06_unsolvable_cp.out index e35c6e4..e35c6e4 100644 --- a/test/01_io/06_unsolvable_cp.out +++ b/test/010_io_H48/06_unsolvable_cp.out | |||
diff --git a/test/01_io/07_unsolvable_co.in b/test/010_io_H48/07_unsolvable_co.in index abd74e2..abd74e2 100644 --- a/test/01_io/07_unsolvable_co.in +++ b/test/010_io_H48/07_unsolvable_co.in | |||
diff --git a/test/01_io/07_unsolvable_co.out b/test/010_io_H48/07_unsolvable_co.out index e35c6e4..e35c6e4 100644 --- a/test/01_io/07_unsolvable_co.out +++ b/test/010_io_H48/07_unsolvable_co.out | |||
diff --git a/test/01_io/08_unsolved.in b/test/010_io_H48/08_unsolved.in index c992ce7..c992ce7 100644 --- a/test/01_io/08_unsolved.in +++ b/test/010_io_H48/08_unsolved.in | |||
diff --git a/test/01_io/08_unsolved.out b/test/010_io_H48/08_unsolved.out index 8c132cf..8c132cf 100644 --- a/test/01_io/08_unsolved.out +++ b/test/010_io_H48/08_unsolved.out | |||
diff --git a/test/01_io/io_tests.c b/test/010_io_H48/io_H48_tests.c index 913ec1d..7c3978e 100644 --- a/test/01_io/io_tests.c +++ b/test/010_io_H48/io_H48_tests.c | |||
| @@ -13,14 +13,14 @@ int main() { | |||
| 13 | for (c = str; (*c = getchar()) != EOF; c++) ; | 13 | for (c = str; (*c = getchar()) != EOF; c++) ; |
| 14 | *c = '\0'; | 14 | *c = '\0'; |
| 15 | 15 | ||
| 16 | cube = readcube(str); | 16 | cube = readcube(H48, str); |
| 17 | 17 | ||
| 18 | if (iserror(cube)) { | 18 | if (iserror(cube)) { |
| 19 | printf("Error reading cube\n"); | 19 | printf("Error reading cube\n"); |
| 20 | } else if (!issolvable(cube)) { | 20 | } else if (!issolvable(cube)) { |
| 21 | printf("Cube is not solvable\n"); | 21 | printf("Cube is not solvable\n"); |
| 22 | } else { | 22 | } else { |
| 23 | writecube(cube, str); | 23 | writecube(H48, cube, str); |
| 24 | printf("%s\n", str); | 24 | printf("%s\n", str); |
| 25 | } | 25 | } |
| 26 | 26 | ||
diff --git a/test/011_io_SRC/01_solved.in b/test/011_io_SRC/01_solved.in new file mode 100644 index 0000000..dff224d --- /dev/null +++ b/test/011_io_SRC/01_solved.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/011_io_SRC/01_solved.out b/test/011_io_SRC/01_solved.out new file mode 100644 index 0000000..3853027 --- /dev/null +++ b/test/011_io_SRC/01_solved.out | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | { | ||
| 2 | .c = {0, 1, 2, 3, 4, 5, 6, 7}, | ||
| 3 | .e = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} | ||
| 4 | } | ||
diff --git a/test/011_io_SRC/io_SRC_tests.c b/test/011_io_SRC/io_SRC_tests.c new file mode 100644 index 0000000..f454b6f --- /dev/null +++ b/test/011_io_SRC/io_SRC_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(H48, str); | ||
| 17 | |||
| 18 | if (iserror(cube)) { | ||
| 19 | printf("Error reading cube\n"); | ||
| 20 | } else if (!issolvable(cube)) { | ||
| 21 | printf("Cube is not solvable\n"); | ||
| 22 | } else { | ||
| 23 | writecube(SRC, cube, str); | ||
| 24 | printf("%s\n", str); | ||
| 25 | } | ||
| 26 | |||
| 27 | return 0; | ||
| 28 | } | ||
diff --git a/test/02_move/move_tests.c b/test/02_move/move_tests.c index 333c8ee..054466b 100644 --- a/test/02_move/move_tests.c +++ b/test/02_move/move_tests.c | |||
| @@ -22,7 +22,7 @@ int main() { | |||
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | fgets(str, STRLENMAX, stdin); | 24 | fgets(str, STRLENMAX, stdin); |
| 25 | cube = readcube(str); | 25 | cube = readcube(H48, str); |
| 26 | 26 | ||
| 27 | for (i = 0; i < n; i++) | 27 | for (i = 0; i < n; i++) |
| 28 | cube = move(cube, moves[i]); | 28 | cube = move(cube, moves[i]); |
| @@ -32,7 +32,7 @@ int main() { | |||
| 32 | } else if (!issolvable(cube)) { | 32 | } else if (!issolvable(cube)) { |
| 33 | printf("Moved cube is not solvable\n"); | 33 | printf("Moved cube is not solvable\n"); |
| 34 | } else { | 34 | } else { |
| 35 | writecube(cube, str); | 35 | writecube(H48, cube, str); |
| 36 | printf("%s\n", str); | 36 | printf("%s\n", str); |
| 37 | } | 37 | } |
| 38 | 38 | ||
diff --git a/test/03_inverse/inverse_tests.c b/test/03_inverse/inverse_tests.c index c8d8d95..0a56568 100644 --- a/test/03_inverse/inverse_tests.c +++ b/test/03_inverse/inverse_tests.c | |||
| @@ -11,7 +11,7 @@ int main() { | |||
| 11 | cube_t cube, inv; | 11 | cube_t cube, inv; |
| 12 | 12 | ||
| 13 | fgets(str, STRLENMAX, stdin); | 13 | fgets(str, STRLENMAX, stdin); |
| 14 | cube = readcube(str); | 14 | cube = readcube(H48, str); |
| 15 | inv = inverse(cube); | 15 | inv = inverse(cube); |
| 16 | 16 | ||
| 17 | if (iserror(inv)) { | 17 | if (iserror(inv)) { |
| @@ -19,7 +19,7 @@ int main() { | |||
| 19 | } else if (!issolvable(inv)) { | 19 | } else if (!issolvable(inv)) { |
| 20 | printf("Inverted cube is not solvable\n"); | 20 | printf("Inverted cube is not solvable\n"); |
| 21 | } else { | 21 | } else { |
| 22 | writecube(inv, str); | 22 | writecube(H48, inv, str); |
| 23 | printf("%s\n", str); | 23 | printf("%s\n", str); |
| 24 | } | 24 | } |
| 25 | 25 | ||
diff --git a/test/04_compose/compose_tests.c b/test/04_compose/compose_tests.c index 575c2c9..a4a5f00 100644 --- a/test/04_compose/compose_tests.c +++ b/test/04_compose/compose_tests.c | |||
| @@ -11,9 +11,9 @@ int main() { | |||
| 11 | cube_t c1, c2, c3; | 11 | cube_t c1, c2, c3; |
| 12 | 12 | ||
| 13 | fgets(str, STRLENMAX, stdin); | 13 | fgets(str, STRLENMAX, stdin); |
| 14 | c1 = readcube(str); | 14 | c1 = readcube(H48, str); |
| 15 | fgets(str, STRLENMAX, stdin); | 15 | fgets(str, STRLENMAX, stdin); |
| 16 | c2 = readcube(str); | 16 | c2 = readcube(H48, str); |
| 17 | 17 | ||
| 18 | c3 = compose(c1, c2); | 18 | c3 = compose(c1, c2); |
| 19 | 19 | ||
| @@ -22,7 +22,7 @@ int main() { | |||
| 22 | } else if (!issolvable(c3)) { | 22 | } else if (!issolvable(c3)) { |
| 23 | printf("Composed cube is not solvable\n"); | 23 | printf("Composed cube is not solvable\n"); |
| 24 | } else { | 24 | } else { |
| 25 | writecube(c3, str); | 25 | writecube(H48, c3, str); |
| 26 | printf("%s\n", str); | 26 | printf("%s\n", str); |
| 27 | } | 27 | } |
| 28 | 28 | ||
diff --git a/test/test.sh b/test/test.sh index 5e17d33..9eae127 100755 --- a/test/test.sh +++ b/test/test.sh | |||
| @@ -11,7 +11,7 @@ TESTOUT="test/last.out" | |||
| 11 | TESTERR="test/last.err" | 11 | TESTERR="test/last.err" |
| 12 | CUBEOBJ="test/cube.o" | 12 | CUBEOBJ="test/cube.o" |
| 13 | 13 | ||
| 14 | $CC -c $SRC -o $CUBEOBJ | 14 | $CC -c $SRC -o $CUBEOBJ || exit 1 |
| 15 | 15 | ||
| 16 | for t in test/*; do | 16 | for t in test/*; do |
| 17 | if [ ! -d $t ]; then continue; fi | 17 | if [ ! -d $t ]; then continue; fi |
