aboutsummaryrefslogtreecommitdiff
path: root/test/05_transform
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-10-22 12:49:20 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2023-10-22 12:49:20 +0200
commit259c7326f78d5495f5dc51c619932599a5279f68 (patch)
treea78e2b9d9624014dac5405c5e26266bf27321101 /test/05_transform
parent0032089b5c7dedf057c60fcee17cbdd2b0f8bb87 (diff)
downloadnissy-core-259c7326f78d5495f5dc51c619932599a5279f68.tar.gz
nissy-core-259c7326f78d5495f5dc51c619932599a5279f68.zip
Progess with transformation implementation
Diffstat (limited to 'test/05_transform')
-rw-r--r--test/05_transform/00_solved_UFr.in2
-rw-r--r--test/05_transform/00_solved_UFr.out1
-rw-r--r--test/05_transform/01_solved_BLm.in2
-rw-r--r--test/05_transform/01_solved_BLm.out1
-rw-r--r--test/05_transform/transform_tests.c38
5 files changed, 44 insertions, 0 deletions
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 @@
1rotation UF
2UF0 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 @@
1mirrored BL
2UF0 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 @@
1#include <stdbool.h>
2#include <stdint.h>
3#include <stdio.h>
4
5#include "../../src/cube.h"
6#include "../../src/constants.h"
7
8#define STRLENMAX 10000
9
10int main() {
11 char str[STRLENMAX];
12 trans_t t;
13 cube_t cube;
14
15 fgets(str, STRLENMAX, stdin);
16 t = readtrans(str);
17
18 if (t == errortrans) {
19 printf("Error reading trans\n");
20 return 1;
21 }
22
23 fgets(str, STRLENMAX, stdin);
24 cube = readcube(H48, str);
25
26 cube = transform(cube, t);
27
28 if (iserror(cube)) {
29 printf("Error transforming cube\n");
30 } else if (!issolvable(cube)) {
31 printf("Transformed cube is not solvable\n");
32 } else {
33 writecube(H48, cube, str);
34 printf("%s\n", str);
35 }
36
37 return 0;
38}

Generated with cgit - Back to sebastiano.tronto.net