From 66c1c11ec13d362ddfb1b5f6abe8127969c0ad29 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 5 Jul 2024 22:16:44 +0200 Subject: Finished getcube --- test/081_getcube/getcube_tests.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/081_getcube/getcube_tests.c (limited to 'test/081_getcube/getcube_tests.c') diff --git a/test/081_getcube/getcube_tests.c b/test/081_getcube/getcube_tests.c new file mode 100644 index 0000000..7eb59dc --- /dev/null +++ b/test/081_getcube/getcube_tests.c @@ -0,0 +1,29 @@ +#include "../test.h" + +cube_t getcube(int64_t, int64_t, int64_t, int64_t); + +void run(void) { + char str[STRLENMAX]; + cube_t cube; + int64_t ep, eo, cp, co; + + fgets(str, STRLENMAX, stdin); + ep = atoll(str); + fgets(str, STRLENMAX, stdin); + eo = atoll(str); + fgets(str, STRLENMAX, stdin); + cp = atoll(str); + fgets(str, STRLENMAX, stdin); + co = atoll(str); + + cube = getcube(ep, eo, cp, co); + + if (iserror(cube)) { + printf("Error cube\n"); + } else if (!isconsistent(cube)) { + printf("Inconsistent cube\n"); + } else { + writecube("H48", cube, str); + printf("%s\n", str); + } +} -- cgit v1.3