aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-07-14 23:32:22 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-07-14 23:32:22 +0200
commit6c896b0e619f83b0337d20f92b14e26fcd550b42 (patch)
tree9a59f4c2835c6bc1515363977452bf312eaf0fd9 /test
parent61e03f9f4eecf3d5811b11c44c9ef778f0a93bc7 (diff)
downloadnissy-core-6c896b0e619f83b0337d20f92b14e26fcd550b42.tar.gz
nissy-core-6c896b0e619f83b0337d20f92b14e26fcd550b42.zip
Test passes, logic error is due to coordinates admitting multiple ttreps
Diffstat (limited to 'test')
-rw-r--r--test/103_cocsep_ttrep/cocsep_ttrep_tests.c25
1 files changed, 14 insertions, 11 deletions
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 @@
1#include "../test.h" 1#include "../test.h"
2 2
3#define COCSEP_CLASSES 3393 3#define COCSEP_CLASSES 3393
4#define TTREP_MASK (UINT32_C(0xFF) << UINT32_C(8))
5#define TTREP(x) (((x) & TTREP_MASK) >> UINT32_C(8))
4 6
5uint8_t inverse_trans(uint8_t); 7uint8_t inverse_trans(uint8_t);
6cube_t transform_corners(cube_t); 8cube_t transform_corners(cube_t, uint8_t);
7int64_t coord_cocsep(cube_t); 9int64_t coord_cocsep(cube_t);
8size_t gendata_cocsep(void *, uint64_t *, cube_t *); 10size_t gendata_cocsep(void *, uint64_t *, cube_t *);
9 11
10void run(void) { 12void run(void) {
11 uint8_t t, tinv; 13 uint8_t t;
12 uint32_t buf[300000], tt; 14 uint32_t buf[300000], tt;
13 uint64_t selfsim[COCSEP_CLASSES]; 15 uint64_t selfsim[COCSEP_CLASSES];
14 int64_t i, j; 16 int64_t i, j, k, l;
15 cube_t rep[COCSEP_CLASSES], c, d; 17 cube_t rep[COCSEP_CLASSES], c, d;
16 18
17 gendata_cocsep(buf, selfsim, rep); 19 gendata_cocsep(buf, selfsim, rep);
@@ -19,15 +21,16 @@ void run(void) {
19 for (i = 0; i < COCSEP_CLASSES; i++) { 21 for (i = 0; i < COCSEP_CLASSES; i++) {
20 c = rep[i]; 22 c = rep[i];
21 for (t = 0; t < 48; t++) { 23 for (t = 0; t < 48; t++) {
22 tinv = inverse_trans(t); 24 d = transform_corners(c, t);
23 d = transform_corners(c);
24 j = coord_cocsep(d); 25 j = coord_cocsep(d);
25 tt = (buf[j] & (0xFF << 8)) >> 8; 26 tt = TTREP(buf[j]);
26 if (tt != tinv) 27 d = transform_corners(d, tt);
27 printf("cocsep %" PRId64 " <- %" PRId64 ": " 28 k = coord_cocsep(d);
28 "expected t %" PRIu8 " (inverse of %" 29 l = coord_cocsep(c);
29 PRIu8 "), got %" PRIu32 "\n", 30 if (k != l)
30 i, j, tinv, t, tt); 31 printf("cocsep %" PRId64 " (%" PRId64 "): "
32 "%" PRId64 " ttrep %" PRIu8
33 " -> %" PRId64 "\n", i, l, j, tt, k);
31 } 34 }
32 } 35 }
33} 36}

Generated with cgit - Back to sebastiano.tronto.net