aboutsummaryrefslogtreecommitdiff
path: root/test/120_gendata_h48h0k4
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
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')
-rw-r--r--test/120_gendata_h48h0k4/00_h_0.in2
-rw-r--r--test/120_gendata_h48h0k4/00_h_0.out23
-rw-r--r--test/120_gendata_h48h0k4/gendata_h48h0k4_tests.c50
3 files changed, 75 insertions, 0 deletions
diff --git a/test/120_gendata_h48h0k4/00_h_0.in b/test/120_gendata_h48h0k4/00_h_0.in
new file mode 100644
index 0000000..cb6e5ed
--- /dev/null
+++ b/test/120_gendata_h48h0k4/00_h_0.in
@@ -0,0 +1,2 @@
15
20
diff --git a/test/120_gendata_h48h0k4/00_h_0.out b/test/120_gendata_h48h0k4/00_h_0.out
new file mode 100644
index 0000000..04e8bf6
--- /dev/null
+++ b/test/120_gendata_h48h0k4/00_h_0.out
@@ -0,0 +1,23 @@
159903605
2
3cocsepdata:
4Classes: 3393
5Max value: 9
60: 1
71: 6
82: 63
93: 468
104: 3068
115: 15438
126: 53814
137: 71352
148: 8784
159: 96
16
17h48:
180: 1
191: 1
202: 4
213: 34
224: 331
235: 3612
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