aboutsummaryrefslogtreecommitdiff
path: root/test/112_gendata_h48/gendata_h48_tests.c
blob: d6c6cb212801f81fd6743acdf93d65e3065c13ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "../test.h"

#define COCSEP_CLASSES 3393
#define COCSEPSIZE 1119792

typedef struct {
	uint8_t h;
	uint8_t k;
	uint8_t maxdepth;
	void *buf;
	uint32_t *info;
	uint32_t *cocsepdata;
	uint32_t *h48data;
	uint64_t selfsim[COCSEP_CLASSES];
	cube_t crep[COCSEP_CLASSES];
} gendata_h48_arg_t;

int64_t gendata_h48(gendata_h48_arg_t *);

void run(void) {
	char str[STRLENMAX];
	uint8_t i;
	gendata_h48_arg_t arg;
	size_t result, sz;

	fgets(str, STRLENMAX, stdin);
	arg.maxdepth = atoi(str);
	fgets(str, STRLENMAX, stdin);
	arg.h = atoi(str);
	arg.k = 4;

	sz = gendata_h48(&arg); /* With buf = NULL returns data size */
	arg.buf = malloc(sz);
	result = gendata_h48(&arg);

	printf("%zu\n\n", result);

	printf("cocsepdata:\n");
	printf("Classes: %" PRIu32 "\n", arg.cocsepdata[COCSEPSIZE/4-12]);
	printf("Max value: %" PRIu32 "\n", arg.cocsepdata[COCSEPSIZE/4-11]);
	for (i = 0; i < 10; i++)
		printf("%" PRIu32 ": %" PRIu32 "\n",
		    i, arg.cocsepdata[COCSEPSIZE/4-10+i]);

	printf("\nh48:\n");
	for (i = 0; i < arg.maxdepth+1; i++)
		printf("%" PRIu32 ": %" PRIu32 "\n", i, arg.info[i+1]);

	free(arg.buf);
}

Generated with cgit - Back to sebastiano.tronto.net