From 99fabe8592a4022313b1cb0581881ee1bc6b1c99 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 20 Sep 2023 21:48:04 +0200 Subject: Added tests for compose --- test/04_compose/compose_tests.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/04_compose/compose_tests.c (limited to 'test/04_compose/compose_tests.c') diff --git a/test/04_compose/compose_tests.c b/test/04_compose/compose_tests.c new file mode 100644 index 0000000..ae34f6d --- /dev/null +++ b/test/04_compose/compose_tests.c @@ -0,0 +1,30 @@ +#include +#include +#include + +#include "../../src/cube.h" + +#define STRLENMAX 10000 + +int main() { + char str[STRLENMAX]; + cube_t c1, c2, c3; + + fgets(str, STRLENMAX, stdin); + c1 = readcube(str); + fgets(str, STRLENMAX, stdin); + c2 = readcube(str); + + c3 = compose(c1, c2); + + if (iserror(c3)) { + printf("Error composing cubes\n"); + } else if (!isconsistent(c3)) { + printf("Composed cube is inconsistent\n"); + } else { + writecube(c3, str); + printf("%s\n", str); + } + + return 0; +} -- cgit v1.3