From 5727f06c5694a4831881322876e3ba4d8ce3b743 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sat, 20 Jul 2024 10:05:51 +0200 Subject: Finally fixed selfsim logic --- test/112_gendata_h48/00_h_0.in | 2 ++ test/112_gendata_h48/00_h_0.out | 23 +++++++++++++++++ test/112_gendata_h48/gendata_h48_tests.c | 43 ++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 test/112_gendata_h48/00_h_0.in create mode 100644 test/112_gendata_h48/00_h_0.out create mode 100644 test/112_gendata_h48/gendata_h48_tests.c (limited to 'test/112_gendata_h48') diff --git a/test/112_gendata_h48/00_h_0.in b/test/112_gendata_h48/00_h_0.in new file mode 100644 index 0000000..cb6e5ed --- /dev/null +++ b/test/112_gendata_h48/00_h_0.in @@ -0,0 +1,2 @@ +5 +0 diff --git a/test/112_gendata_h48/00_h_0.out b/test/112_gendata_h48/00_h_0.out new file mode 100644 index 0000000..04e8bf6 --- /dev/null +++ b/test/112_gendata_h48/00_h_0.out @@ -0,0 +1,23 @@ +59903605 + +cocsepdata: +Classes: 3393 +Max value: 9 +0: 1 +1: 6 +2: 63 +3: 468 +4: 3068 +5: 15438 +6: 53814 +7: 71352 +8: 8784 +9: 96 + +h48: +0: 1 +1: 1 +2: 4 +3: 34 +4: 331 +5: 3612 diff --git a/test/112_gendata_h48/gendata_h48_tests.c b/test/112_gendata_h48/gendata_h48_tests.c new file mode 100644 index 0000000..485d9d0 --- /dev/null +++ b/test/112_gendata_h48/gendata_h48_tests.c @@ -0,0 +1,43 @@ +#include "../test.h" + +#define COCSEPSIZE 1119792 +#define ETABLESIZE ((3393 * 495 * 70) >> 1) + +int64_t gendata_h48h0k4(void *, uint8_t); + +int64_t gendata_h48_fixture(void *buf, uint8_t maxdepth, uint8_t h) { + if (h == 0) + return gendata_h48h0k4(buf, maxdepth); + fprintf(stderr, "Error: gendata h48 for h>0 not implemented yet\n"); + exit(1); +} + +void run(void) { + char str[STRLENMAX]; + uint8_t i, maxdepth, h; + uint32_t *buf, *h48info; + size_t result; + + fgets(str, STRLENMAX, stdin); + maxdepth = atoi(str); + fgets(str, STRLENMAX, stdin); + h = atoi(str); + + buf = (uint32_t *)malloc(sizeof(uint32_t) * 60000000); + result = gendata_h48_fixture(buf, maxdepth, h); + h48info = buf + (ETABLESIZE + COCSEPSIZE) / 4; + + printf("%zu\n\n", result); + + printf("cocsepdata:\n"); + printf("Classes: %" PRIu32 "\n", buf[COCSEPSIZE/4-12]); + printf("Max value: %" PRIu32 "\n", buf[COCSEPSIZE/4-11]); + for (i = 0; i < 10; i++) + printf("%" PRIu32 ": %" PRIu32 "\n", i, buf[COCSEPSIZE/4-10+i]); + + printf("\nh48:\n"); + for (i = 0; i < maxdepth+1; i++) + printf("%" PRIu32 ": %" PRIu32 "\n", i, h48info[i+1]); + + free(buf); +} -- cgit v1.3