aboutsummaryrefslogtreecommitdiff
path: root/test/112_gendata_h48
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-07-20 10:05:51 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-07-20 10:05:51 +0200
commit5727f06c5694a4831881322876e3ba4d8ce3b743 (patch)
tree8ec57e5862b05464b54aad3aad6f3d37653066a6 /test/112_gendata_h48
parente20e4f550ae373414d9bc106b1615a5c5896c9c4 (diff)
downloadnissy-core-5727f06c5694a4831881322876e3ba4d8ce3b743.tar.gz
nissy-core-5727f06c5694a4831881322876e3ba4d8ce3b743.zip
Finally fixed selfsim logic
Diffstat (limited to 'test/112_gendata_h48')
-rw-r--r--test/112_gendata_h48/00_h_0.in2
-rw-r--r--test/112_gendata_h48/00_h_0.out23
-rw-r--r--test/112_gendata_h48/gendata_h48_tests.c43
3 files changed, 68 insertions, 0 deletions
diff --git a/test/112_gendata_h48/00_h_0.in b/test/112_gendata_h48/00_h_0.in
new file mode 100644
index 0000000..cb6e5ed
--- /dev/null
+++ b/test/112_gendata_h48/00_h_0.in
@@ -0,0 +1,2 @@
15
20
diff --git a/test/112_gendata_h48/00_h_0.out b/test/112_gendata_h48/00_h_0.out
new file mode 100644
index 0000000..04e8bf6
--- /dev/null
+++ b/test/112_gendata_h48/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/112_gendata_h48/gendata_h48_tests.c b/test/112_gendata_h48/gendata_h48_tests.c
new file mode 100644
index 0000000..485d9d0
--- /dev/null
+++ b/test/112_gendata_h48/gendata_h48_tests.c
@@ -0,0 +1,43 @@
1#include "../test.h"
2
3#define COCSEPSIZE 1119792
4#define ETABLESIZE ((3393 * 495 * 70) >> 1)
5
6int64_t gendata_h48h0k4(void *, uint8_t);
7
8int64_t gendata_h48_fixture(void *buf, uint8_t maxdepth, uint8_t h) {
9 if (h == 0)
10 return gendata_h48h0k4(buf, maxdepth);
11 fprintf(stderr, "Error: gendata h48 for h>0 not implemented yet\n");
12 exit(1);
13}
14
15void run(void) {
16 char str[STRLENMAX];
17 uint8_t i, maxdepth, h;
18 uint32_t *buf, *h48info;
19 size_t result;
20
21 fgets(str, STRLENMAX, stdin);
22 maxdepth = atoi(str);
23 fgets(str, STRLENMAX, stdin);
24 h = atoi(str);
25
26 buf = (uint32_t *)malloc(sizeof(uint32_t) * 60000000);
27 result = gendata_h48_fixture(buf, maxdepth, h);
28 h48info = buf + (ETABLESIZE + COCSEPSIZE) / 4;
29
30 printf("%zu\n\n", result);
31
32 printf("cocsepdata:\n");
33 printf("Classes: %" PRIu32 "\n", buf[COCSEPSIZE/4-12]);
34 printf("Max value: %" PRIu32 "\n", buf[COCSEPSIZE/4-11]);
35 for (i = 0; i < 10; i++)
36 printf("%" PRIu32 ": %" PRIu32 "\n", i, buf[COCSEPSIZE/4-10+i]);
37
38 printf("\nh48:\n");
39 for (i = 0; i < maxdepth+1; i++)
40 printf("%" PRIu32 ": %" PRIu32 "\n", i, h48info[i+1]);
41
42 free(buf);
43}

Generated with cgit - Back to sebastiano.tronto.net