diff options
Diffstat (limited to 'src/hello/test_hello.c')
-rw-r--r-- | src/hello/test_hello.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/hello/test_hello.c b/src/hello/test_hello.c index b6a9dc681..c9bf96791 100644 --- a/src/hello/test_hello.c +++ b/src/hello/test_hello.c | |||
@@ -41,19 +41,18 @@ my_addr_gen (void *cls, size_t max, void *buf) | |||
41 | #endif | 41 | #endif |
42 | if (0 == *i) | 42 | if (0 == *i) |
43 | return 0; | 43 | return 0; |
44 | ret = GNUNET_HELLO_add_address ("test", | 44 | ret = |
45 | GNUNET_TIME_absolute_get (), | 45 | GNUNET_HELLO_add_address ("test", GNUNET_TIME_absolute_get (), |
46 | "address_information", *i, buf, max); | 46 | "address_information", *i, buf, max); |
47 | (*i)--; | 47 | (*i)--; |
48 | return ret; | 48 | return ret; |
49 | } | 49 | } |
50 | 50 | ||
51 | 51 | ||
52 | static int | 52 | static int |
53 | check_addr (void *cls, | 53 | check_addr (void *cls, const char *tname, |
54 | const char *tname, | 54 | struct GNUNET_TIME_Absolute expiration, const void *addr, |
55 | struct GNUNET_TIME_Absolute expiration, | 55 | uint16_t addrlen) |
56 | const void *addr, uint16_t addrlen) | ||
57 | { | 56 | { |
58 | unsigned int *i = cls; | 57 | unsigned int *i = cls; |
59 | 58 | ||
@@ -71,10 +70,9 @@ check_addr (void *cls, | |||
71 | 70 | ||
72 | 71 | ||
73 | static int | 72 | static int |
74 | remove_some (void *cls, | 73 | remove_some (void *cls, const char *tname, |
75 | const char *tname, | 74 | struct GNUNET_TIME_Absolute expiration, const void *addr, |
76 | struct GNUNET_TIME_Absolute expiration, | 75 | uint16_t addrlen) |
77 | const void *addr, uint16_t addrlen) | ||
78 | { | 76 | { |
79 | unsigned int *i = cls; | 77 | unsigned int *i = cls; |
80 | 78 | ||
@@ -118,8 +116,8 @@ main (int argc, char *argv[]) | |||
118 | fprintf (stderr, "Testing address iteration (empty set)...\n"); | 116 | fprintf (stderr, "Testing address iteration (empty set)...\n"); |
119 | #endif | 117 | #endif |
120 | GNUNET_assert (NULL == | 118 | GNUNET_assert (NULL == |
121 | GNUNET_HELLO_iterate_addresses (msg1, | 119 | GNUNET_HELLO_iterate_addresses (msg1, GNUNET_NO, &check_addr, |
122 | GNUNET_NO, &check_addr, &i)); | 120 | &i)); |
123 | 121 | ||
124 | #if VERBOSE | 122 | #if VERBOSE |
125 | fprintf (stderr, "Testing HELLO creation (with one address)...\n"); | 123 | fprintf (stderr, "Testing HELLO creation (with one address)...\n"); |
@@ -134,8 +132,8 @@ main (int argc, char *argv[]) | |||
134 | #endif | 132 | #endif |
135 | i = 1; | 133 | i = 1; |
136 | GNUNET_assert (NULL == | 134 | GNUNET_assert (NULL == |
137 | GNUNET_HELLO_iterate_addresses (msg2, | 135 | GNUNET_HELLO_iterate_addresses (msg2, GNUNET_NO, &check_addr, |
138 | GNUNET_NO, &check_addr, &i)); | 136 | &i)); |
139 | GNUNET_assert (i == 0); | 137 | GNUNET_assert (i == 0); |
140 | 138 | ||
141 | #if VERBOSE | 139 | #if VERBOSE |
@@ -158,8 +156,8 @@ main (int argc, char *argv[]) | |||
158 | #endif | 156 | #endif |
159 | i = 3; | 157 | i = 3; |
160 | GNUNET_assert (NULL == | 158 | GNUNET_assert (NULL == |
161 | GNUNET_HELLO_iterate_addresses (msg3, | 159 | GNUNET_HELLO_iterate_addresses (msg3, GNUNET_NO, &check_addr, |
162 | GNUNET_NO, &check_addr, &i)); | 160 | &i)); |
163 | GNUNET_assert (i == 0); | 161 | GNUNET_assert (i == 0); |
164 | 162 | ||
165 | #if VERBOSE | 163 | #if VERBOSE |
@@ -170,8 +168,8 @@ main (int argc, char *argv[]) | |||
170 | 168 | ||
171 | i = 3; | 169 | i = 3; |
172 | GNUNET_assert (NULL == | 170 | GNUNET_assert (NULL == |
173 | GNUNET_HELLO_iterate_addresses (msg1, | 171 | GNUNET_HELLO_iterate_addresses (msg1, GNUNET_NO, &check_addr, |
174 | GNUNET_NO, &check_addr, &i)); | 172 | &i)); |
175 | GNUNET_assert (i == 0); | 173 | GNUNET_assert (i == 0); |
176 | GNUNET_free (msg1); | 174 | GNUNET_free (msg1); |
177 | 175 | ||
@@ -184,8 +182,8 @@ main (int argc, char *argv[]) | |||
184 | GNUNET_assert (i == 0); | 182 | GNUNET_assert (i == 0); |
185 | i = 1; | 183 | i = 1; |
186 | GNUNET_assert (NULL == | 184 | GNUNET_assert (NULL == |
187 | GNUNET_HELLO_iterate_addresses (msg1, | 185 | GNUNET_HELLO_iterate_addresses (msg1, GNUNET_NO, &check_addr, |
188 | GNUNET_NO, &check_addr, &i)); | 186 | &i)); |
189 | GNUNET_assert (i == 0); | 187 | GNUNET_assert (i == 0); |
190 | GNUNET_free (msg1); | 188 | GNUNET_free (msg1); |
191 | 189 | ||
@@ -193,8 +191,8 @@ main (int argc, char *argv[]) | |||
193 | fprintf (stderr, "Testing delta address iteration...\n"); | 191 | fprintf (stderr, "Testing delta address iteration...\n"); |
194 | #endif | 192 | #endif |
195 | i = 2; | 193 | i = 2; |
196 | GNUNET_HELLO_iterate_new_addresses (msg3, | 194 | GNUNET_HELLO_iterate_new_addresses (msg3, msg2, startup_time, &check_addr, |
197 | msg2, startup_time, &check_addr, &i); | 195 | &i); |
198 | GNUNET_assert (i == 0); | 196 | GNUNET_assert (i == 0); |
199 | GNUNET_free (msg2); | 197 | GNUNET_free (msg2); |
200 | GNUNET_free (msg3); | 198 | GNUNET_free (msg3); |