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/gendata_h48_tests.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'test/102_gendata_h48/gendata_h48_tests.c') 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