diff options
Diffstat (limited to 'test/040_compose/compose_tests.c')
| -rw-r--r-- | test/040_compose/compose_tests.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/040_compose/compose_tests.c b/test/040_compose/compose_tests.c new file mode 100644 index 0000000..a4a5f00 --- /dev/null +++ b/test/040_compose/compose_tests.c | |||
| @@ -0,0 +1,30 @@ | |||
| 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 str[STRLENMAX]; | ||
| 11 | cube_t c1, c2, c3; | ||
| 12 | |||
| 13 | fgets(str, STRLENMAX, stdin); | ||
| 14 | c1 = readcube(H48, str); | ||
| 15 | fgets(str, STRLENMAX, stdin); | ||
| 16 | c2 = readcube(H48, str); | ||
| 17 | |||
| 18 | c3 = compose(c1, c2); | ||
| 19 | |||
| 20 | if (iserror(c3)) { | ||
| 21 | printf("Error composing cubes\n"); | ||
| 22 | } else if (!issolvable(c3)) { | ||
| 23 | printf("Composed cube is not solvable\n"); | ||
| 24 | } else { | ||
| 25 | writecube(H48, c3, str); | ||
| 26 | printf("%s\n", str); | ||
| 27 | } | ||
| 28 | |||
| 29 | return 0; | ||
| 30 | } | ||
