diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-05-29 01:06:09 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-05-29 01:06:09 +0200 |
| commit | f987f5af492f2ac9d5aeebd351bcb49175556af2 (patch) | |
| tree | e4a6a242996f83c2110dcf46dc2b7a3f271f2b44 /test/io/io_tests.c | |
| download | nissy-core-f987f5af492f2ac9d5aeebd351bcb49175556af2.tar.gz nissy-core-f987f5af492f2ac9d5aeebd351bcb49175556af2.zip | |
Initial commit
Diffstat (limited to 'test/io/io_tests.c')
| -rw-r--r-- | test/io/io_tests.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/io/io_tests.c b/test/io/io_tests.c new file mode 100644 index 0000000..1ef99d0 --- /dev/null +++ b/test/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 | } | ||
