diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/112_gendata_h48/gendata_h48_tests.c | 51 | ||||
| -rw-r--r-- | test/113_gen_h48short/gen_h48short.c | 5 |
2 files changed, 34 insertions, 22 deletions
diff --git a/test/112_gendata_h48/gendata_h48_tests.c b/test/112_gendata_h48/gendata_h48_tests.c index 485d9d0..d6c6cb2 100644 --- a/test/112_gendata_h48/gendata_h48_tests.c +++ b/test/112_gendata_h48/gendata_h48_tests.c | |||
| @@ -1,43 +1,50 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | #define COCSEP_CLASSES 3393 | ||
| 3 | #define COCSEPSIZE 1119792 | 4 | #define COCSEPSIZE 1119792 |
| 4 | #define ETABLESIZE ((3393 * 495 * 70) >> 1) | ||
| 5 | 5 | ||
| 6 | int64_t gendata_h48h0k4(void *, uint8_t); | 6 | typedef 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; | ||
| 7 | 17 | ||
| 8 | int64_t gendata_h48_fixture(void *buf, uint8_t maxdepth, uint8_t h) { | 18 | int64_t gendata_h48(gendata_h48_arg_t *); |
| 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 | 19 | ||
| 15 | void run(void) { | 20 | void run(void) { |
| 16 | char str[STRLENMAX]; | 21 | char str[STRLENMAX]; |
| 17 | uint8_t i, maxdepth, h; | 22 | uint8_t i; |
| 18 | uint32_t *buf, *h48info; | 23 | gendata_h48_arg_t arg; |
| 19 | size_t result; | 24 | size_t result, sz; |
| 20 | 25 | ||
| 21 | fgets(str, STRLENMAX, stdin); | 26 | fgets(str, STRLENMAX, stdin); |
| 22 | maxdepth = atoi(str); | 27 | arg.maxdepth = atoi(str); |
| 23 | fgets(str, STRLENMAX, stdin); | 28 | fgets(str, STRLENMAX, stdin); |
| 24 | h = atoi(str); | 29 | arg.h = atoi(str); |
| 30 | arg.k = 4; | ||
| 25 | 31 | ||
| 26 | buf = (uint32_t *)malloc(sizeof(uint32_t) * 60000000); | 32 | sz = gendata_h48(&arg); /* With buf = NULL returns data size */ |
| 27 | result = gendata_h48_fixture(buf, maxdepth, h); | 33 | arg.buf = malloc(sz); |
| 28 | h48info = buf + (ETABLESIZE + COCSEPSIZE) / 4; | 34 | result = gendata_h48(&arg); |
| 29 | 35 | ||
| 30 | printf("%zu\n\n", result); | 36 | printf("%zu\n\n", result); |
| 31 | 37 | ||
| 32 | printf("cocsepdata:\n"); | 38 | printf("cocsepdata:\n"); |
| 33 | printf("Classes: %" PRIu32 "\n", buf[COCSEPSIZE/4-12]); | 39 | printf("Classes: %" PRIu32 "\n", arg.cocsepdata[COCSEPSIZE/4-12]); |
| 34 | printf("Max value: %" PRIu32 "\n", buf[COCSEPSIZE/4-11]); | 40 | printf("Max value: %" PRIu32 "\n", arg.cocsepdata[COCSEPSIZE/4-11]); |
| 35 | for (i = 0; i < 10; i++) | 41 | for (i = 0; i < 10; i++) |
| 36 | printf("%" PRIu32 ": %" PRIu32 "\n", i, buf[COCSEPSIZE/4-10+i]); | 42 | printf("%" PRIu32 ": %" PRIu32 "\n", |
| 43 | i, arg.cocsepdata[COCSEPSIZE/4-10+i]); | ||
| 37 | 44 | ||
| 38 | printf("\nh48:\n"); | 45 | printf("\nh48:\n"); |
| 39 | for (i = 0; i < maxdepth+1; i++) | 46 | for (i = 0; i < arg.maxdepth+1; i++) |
| 40 | printf("%" PRIu32 ": %" PRIu32 "\n", i, h48info[i+1]); | 47 | printf("%" PRIu32 ": %" PRIu32 "\n", i, arg.info[i+1]); |
| 41 | 48 | ||
| 42 | free(buf); | 49 | free(arg.buf); |
| 43 | } | 50 | } |
diff --git a/test/113_gen_h48short/gen_h48short.c b/test/113_gen_h48short/gen_h48short.c index 92d346a..335821a 100644 --- a/test/113_gen_h48short/gen_h48short.c +++ b/test/113_gen_h48short/gen_h48short.c | |||
| @@ -8,6 +8,11 @@ typedef struct { | |||
| 8 | uint64_t capacity; | 8 | uint64_t capacity; |
| 9 | uint64_t randomizer; | 9 | uint64_t randomizer; |
| 10 | uint64_t *table; | 10 | uint64_t *table; |
| 11 | uint32_t *info; | ||
| 12 | uint32_t *cocsepdata; | ||
| 13 | uint32_t *h48data; | ||
| 14 | uint64_t selfsim[COCSEP_CLASSES]; | ||
| 15 | cube_t crep[COCSEP_CLASSES]; | ||
| 11 | } h48map_t; | 16 | } h48map_t; |
| 12 | 17 | ||
| 13 | typedef struct { | 18 | typedef struct { |
