aboutsummaryrefslogtreecommitdiff
path: root/test/120_gendata_h48h0k4/gendata_h48h0k4_tests.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-08-27 21:44:19 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-08-27 21:44:19 +0200
commit1983bacfbb84e2a410ebe663ac1fa7c1b22eb096 (patch)
tree106ddc90aa7aa92558415f89a8b39076ab508364 /test/120_gendata_h48h0k4/gendata_h48h0k4_tests.c
parent30526a688c8c8e9ffed34a07e959322f75bc639b (diff)
parentb5efa2c7bfa259f1b9f5afa68349e2742427de80 (diff)
downloadnissy-core-1983bacfbb84e2a410ebe663ac1fa7c1b22eb096.tar.gz
nissy-core-1983bacfbb84e2a410ebe663ac1fa7c1b22eb096.zip
Merge branch 'master' of tronto.net:h48
Diffstat (limited to 'test/120_gendata_h48h0k4/gendata_h48h0k4_tests.c')
-rw-r--r--test/120_gendata_h48h0k4/gendata_h48h0k4_tests.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/120_gendata_h48h0k4/gendata_h48h0k4_tests.c b/test/120_gendata_h48h0k4/gendata_h48h0k4_tests.c
new file mode 100644
index 0000000..d6c6cb2
--- /dev/null
+++ b/test/120_gendata_h48h0k4/gendata_h48h0k4_tests.c
@@ -0,0 +1,50 @@
1#include "../test.h"
2
3#define COCSEP_CLASSES 3393
4#define COCSEPSIZE 1119792
5
6typedef struct {
7 uint8_t h;
8 uint8_t k;
9 uint8_t maxdepth;
10 void *buf;
11 uint32_t *info;
12 uint32_t *cocsepdata;
13 uint32_t *h48data;
14 uint64_t selfsim[COCSEP_CLASSES];
15 cube_t crep[COCSEP_CLASSES];
16} gendata_h48_arg_t;
17
18int64_t gendata_h48(gendata_h48_arg_t *);
19
20void run(void) {
21 char str[STRLENMAX];
22 uint8_t i;
23 gendata_h48_arg_t arg;
24 size_t result, sz;
25
26 fgets(str, STRLENMAX, stdin);
27 arg.maxdepth = atoi(str);
28 fgets(str, STRLENMAX, stdin);
29 arg.h = atoi(str);
30 arg.k = 4;
31
32 sz = gendata_h48(&arg); /* With buf = NULL returns data size */
33 arg.buf = malloc(sz);
34 result = gendata_h48(&arg);
35
36 printf("%zu\n\n", result);
37
38 printf("cocsepdata:\n");
39 printf("Classes: %" PRIu32 "\n", arg.cocsepdata[COCSEPSIZE/4-12]);
40 printf("Max value: %" PRIu32 "\n", arg.cocsepdata[COCSEPSIZE/4-11]);
41 for (i = 0; i < 10; i++)
42 printf("%" PRIu32 ": %" PRIu32 "\n",
43 i, arg.cocsepdata[COCSEPSIZE/4-10+i]);
44
45 printf("\nh48:\n");
46 for (i = 0; i < arg.maxdepth+1; i++)
47 printf("%" PRIu32 ": %" PRIu32 "\n", i, arg.info[i+1]);
48
49 free(arg.buf);
50}

Generated with cgit - Back to sebastiano.tronto.net