From c5dfc897160bc9bbc6a91c77b5d58d421fd1cfe1 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 19 Jun 2023 15:06:11 +0200 Subject: Renamed test folders to keep order --- test/01_io/io_tests.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/01_io/io_tests.c (limited to 'test/01_io/io_tests.c') diff --git a/test/01_io/io_tests.c b/test/01_io/io_tests.c new file mode 100644 index 0000000..1ef99d0 --- /dev/null +++ b/test/01_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