diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-07-20 10:05:51 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-07-20 10:05:51 +0200 |
| commit | 5727f06c5694a4831881322876e3ba4d8ce3b743 (patch) | |
| tree | 8ec57e5862b05464b54aad3aad6f3d37653066a6 /test/112_gendata_h48 | |
| parent | e20e4f550ae373414d9bc106b1615a5c5896c9c4 (diff) | |
| download | nissy-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.in | 2 | ||||
| -rw-r--r-- | test/112_gendata_h48/00_h_0.out | 23 | ||||
| -rw-r--r-- | test/112_gendata_h48/gendata_h48_tests.c | 43 |
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 @@ | |||
| 1 | 5 | ||
| 2 | 0 | ||
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 @@ | |||
| 1 | 59903605 | ||
| 2 | |||
| 3 | cocsepdata: | ||
| 4 | Classes: 3393 | ||
| 5 | Max value: 9 | ||
| 6 | 0: 1 | ||
| 7 | 1: 6 | ||
| 8 | 2: 63 | ||
| 9 | 3: 468 | ||
| 10 | 4: 3068 | ||
| 11 | 5: 15438 | ||
| 12 | 6: 53814 | ||
| 13 | 7: 71352 | ||
| 14 | 8: 8784 | ||
| 15 | 9: 96 | ||
| 16 | |||
| 17 | h48: | ||
| 18 | 0: 1 | ||
| 19 | 1: 1 | ||
| 20 | 2: 4 | ||
| 21 | 3: 34 | ||
| 22 | 4: 331 | ||
| 23 | 5: 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 | |||
| 6 | int64_t gendata_h48h0k4(void *, uint8_t); | ||
| 7 | |||
| 8 | int64_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 | |||
| 15 | void 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 | } | ||
