aboutsummaryrefslogtreecommitdiff
path: root/test/090_tables_readwrite
diff options
context:
space:
mode:
Diffstat (limited to 'test/090_tables_readwrite')
-rw-r--r--test/090_tables_readwrite/00_table.in35
-rw-r--r--test/090_tables_readwrite/00_table.out35
-rw-r--r--test/090_tables_readwrite/tables_readwrite_tests.c76
3 files changed, 0 insertions, 146 deletions
diff --git a/test/090_tables_readwrite/00_table.in b/test/090_tables_readwrite/00_table.in
deleted file mode 100644
index 3c2da46..0000000
--- a/test/090_tables_readwrite/00_table.in
+++ /dev/null
@@ -1,35 +0,0 @@
1Test solver
2
30
4512
5512
612345678912345
7399999999998
83393
911
102
110
1220
13100000000512
14
15100
16101
17102
18103
19104
20105
21106
22107
23108
24109
25110
26111
27112
28113
29114
30115
31116
32117
33118
34119
35120
diff --git a/test/090_tables_readwrite/00_table.out b/test/090_tables_readwrite/00_table.out
deleted file mode 100644
index 3c2da46..0000000
--- a/test/090_tables_readwrite/00_table.out
+++ /dev/null
@@ -1,35 +0,0 @@
1Test solver
2
30
4512
5512
612345678912345
7399999999998
83393
911
102
110
1220
13100000000512
14
15100
16101
17102
18103
19104
20105
21106
22107
23108
24109
25110
26111
27112
28113
29114
30115
31116
32117
33118
34119
35120
diff --git a/test/090_tables_readwrite/tables_readwrite_tests.c b/test/090_tables_readwrite/tables_readwrite_tests.c
deleted file mode 100644
index 96a60bb..0000000
--- a/test/090_tables_readwrite/tables_readwrite_tests.c
+++ /dev/null
@@ -1,76 +0,0 @@
1#include "../test.h"
2
3int64_t readtableinfo(size_t, const unsigned char *, tableinfo_t *);
4int64_t writetableinfo(const tableinfo_t *, size_t, unsigned char *);
5
6uint64_t readn(void) {
7 char str[STRLENMAX];
8
9 fgets(str, STRLENMAX, stdin);
10 return atoll(str);
11}
12
13tableinfo_t test_readinfo(void) {
14 int i;
15 tableinfo_t ret;
16 char emptyline[2];
17
18 fgets(ret.solver, INFO_SOLVER_STRLEN, stdin);
19 for (i = 0; i < INFO_SOLVER_STRLEN; i++)
20 if (ret.solver[i] == '\n')
21 ret.solver[i] = 0;
22
23 fgets(emptyline, 2, stdin);
24
25 ret.type = readn();
26 ret.infosize = readn();
27 ret.fullsize = readn();
28 ret.hash = readn();
29 ret.entries = readn();
30 ret.classes = readn();
31 ret.h48h = (uint8_t)readn();
32 ret.bits = (uint8_t)readn();
33 ret.base = (uint8_t)readn();
34 ret.maxvalue = (uint8_t)readn();
35 ret.next = readn();
36
37 fgets(emptyline, 2, stdin);
38
39 for (i = 0; i < INFO_DISTRIBUTION_LEN; i++)
40 ret.distribution[i] = readn();
41
42 return ret;
43}
44
45void test_writeinfo(tableinfo_t info) {
46 int i;
47
48 printf("%s\n", info.solver);
49 printf("\n");
50
51 printf("%" PRIu64 "\n", info.type);
52 printf("%" PRIu64 "\n", info.infosize);
53 printf("%" PRIu64 "\n", info.fullsize);
54 printf("%" PRIu64 "\n", info.hash);
55 printf("%" PRIu64 "\n", info.entries);
56 printf("%" PRIu64 "\n", info.classes);
57 printf("%" PRIu8 "\n", info.h48h);
58 printf("%" PRIu8 "\n", info.bits);
59 printf("%" PRIu8 "\n", info.base);
60 printf("%" PRIu8 "\n", info.maxvalue);
61 printf("%" PRIu64 "\n", info.next);
62 printf("\n");
63
64 for (i = 0; i < INFO_DISTRIBUTION_LEN; i++)
65 printf("%" PRIu64 "\n", info.distribution[i]);
66}
67
68void run(void) {
69 unsigned char buf[INFOSIZE];
70 tableinfo_t expected, actual;
71
72 expected = test_readinfo();
73 writetableinfo(&expected, INFOSIZE, buf);
74 readtableinfo(INFOSIZE, buf, &actual);
75 test_writeinfo(actual);
76}

Generated with cgit - Back to sebastiano.tronto.net