aboutsummaryrefslogtreecommitdiff
path: root/test/101_cocsep_selfsim/cocsep_selfsim_tests.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-05-26 22:13:47 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-05-26 22:13:47 +0200
commitfde8dfa9df8df1e3d42a9a8840836e33817cd498 (patch)
treeefa8bdef14f423e3547ae747eb29b3ab9672e755 /test/101_cocsep_selfsim/cocsep_selfsim_tests.c
parent6ec2e7d5413eda0671a20a0069aa8d89d8117c0a (diff)
downloadnissy-core-fde8dfa9df8df1e3d42a9a8840836e33817cd498.tar.gz
nissy-core-fde8dfa9df8df1e3d42a9a8840836e33817cd498.zip
Added tests for selfsim
Diffstat (limited to 'test/101_cocsep_selfsim/cocsep_selfsim_tests.c')
-rw-r--r--test/101_cocsep_selfsim/cocsep_selfsim_tests.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/101_cocsep_selfsim/cocsep_selfsim_tests.c b/test/101_cocsep_selfsim/cocsep_selfsim_tests.c
new file mode 100644
index 0000000..3fc7a60
--- /dev/null
+++ b/test/101_cocsep_selfsim/cocsep_selfsim_tests.c
@@ -0,0 +1,40 @@
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 file need a space before each newline.
7 */
8#include "../test.h"
9
10#define COCSEP_CLASSES 3393U
11
12size_t gendata_cocsep(void *, uint64_t *, cube_fast_t *);
13int64_t coord_fast_cocsep(cube_fast_t);
14
15int main(void) {
16 char str[STRLENMAX];
17 uint32_t buf[300000], data;
18 int64_t coord, coclass;
19 uint64_t selfsim[COCSEP_CLASSES], sim, t;
20 cube_fast_t fast, rep[COCSEP_CLASSES];
21
22 gendata_cocsep(buf, selfsim, rep);
23
24 /* All cases in the same test so we do not generate data many times */
25
26 while (fgets(str, STRLENMAX, stdin) != NULL) {
27 fast = cubetofast(readcube("H48", str));
28 coord = coord_fast_cocsep(fast);
29 data = buf[coord];
30 coclass = (data & (0xFFFU << 16U)) >> 16U;
31 sim = selfsim[coclass];
32 for (t = 0; t < 48 && sim; t++, sim >>= 1ULL) {
33 if (sim & 1ULL)
34 printf("%" PRId64 " ", t);
35 }
36 printf("\n");
37 }
38
39 return 0;
40}

Generated with cgit - Back to sebastiano.tronto.net