aboutsummaryrefslogtreecommitdiff
path: root/test/112_cocsep_selfsim
diff options
context:
space:
mode:
Diffstat (limited to 'test/112_cocsep_selfsim')
-rw-r--r--test/112_cocsep_selfsim/00_all.in2
-rw-r--r--test/112_cocsep_selfsim/00_all.out2
-rw-r--r--test/112_cocsep_selfsim/cocsep_selfsim_tests.c39
3 files changed, 43 insertions, 0 deletions
diff --git a/test/112_cocsep_selfsim/00_all.in b/test/112_cocsep_selfsim/00_all.in
new file mode 100644
index 0000000..5d0021c
--- /dev/null
+++ b/test/112_cocsep_selfsim/00_all.in
@@ -0,0 +1,2 @@
1ABCDEFGH=ABCDEFGHIJKL=A
2WBCVEILH=ABCDIFGLHJKE=A
diff --git a/test/112_cocsep_selfsim/00_all.out b/test/112_cocsep_selfsim/00_all.out
new file mode 100644
index 0000000..cc96363
--- /dev/null
+++ b/test/112_cocsep_selfsim/00_all.out
@@ -0,0 +1,2 @@
10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
20 1 2 3 24 25 26 27
diff --git a/test/112_cocsep_selfsim/cocsep_selfsim_tests.c b/test/112_cocsep_selfsim/cocsep_selfsim_tests.c
new file mode 100644
index 0000000..1a1c6f2
--- /dev/null
+++ b/test/112_cocsep_selfsim/cocsep_selfsim_tests.c
@@ -0,0 +1,39 @@
1/*
2 * This test is tricky, we only have two cases for now: the solved cube
3 * and the cube that is one quarter-turn-move off (all such cases are
4 * equivalent due to symmetry). Adding more tests requires figuring out
5 * by hand which one is the first position in its class to be reached.
6 * Note that the .out files need a space before each newline.
7 */
8#include "../test.h"
9
10size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *);
11int64_t coord_cocsep(cube_t);
12
13void run(void) {
14 char str[STRLENMAX];
15 unsigned char buf[2000000];
16 uint32_t *cocsepdata, data;
17 int64_t coord, coclass;
18 uint64_t selfsim[COCSEP_CLASSES], sim, t;
19 oriented_cube_t cube;
20 cube_t rep[COCSEP_CLASSES];
21
22 gendata_cocsep(buf, selfsim, rep);
23 cocsepdata = (uint32_t *)(buf + INFOSIZE);
24
25 /* All cases in the same test so we do not generate data many times */
26
27 while (fgets(str, STRLENMAX, stdin) != NULL) {
28 cube = readcube(str);
29 coord = coord_cocsep(cube.cube);
30 data = cocsepdata[coord];
31 coclass = (data & (0xFFFU << 16)) >> 16;
32 sim = selfsim[coclass];
33 for (t = 0; t < 48 && sim; t++, sim >>= 1) {
34 if (sim & 1)
35 printf("%" PRId64 " ", t);
36 }
37 printf("\n");
38 }
39}

Generated with cgit - Back to sebastiano.tronto.net