diff options
Diffstat (limited to 'test/05_transform/transform_tests.c')
| -rw-r--r-- | test/05_transform/transform_tests.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/05_transform/transform_tests.c b/test/05_transform/transform_tests.c new file mode 100644 index 0000000..c648662 --- /dev/null +++ b/test/05_transform/transform_tests.c | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | #include <stdbool.h> | ||
| 2 | #include <stdint.h> | ||
| 3 | #include <stdio.h> | ||
| 4 | |||
| 5 | #include "../../src/cube.h" | ||
| 6 | #include "../../src/constants.h" | ||
| 7 | |||
| 8 | #define STRLENMAX 10000 | ||
| 9 | |||
| 10 | int main() { | ||
| 11 | char str[STRLENMAX]; | ||
| 12 | trans_t t; | ||
| 13 | cube_t cube; | ||
| 14 | |||
| 15 | fgets(str, STRLENMAX, stdin); | ||
| 16 | t = readtrans(str); | ||
| 17 | |||
| 18 | if (t == errortrans) { | ||
| 19 | printf("Error reading trans\n"); | ||
| 20 | return 1; | ||
| 21 | } | ||
| 22 | |||
| 23 | fgets(str, STRLENMAX, stdin); | ||
| 24 | cube = readcube(H48, str); | ||
| 25 | |||
| 26 | cube = transform(cube, t); | ||
| 27 | |||
| 28 | if (iserror(cube)) { | ||
| 29 | printf("Error transforming cube\n"); | ||
| 30 | } else if (!issolvable(cube)) { | ||
| 31 | printf("Transformed cube is not solvable\n"); | ||
| 32 | } else { | ||
| 33 | writecube(H48, cube, str); | ||
| 34 | printf("%s\n", str); | ||
| 35 | } | ||
| 36 | |||
| 37 | return 0; | ||
| 38 | } | ||
