aboutsummaryrefslogtreecommitdiff
path: root/test/io/io_tests.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/io/io_tests.c')
-rw-r--r--test/io/io_tests.c28
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
9int 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}

Generated with cgit - Back to sebastiano.tronto.net