diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-07-14 21:28:37 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-07-14 21:28:37 +0200 |
| commit | 61e03f9f4eecf3d5811b11c44c9ef778f0a93bc7 (patch) | |
| tree | a7a6edc2e44689ed62472bdece1d9bf6a300419f /test | |
| parent | a016aa7f78c86c59bab3ae4970f8cc339186bc91 (diff) | |
| download | nissy-core-61e03f9f4eecf3d5811b11c44c9ef778f0a93bc7.tar.gz nissy-core-61e03f9f4eecf3d5811b11c44c9ef778f0a93bc7.zip | |
Found a sneaky bug (it's all a mess now)
Diffstat (limited to 'test')
| -rw-r--r-- | test/101_cocsep_transform_invariant/00_solved.in | 1 | ||||
| -rw-r--r-- | test/101_cocsep_transform_invariant/00_solved.out (renamed from test/103_gendata_h48_h0/00_h_0.in) | 0 | ||||
| -rw-r--r-- | test/101_cocsep_transform_invariant/01_U.in | 1 | ||||
| -rw-r--r-- | test/101_cocsep_transform_invariant/01_U.out | 0 | ||||
| -rw-r--r-- | test/101_cocsep_transform_invariant/02_scrambled.in | 1 | ||||
| -rw-r--r-- | test/101_cocsep_transform_invariant/02_scrambled.out | 0 | ||||
| -rw-r--r-- | test/101_cocsep_transform_invariant/cocsep_transform_invariant.c | 33 | ||||
| -rw-r--r-- | test/102_cocsep_selfsim/00_all.in (renamed from test/101_cocsep_selfsim/00_all.in) | 0 | ||||
| -rw-r--r-- | test/102_cocsep_selfsim/00_all.out (renamed from test/101_cocsep_selfsim/00_all.out) | 0 | ||||
| -rw-r--r-- | test/102_cocsep_selfsim/cocsep_selfsim_tests.c (renamed from test/101_cocsep_selfsim/cocsep_selfsim_tests.c) | 2 | ||||
| -rw-r--r-- | test/103_cocsep_ttrep/00_all.in | 0 | ||||
| -rw-r--r-- | test/103_cocsep_ttrep/00_all.out | 0 | ||||
| -rw-r--r-- | test/103_cocsep_ttrep/cocsep_ttrep_tests.c | 33 | ||||
| -rw-r--r-- | test/110_coord_invcoord_h48/00_all.in (renamed from test/102_coord_invcoord_h48/00_all.in) | 0 | ||||
| -rw-r--r-- | test/110_coord_invcoord_h48/00_all.out (renamed from test/102_coord_invcoord_h48/00_all.out) | 0 | ||||
| -rw-r--r-- | test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c (renamed from test/102_coord_invcoord_h48/coord_invcoord_h48_tests.c) | 0 | ||||
| -rw-r--r-- | test/111_gendata_h48_h0/00_h_0.in | 0 | ||||
| -rw-r--r-- | test/111_gendata_h48_h0/00_h_0.out (renamed from test/103_gendata_h48_h0/00_h_0.out) | 0 | ||||
| -rw-r--r-- | test/111_gendata_h48_h0/gendata_h48_tests.c (renamed from test/103_gendata_h48_h0/gendata_h48_tests.c) | 0 | ||||
| -rw-r--r-- | test/112_h48set/00_small.in (renamed from test/104_h48set/00_small.in) | 0 | ||||
| -rw-r--r-- | test/112_h48set/00_small.out (renamed from test/104_h48set/00_small.out) | 0 | ||||
| -rw-r--r-- | test/112_h48set/01_large.in (renamed from test/104_h48set/01_large.in) | 0 | ||||
| -rw-r--r-- | test/112_h48set/01_large.out (renamed from test/104_h48set/01_large.out) | 0 | ||||
| -rw-r--r-- | test/112_h48set/h48set_tests.c (renamed from test/104_h48set/h48set_tests.c) | 0 |
24 files changed, 70 insertions, 1 deletions
diff --git a/test/101_cocsep_transform_invariant/00_solved.in b/test/101_cocsep_transform_invariant/00_solved.in new file mode 100644 index 0000000..dff224d --- /dev/null +++ b/test/101_cocsep_transform_invariant/00_solved.in | |||
| @@ -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/103_gendata_h48_h0/00_h_0.in b/test/101_cocsep_transform_invariant/00_solved.out index e69de29..e69de29 100644 --- a/test/103_gendata_h48_h0/00_h_0.in +++ b/test/101_cocsep_transform_invariant/00_solved.out | |||
diff --git a/test/101_cocsep_transform_invariant/01_U.in b/test/101_cocsep_transform_invariant/01_U.in new file mode 100644 index 0000000..b5b36ad --- /dev/null +++ b/test/101_cocsep_transform_invariant/01_U.in | |||
| @@ -0,0 +1 @@ | |||
| UR0 UL0 DB0 DF0 UB0 UF0 DL0 DR0 FR0 FL0 BL0 BR0 UBR0 UFL0 DFL0 DBR0 UFR0 UBL0 DFR0 DBL0 | |||
diff --git a/test/101_cocsep_transform_invariant/01_U.out b/test/101_cocsep_transform_invariant/01_U.out new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/101_cocsep_transform_invariant/01_U.out | |||
diff --git a/test/101_cocsep_transform_invariant/02_scrambled.in b/test/101_cocsep_transform_invariant/02_scrambled.in new file mode 100644 index 0000000..f6e1f48 --- /dev/null +++ b/test/101_cocsep_transform_invariant/02_scrambled.in | |||
| @@ -0,0 +1 @@ | |||
| DL1 BR0 DR0 UR1 DF0 FL1 BL0 UL0 FR0 UF0 DB1 UB0 UFR0 DBL1 DBR0 UFL1 DFR1 DFL1 UBL2 UBR0 | |||
diff --git a/test/101_cocsep_transform_invariant/02_scrambled.out b/test/101_cocsep_transform_invariant/02_scrambled.out new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/101_cocsep_transform_invariant/02_scrambled.out | |||
diff --git a/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c b/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c new file mode 100644 index 0000000..b0286e5 --- /dev/null +++ b/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | #define COCLASS_MASK (UINT32_C(0xFFFF) << UINT32_C(16)) | ||
| 4 | #define COCLASS(x) (((x) & COCLASS_MASK) >> UINT32_C(16)) | ||
| 5 | |||
| 6 | #define COCSEP_CLASSES 3393 | ||
| 7 | |||
| 8 | size_t gendata_cocsep(void *, uint64_t *, cube_t *); | ||
| 9 | cube_t transform(cube_t, uint8_t); | ||
| 10 | int64_t coord_cocsep(cube_t); | ||
| 11 | |||
| 12 | void run(void) { | ||
| 13 | uint8_t t; | ||
| 14 | uint32_t buf[300000]; | ||
| 15 | uint64_t selfsim[COCSEP_CLASSES]; | ||
| 16 | int64_t coord, tcoord; | ||
| 17 | char str[STRLENMAX]; | ||
| 18 | cube_t cube, transd, rep[COCSEP_CLASSES]; | ||
| 19 | |||
| 20 | fgets(str, STRLENMAX, stdin); | ||
| 21 | cube = readcube("H48", str); | ||
| 22 | |||
| 23 | gendata_cocsep(buf, selfsim, rep); | ||
| 24 | |||
| 25 | coord = (int64_t)COCLASS(buf[coord_cocsep(cube)]); | ||
| 26 | for (t = 0; t < 48; t++) { | ||
| 27 | transd = transform(cube, t); | ||
| 28 | tcoord = (int64_t)COCLASS(buf[coord_cocsep(transd)]); | ||
| 29 | if (coord != tcoord) | ||
| 30 | printf("Error: expected %" PRId64 | ||
| 31 | " but got %" PRId64 "\n", coord, tcoord); | ||
| 32 | } | ||
| 33 | } | ||
diff --git a/test/101_cocsep_selfsim/00_all.in b/test/102_cocsep_selfsim/00_all.in index 07bda04..07bda04 100644 --- a/test/101_cocsep_selfsim/00_all.in +++ b/test/102_cocsep_selfsim/00_all.in | |||
diff --git a/test/101_cocsep_selfsim/00_all.out b/test/102_cocsep_selfsim/00_all.out index cc96363..cc96363 100644 --- a/test/101_cocsep_selfsim/00_all.out +++ b/test/102_cocsep_selfsim/00_all.out | |||
diff --git a/test/101_cocsep_selfsim/cocsep_selfsim_tests.c b/test/102_cocsep_selfsim/cocsep_selfsim_tests.c index 9d9a8b2..7211e2e 100644 --- a/test/101_cocsep_selfsim/cocsep_selfsim_tests.c +++ b/test/102_cocsep_selfsim/cocsep_selfsim_tests.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * and the cube that is one quarter-turn-move off (all such cases are | 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 | 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. | 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. | 6 | * Note that the .out files need a space before each newline. |
| 7 | */ | 7 | */ |
| 8 | #include "../test.h" | 8 | #include "../test.h" |
| 9 | 9 | ||
diff --git a/test/103_cocsep_ttrep/00_all.in b/test/103_cocsep_ttrep/00_all.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/103_cocsep_ttrep/00_all.in | |||
diff --git a/test/103_cocsep_ttrep/00_all.out b/test/103_cocsep_ttrep/00_all.out new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/103_cocsep_ttrep/00_all.out | |||
diff --git a/test/103_cocsep_ttrep/cocsep_ttrep_tests.c b/test/103_cocsep_ttrep/cocsep_ttrep_tests.c new file mode 100644 index 0000000..78f8014 --- /dev/null +++ b/test/103_cocsep_ttrep/cocsep_ttrep_tests.c | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | #define COCSEP_CLASSES 3393 | ||
| 4 | |||
| 5 | uint8_t inverse_trans(uint8_t); | ||
| 6 | cube_t transform_corners(cube_t); | ||
| 7 | int64_t coord_cocsep(cube_t); | ||
| 8 | size_t gendata_cocsep(void *, uint64_t *, cube_t *); | ||
| 9 | |||
| 10 | void run(void) { | ||
| 11 | uint8_t t, tinv; | ||
| 12 | uint32_t buf[300000], tt; | ||
| 13 | uint64_t selfsim[COCSEP_CLASSES]; | ||
| 14 | int64_t i, j; | ||
| 15 | cube_t rep[COCSEP_CLASSES], c, d; | ||
| 16 | |||
| 17 | gendata_cocsep(buf, selfsim, rep); | ||
| 18 | |||
| 19 | for (i = 0; i < COCSEP_CLASSES; i++) { | ||
| 20 | c = rep[i]; | ||
| 21 | for (t = 0; t < 48; t++) { | ||
| 22 | tinv = inverse_trans(t); | ||
| 23 | d = transform_corners(c); | ||
| 24 | j = coord_cocsep(d); | ||
| 25 | tt = (buf[j] & (0xFF << 8)) >> 8; | ||
| 26 | if (tt != tinv) | ||
| 27 | printf("cocsep %" PRId64 " <- %" PRId64 ": " | ||
| 28 | "expected t %" PRIu8 " (inverse of %" | ||
| 29 | PRIu8 "), got %" PRIu32 "\n", | ||
| 30 | i, j, tinv, t, tt); | ||
| 31 | } | ||
| 32 | } | ||
| 33 | } | ||
diff --git a/test/102_coord_invcoord_h48/00_all.in b/test/110_coord_invcoord_h48/00_all.in index a2f9540..a2f9540 100644 --- a/test/102_coord_invcoord_h48/00_all.in +++ b/test/110_coord_invcoord_h48/00_all.in | |||
diff --git a/test/102_coord_invcoord_h48/00_all.out b/test/110_coord_invcoord_h48/00_all.out index e84be4b..e84be4b 100644 --- a/test/102_coord_invcoord_h48/00_all.out +++ b/test/110_coord_invcoord_h48/00_all.out | |||
diff --git a/test/102_coord_invcoord_h48/coord_invcoord_h48_tests.c b/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c index 77dea81..77dea81 100644 --- a/test/102_coord_invcoord_h48/coord_invcoord_h48_tests.c +++ b/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c | |||
diff --git a/test/111_gendata_h48_h0/00_h_0.in b/test/111_gendata_h48_h0/00_h_0.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/111_gendata_h48_h0/00_h_0.in | |||
diff --git a/test/103_gendata_h48_h0/00_h_0.out b/test/111_gendata_h48_h0/00_h_0.out index cc5cf9b..cc5cf9b 100644 --- a/test/103_gendata_h48_h0/00_h_0.out +++ b/test/111_gendata_h48_h0/00_h_0.out | |||
diff --git a/test/103_gendata_h48_h0/gendata_h48_tests.c b/test/111_gendata_h48_h0/gendata_h48_tests.c index e9de3c0..e9de3c0 100644 --- a/test/103_gendata_h48_h0/gendata_h48_tests.c +++ b/test/111_gendata_h48_h0/gendata_h48_tests.c | |||
diff --git a/test/104_h48set/00_small.in b/test/112_h48set/00_small.in index d788d5b..d788d5b 100644 --- a/test/104_h48set/00_small.in +++ b/test/112_h48set/00_small.in | |||
diff --git a/test/104_h48set/00_small.out b/test/112_h48set/00_small.out index 29c08e5..29c08e5 100644 --- a/test/104_h48set/00_small.out +++ b/test/112_h48set/00_small.out | |||
diff --git a/test/104_h48set/01_large.in b/test/112_h48set/01_large.in index a70ef9a..a70ef9a 100644 --- a/test/104_h48set/01_large.in +++ b/test/112_h48set/01_large.in | |||
diff --git a/test/104_h48set/01_large.out b/test/112_h48set/01_large.out index 6632336..6632336 100644 --- a/test/104_h48set/01_large.out +++ b/test/112_h48set/01_large.out | |||
diff --git a/test/104_h48set/h48set_tests.c b/test/112_h48set/h48set_tests.c index d9310a9..d9310a9 100644 --- a/test/104_h48set/h48set_tests.c +++ b/test/112_h48set/h48set_tests.c | |||
