blob: 1b96fbc24d5c8d12f453acdde454064a69a57fe0 (
plain) (
blame)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
#include "../src/set.c"
#include "../src/testing.h"
static void
test_HASH_OUTPUT_LENGTH() {
test_start("HASH_OUTPUT_LENGTH");
{
testing("Enforce that SipHash's output matches endiannessbs's input");
return; // FIXME
printf("\n");
printf("HASH_OUTPUT_LENGTH: %u\n", HASH_OUTPUT_LENGTH);
printf("ENDIANNESSBS_64BIT_LENGTH: %u\n", ENDIANNESSBS_64BIT_LENGTH);
assert(HASH_OUTPUT_LENGTH == ENDIANNESSBS_64BIT_LENGTH);
test_ok();
}
}
static int
test_set_new(void) {
int rc = -1;
const struct Set *s = NULL;
test_start("set_new()");
{
testing("simple allocation");
const size_t size = sizeof(long long);
if (set_new(size, &s)) {
logerr("set_new()");
goto out;
}
assert(s->value_size == size);
set_free(&s);
test_ok();
}
rc = 0;
out:
if (s != NULL) {
set_free(&s);
}
return rc;
}
static int
test_set_free(void) {
int rc = -1;
const struct Set *s = NULL;
test_start("set_free()");
{
testing("*s becomes NULL again after set_free(&s)");
assert(s == NULL);
if (set_new(1U, &s)) {
logerr("set_new()");
goto out;
}
assert(s != NULL);
set_free(&s);
assert(s == NULL);
test_ok();
}
rc = 0;
out:
if (s != NULL) {
set_free(&s);
}
return rc;
}
static int
test_set_add(void) {
int rc = -1;
// FIXME
rc = 0;
return rc;
}
int
main(void) {
int rc = EXIT_FAILURE;
test_HASH_OUTPUT_LENGTH();
if (test_set_new()) {
logerr("test_set_new()");
goto out;
}
if (test_set_free()) {
logerr("test_set_free()");
goto out;
}
if (test_set_add()) {
logerr("test_set_add()");
goto out;
}
rc = EXIT_SUCCESS;
out:
return rc;
}
|