From 6c896b0e619f83b0337d20f92b14e26fcd550b42 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 14 Jul 2024 23:32:22 +0200 Subject: Test passes, logic error is due to coordinates admitting multiple ttreps --- test/103_cocsep_ttrep/cocsep_ttrep_tests.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/103_cocsep_ttrep/cocsep_ttrep_tests.c b/test/103_cocsep_ttrep/cocsep_ttrep_tests.c index 78f8014..f0da151 100644 --- a/test/103_cocsep_ttrep/cocsep_ttrep_tests.c +++ b/test/103_cocsep_ttrep/cocsep_ttrep_tests.c @@ -1,17 +1,19 @@ #include "../test.h" #define COCSEP_CLASSES 3393 +#define TTREP_MASK (UINT32_C(0xFF) << UINT32_C(8)) +#define TTREP(x) (((x) & TTREP_MASK) >> UINT32_C(8)) uint8_t inverse_trans(uint8_t); -cube_t transform_corners(cube_t); +cube_t transform_corners(cube_t, uint8_t); int64_t coord_cocsep(cube_t); size_t gendata_cocsep(void *, uint64_t *, cube_t *); void run(void) { - uint8_t t, tinv; + uint8_t t; uint32_t buf[300000], tt; uint64_t selfsim[COCSEP_CLASSES]; - int64_t i, j; + int64_t i, j, k, l; cube_t rep[COCSEP_CLASSES], c, d; gendata_cocsep(buf, selfsim, rep); @@ -19,15 +21,16 @@ void run(void) { for (i = 0; i < COCSEP_CLASSES; i++) { c = rep[i]; for (t = 0; t < 48; t++) { - tinv = inverse_trans(t); - d = transform_corners(c); + d = transform_corners(c, t); j = coord_cocsep(d); - tt = (buf[j] & (0xFF << 8)) >> 8; - if (tt != tinv) - printf("cocsep %" PRId64 " <- %" PRId64 ": " - "expected t %" PRIu8 " (inverse of %" - PRIu8 "), got %" PRIu32 "\n", - i, j, tinv, t, tt); + tt = TTREP(buf[j]); + d = transform_corners(d, tt); + k = coord_cocsep(d); + l = coord_cocsep(c); + if (k != l) + printf("cocsep %" PRId64 " (%" PRId64 "): " + "%" PRId64 " ttrep %" PRIu8 + " -> %" PRId64 "\n", i, l, j, tt, k); } } } -- cgit v1.3