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/00_solved_0.in | 4 ++++ test/081_getcube/00_solved_0.out | 1 + test/081_getcube/02_scrambled.in | 4 ++++ test/081_getcube/02_scrambled.out | 1 + test/081_getcube/getcube_tests.c | 29 +++++++++++++++++++++++++++++ 5 files changed, 39 insertions(+) create mode 100644 test/081_getcube/00_solved_0.in create mode 100644 test/081_getcube/00_solved_0.out create mode 100644 test/081_getcube/02_scrambled.in create mode 100644 test/081_getcube/02_scrambled.out create mode 100644 test/081_getcube/getcube_tests.c (limited to 'test') diff --git a/test/081_getcube/00_solved_0.in b/test/081_getcube/00_solved_0.in new file mode 100644 index 0000000..44e0be8 --- /dev/null +++ b/test/081_getcube/00_solved_0.in @@ -0,0 +1,4 @@ +0 +0 +0 +0 diff --git a/test/081_getcube/00_solved_0.out b/test/081_getcube/00_solved_0.out new file mode 100644 index 0000000..dff224d --- /dev/null +++ b/test/081_getcube/00_solved_0.out @@ -0,0 +1 @@ +UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 diff --git a/test/081_getcube/02_scrambled.in b/test/081_getcube/02_scrambled.in new file mode 100644 index 0000000..b24bfbf --- /dev/null +++ b/test/081_getcube/02_scrambled.in @@ -0,0 +1,4 @@ +367124500 +450 +30807 +562 diff --git a/test/081_getcube/02_scrambled.out b/test/081_getcube/02_scrambled.out new file mode 100644 index 0000000..6a05bbc --- /dev/null +++ b/test/081_getcube/02_scrambled.out @@ -0,0 +1 @@ +FL0 DB0 UB1 FR0 UR0 DF0 UF0 BR1 UL1 BL1 DL0 DR0 DFR1 UFR1 UBR1 UFL2 DBR2 DFL0 DBL2 UBL0 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