From fde8dfa9df8df1e3d42a9a8840836e33817cd498 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 26 May 2024 22:13:47 +0200 Subject: Added tests for selfsim --- test/101_cocsep_selfsim/cocsep_selfsim_tests.c | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 test/101_cocsep_selfsim/cocsep_selfsim_tests.c (limited to 'test/101_cocsep_selfsim/cocsep_selfsim_tests.c') 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 @@ +/* + * This test is tricky, we only have two cases for now: the solved cube + * and the cube that is one quarter-turn-move off (all such cases are + * equivalent due to symmetry). Adding more tests requires figuring out + * by hand which one is the first position in its class to be reached. + * Note that the .out file need a space before each newline. + */ +#include "../test.h" + +#define COCSEP_CLASSES 3393U + +size_t gendata_cocsep(void *, uint64_t *, cube_fast_t *); +int64_t coord_fast_cocsep(cube_fast_t); + +int main(void) { + char str[STRLENMAX]; + uint32_t buf[300000], data; + int64_t coord, coclass; + uint64_t selfsim[COCSEP_CLASSES], sim, t; + cube_fast_t fast, rep[COCSEP_CLASSES]; + + gendata_cocsep(buf, selfsim, rep); + + /* All cases in the same test so we do not generate data many times */ + + while (fgets(str, STRLENMAX, stdin) != NULL) { + fast = cubetofast(readcube("H48", str)); + coord = coord_fast_cocsep(fast); + data = buf[coord]; + coclass = (data & (0xFFFU << 16U)) >> 16U; + sim = selfsim[coclass]; + for (t = 0; t < 48 && sim; t++, sim >>= 1ULL) { + if (sim & 1ULL) + printf("%" PRId64 " ", t); + } + printf("\n"); + } + + return 0; +} -- cgit v1.3