From b144ec8b96b5b71e409d2a692eac64b38120c9ba Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 20 May 2024 17:48:47 +0200 Subject: More tests for gendata h48 --- test/102_gendata_h48/01_h_1.in | 1 + test/102_gendata_h48/01_h_1.out | 23 +++++++++++++++++++++++ test/102_gendata_h48/gendata_h48_tests.c | 8 +++----- 3 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 test/102_gendata_h48/01_h_1.in create mode 100644 test/102_gendata_h48/01_h_1.out (limited to 'test') diff --git a/test/102_gendata_h48/01_h_1.in b/test/102_gendata_h48/01_h_1.in new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/test/102_gendata_h48/01_h_1.in @@ -0,0 +1 @@ +1 diff --git a/test/102_gendata_h48/01_h_1.out b/test/102_gendata_h48/01_h_1.out new file mode 100644 index 0000000..56b7066 --- /dev/null +++ b/test/102_gendata_h48/01_h_1.out @@ -0,0 +1,23 @@ +118687270 + +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: 377 +5: 4113 diff --git a/test/102_gendata_h48/gendata_h48_tests.c b/test/102_gendata_h48/gendata_h48_tests.c index 35e6f42..9d96e75 100644 --- a/test/102_gendata_h48/gendata_h48_tests.c +++ b/test/102_gendata_h48/gendata_h48_tests.c @@ -1,23 +1,20 @@ #include "../test.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/4]; size_t gendata_h48(void *, uint8_t, uint8_t); int main(void) { char str[STRLENMAX]; uint8_t h, i; - uint32_t *h48info; + uint32_t *buf, *h48info; size_t result; fgets(str, STRLENMAX, stdin); h = atoi(str); + buf = (uint32_t *)malloc(sizeof(uint32_t) * (60000000 << h)); result = gendata_h48(buf, h, MAXDEPTH); h48info = buf + (ETABLESIZE(h) + COCSEPSIZE) / 4; @@ -33,5 +30,6 @@ int main(void) { for (i = 0; i < MAXDEPTH+1; i++) printf("%" PRIu32 ": %" PRIu32 "\n", i, h48info[i+1]); + free(buf); return 0; } -- cgit v1.3