From f987f5af492f2ac9d5aeebd351bcb49175556af2 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 29 May 2023 01:06:09 +0200 Subject: Initial commit --- test/io/io_tests.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/io/io_tests.c (limited to 'test/io/io_tests.c') 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 @@ +#include +#include +#include + +#include "../../src/cube.h" + +#define STRLENMAX 10000 + +int main() { + char *c, str[STRLENMAX]; + cube_t cube; + + for (c = str; (*c = getchar()) != EOF; c++) ; + *c = '\0'; + + cube = readcube(str); + + if (cube.e == errorcube.e && cube.c == errorcube.c) { + printf("Error reading cube\n"); + } else if (!isconsistent(cube)) { + printf("Cube is inconsistent\n"); + } else { + writecube(cube, str); + printf("%s\n", str); + } + + return 0; +} -- cgit v1.3