From 259c7326f78d5495f5dc51c619932599a5279f68 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 22 Oct 2023 12:49:20 +0200 Subject: Progess with transformation implementation --- test/05_transform/00_solved_UFr.in | 2 ++ test/05_transform/00_solved_UFr.out | 1 + test/05_transform/01_solved_BLm.in | 2 ++ test/05_transform/01_solved_BLm.out | 1 + test/05_transform/transform_tests.c | 38 +++++++++++++++++++++++++++++++++++++ 5 files changed, 44 insertions(+) create mode 100644 test/05_transform/00_solved_UFr.in create mode 100644 test/05_transform/00_solved_UFr.out create mode 100644 test/05_transform/01_solved_BLm.in create mode 100644 test/05_transform/01_solved_BLm.out create mode 100644 test/05_transform/transform_tests.c (limited to 'test') diff --git a/test/05_transform/00_solved_UFr.in b/test/05_transform/00_solved_UFr.in new file mode 100644 index 0000000..aa89e85 --- /dev/null +++ b/test/05_transform/00_solved_UFr.in @@ -0,0 +1,2 @@ +rotation UF +UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 diff --git a/test/05_transform/00_solved_UFr.out b/test/05_transform/00_solved_UFr.out new file mode 100644 index 0000000..dff224d --- /dev/null +++ b/test/05_transform/00_solved_UFr.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/05_transform/01_solved_BLm.in b/test/05_transform/01_solved_BLm.in new file mode 100644 index 0000000..43aadb8 --- /dev/null +++ b/test/05_transform/01_solved_BLm.in @@ -0,0 +1,2 @@ +mirrored BL +UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 diff --git a/test/05_transform/01_solved_BLm.out b/test/05_transform/01_solved_BLm.out new file mode 100644 index 0000000..dff224d --- /dev/null +++ b/test/05_transform/01_solved_BLm.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/05_transform/transform_tests.c b/test/05_transform/transform_tests.c new file mode 100644 index 0000000..c648662 --- /dev/null +++ b/test/05_transform/transform_tests.c @@ -0,0 +1,38 @@ +#include +#include +#include + +#include "../../src/cube.h" +#include "../../src/constants.h" + +#define STRLENMAX 10000 + +int main() { + char str[STRLENMAX]; + trans_t t; + cube_t cube; + + fgets(str, STRLENMAX, stdin); + t = readtrans(str); + + if (t == errortrans) { + printf("Error reading trans\n"); + return 1; + } + + fgets(str, STRLENMAX, stdin); + cube = readcube(H48, str); + + cube = transform(cube, t); + + if (iserror(cube)) { + printf("Error transforming cube\n"); + } else if (!issolvable(cube)) { + printf("Transformed cube is not solvable\n"); + } else { + writecube(H48, cube, str); + printf("%s\n", str); + } + + return 0; +} -- cgit v1.3