From 8bacac732dcb2c0118e47e1bb81be855f4a0bf58 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 20 May 2024 17:39:07 +0200 Subject: Tests for gendata h48 --- test/102_gendata_h48/00_all.in | 0 test/102_gendata_h48/00_all.out | 1 - test/102_gendata_h48/00_h_0.in | 1 + test/102_gendata_h48/00_h_0.out | 23 +++++++++++++++++++++++ test/102_gendata_h48/gendata_h48_tests.c | 31 +++++++++++++++++++++++++------ 5 files changed, 49 insertions(+), 7 deletions(-) delete mode 100644 test/102_gendata_h48/00_all.in delete mode 100644 test/102_gendata_h48/00_all.out create mode 100644 test/102_gendata_h48/00_h_0.in create mode 100644 test/102_gendata_h48/00_h_0.out (limited to 'test') diff --git a/test/102_gendata_h48/00_all.in b/test/102_gendata_h48/00_all.in deleted file mode 100644 index e69de29..0000000 diff --git a/test/102_gendata_h48/00_all.out b/test/102_gendata_h48/00_all.out deleted file mode 100644 index deba01f..0000000 --- a/test/102_gendata_h48/00_all.out +++ /dev/null @@ -1 +0,0 @@ -something diff --git a/test/102_gendata_h48/00_h_0.in b/test/102_gendata_h48/00_h_0.in new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/102_gendata_h48/00_h_0.in @@ -0,0 +1 @@ +0 diff --git a/test/102_gendata_h48/00_h_0.out b/test/102_gendata_h48/00_h_0.out new file mode 100644 index 0000000..8c629f8 --- /dev/null +++ b/test/102_gendata_h48/00_h_0.out @@ -0,0 +1,23 @@ +59903545 + +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: 3608 diff --git a/test/102_gendata_h48/gendata_h48_tests.c b/test/102_gendata_h48/gendata_h48_tests.c index f918e4d..35e6f42 100644 --- a/test/102_gendata_h48/gendata_h48_tests.c +++ b/test/102_gendata_h48/gendata_h48_tests.c @@ -1,18 +1,37 @@ #include "../test.h" -#define H 0 -#define SIZE (120000000 << (H)) +#define MAXH 1 +#define MAXDEPTH 5 +#define COCSEPSIZE 1119792 +#define ETABLESIZE(h) (((3393 * 495 * 70) >> 1) << (h)) +#define SIZE (60000000 << MAXH) -uint32_t buf[SIZE]; +uint32_t buf[SIZE/4]; -size_t gendata_h48(void *, uint8_t); +size_t gendata_h48(void *, uint8_t, uint8_t); int main(void) { + char str[STRLENMAX]; + uint8_t h, i; + uint32_t *h48info; size_t result; - result = gendata_h48(buf, H); + fgets(str, STRLENMAX, stdin); + h = atoi(str); + result = gendata_h48(buf, h, MAXDEPTH); + h48info = buf + (ETABLESIZE(h) + COCSEPSIZE) / 4; - printf("nothing\n"); + 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]); return 0; } -- cgit v1.3