diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/103_cocsep_ttrep/cocsep_ttrep_tests.c | 25 |
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 | ||
| 5 | uint8_t inverse_trans(uint8_t); | 7 | uint8_t inverse_trans(uint8_t); |
| 6 | cube_t transform_corners(cube_t); | 8 | cube_t transform_corners(cube_t, uint8_t); |
| 7 | int64_t coord_cocsep(cube_t); | 9 | int64_t coord_cocsep(cube_t); |
| 8 | size_t gendata_cocsep(void *, uint64_t *, cube_t *); | 10 | size_t gendata_cocsep(void *, uint64_t *, cube_t *); |
| 9 | 11 | ||
| 10 | void run(void) { | 12 | void 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 | } |
