diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-10-22 12:49:20 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-10-22 12:49:20 +0200 |
| commit | 259c7326f78d5495f5dc51c619932599a5279f68 (patch) | |
| tree | a78e2b9d9624014dac5405c5e26266bf27321101 /test/05_transform/transform_tests.c | |
| parent | 0032089b5c7dedf057c60fcee17cbdd2b0f8bb87 (diff) | |
| download | nissy-core-259c7326f78d5495f5dc51c619932599a5279f68.tar.gz nissy-core-259c7326f78d5495f5dc51c619932599a5279f68.zip | |
Progess with transformation implementation
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 | } | ||
