From 67c35b638c04ab7a860aac0c166936e9481633c9 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 15 Jul 2024 09:15:35 +0200 Subject: Added test for selfsim distribution --- test/103_cocsep_selfsim_distribution/00_all.in | 0 test/103_cocsep_selfsim_distribution/00_all.out | 12 +++++++ .../cocsep_selfsim_distribution_tests.c | 41 ++++++++++++++++++++++ test/103_cocsep_ttrep/00_all.in | 0 test/103_cocsep_ttrep/00_all.out | 0 test/103_cocsep_ttrep/cocsep_ttrep_tests.c | 36 ------------------- test/104_cocsep_ttrep/00_all.in | 0 test/104_cocsep_ttrep/00_all.out | 0 test/104_cocsep_ttrep/cocsep_ttrep_tests.c | 36 +++++++++++++++++++ 9 files changed, 89 insertions(+), 36 deletions(-) create mode 100644 test/103_cocsep_selfsim_distribution/00_all.in create mode 100644 test/103_cocsep_selfsim_distribution/00_all.out create mode 100644 test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c delete mode 100644 test/103_cocsep_ttrep/00_all.in delete mode 100644 test/103_cocsep_ttrep/00_all.out delete mode 100644 test/103_cocsep_ttrep/cocsep_ttrep_tests.c create mode 100644 test/104_cocsep_ttrep/00_all.in create mode 100644 test/104_cocsep_ttrep/00_all.out create mode 100644 test/104_cocsep_ttrep/cocsep_ttrep_tests.c diff --git a/test/103_cocsep_selfsim_distribution/00_all.in b/test/103_cocsep_selfsim_distribution/00_all.in new file mode 100644 index 0000000..e69de29 diff --git a/test/103_cocsep_selfsim_distribution/00_all.out b/test/103_cocsep_selfsim_distribution/00_all.out new file mode 100644 index 0000000..94e17a5 --- /dev/null +++ b/test/103_cocsep_selfsim_distribution/00_all.out @@ -0,0 +1,12 @@ +373 self-similar positions out of 3393 +Size number of groups +1 3020 +2 311 +3 8 +4 35 +6 9 +8 6 +12 1 +16 1 +24 1 +48 1 diff --git a/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c b/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c new file mode 100644 index 0000000..fb1338e --- /dev/null +++ b/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c @@ -0,0 +1,41 @@ +#include "../test.h" + +#define COCSEP_CLASSES 3393 + +size_t gendata_cocsep(void *, uint64_t *, cube_t *); +int64_t coord_cocsep(cube_t); + +int bcount(uint64_t x) { + int ret; + uint64_t i; + + for (i = 0, ret = 0; i < 64; i++) + if (x & (UINT64_C(1) << i)) + ret++; + + return ret; +} + +void run(void) { + uint32_t buf[300000]; + int size[65], tot, j; + int64_t i; + uint64_t selfsim[COCSEP_CLASSES], sim; + cube_t rep[COCSEP_CLASSES]; + + memset(size, 0, 65 * sizeof(int)); + gendata_cocsep(buf, selfsim, rep); + + for (i = 0, tot = 0; i < COCSEP_CLASSES; i++) { + sim = selfsim[i]; + if (sim >> 1) + tot++; + size[bcount(sim)]++; + } + + printf("%d self-similar positions out of 3393\n", tot); + printf("Size\tnumber of groups\n"); + for (j = 0; j <= 48; j++) + if (size[j] != 0) + printf("%d\t%d\n", j, size[j]); +} diff --git a/test/103_cocsep_ttrep/00_all.in b/test/103_cocsep_ttrep/00_all.in deleted file mode 100644 index e69de29..0000000 diff --git a/test/103_cocsep_ttrep/00_all.out b/test/103_cocsep_ttrep/00_all.out deleted file mode 100644 index e69de29..0000000 diff --git a/test/103_cocsep_ttrep/cocsep_ttrep_tests.c b/test/103_cocsep_ttrep/cocsep_ttrep_tests.c deleted file mode 100644 index f0da151..0000000 --- a/test/103_cocsep_ttrep/cocsep_ttrep_tests.c +++ /dev/null @@ -1,36 +0,0 @@ -#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, uint8_t); -int64_t coord_cocsep(cube_t); -size_t gendata_cocsep(void *, uint64_t *, cube_t *); - -void run(void) { - uint8_t t; - uint32_t buf[300000], tt; - uint64_t selfsim[COCSEP_CLASSES]; - int64_t i, j, k, l; - cube_t rep[COCSEP_CLASSES], c, d; - - gendata_cocsep(buf, selfsim, rep); - - for (i = 0; i < COCSEP_CLASSES; i++) { - c = rep[i]; - for (t = 0; t < 48; t++) { - d = transform_corners(c, t); - j = coord_cocsep(d); - 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); - } - } -} diff --git a/test/104_cocsep_ttrep/00_all.in b/test/104_cocsep_ttrep/00_all.in new file mode 100644 index 0000000..e69de29 diff --git a/test/104_cocsep_ttrep/00_all.out b/test/104_cocsep_ttrep/00_all.out new file mode 100644 index 0000000..e69de29 diff --git a/test/104_cocsep_ttrep/cocsep_ttrep_tests.c b/test/104_cocsep_ttrep/cocsep_ttrep_tests.c new file mode 100644 index 0000000..f0da151 --- /dev/null +++ b/test/104_cocsep_ttrep/cocsep_ttrep_tests.c @@ -0,0 +1,36 @@ +#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, uint8_t); +int64_t coord_cocsep(cube_t); +size_t gendata_cocsep(void *, uint64_t *, cube_t *); + +void run(void) { + uint8_t t; + uint32_t buf[300000], tt; + uint64_t selfsim[COCSEP_CLASSES]; + int64_t i, j, k, l; + cube_t rep[COCSEP_CLASSES], c, d; + + gendata_cocsep(buf, selfsim, rep); + + for (i = 0; i < COCSEP_CLASSES; i++) { + c = rep[i]; + for (t = 0; t < 48; t++) { + d = transform_corners(c, t); + j = coord_cocsep(d); + 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