aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/test_mesh_path_api.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-09-21 20:42:20 +0000
committerBart Polot <bart@net.in.tum.de>2011-09-21 20:42:20 +0000
commite73416feea2be995456c62f74b33e714501cdb33 (patch)
treee42d8b3cfef656ff3f21ac5be33406142f1f2499 /src/mesh/test_mesh_path_api.c
parent1b4c0a8b0c8cfc6e36197c37ca0cbaaeb5eb7927 (diff)
downloadgnunet-e73416feea2be995456c62f74b33e714501cdb33.tar.gz
gnunet-e73416feea2be995456c62f74b33e714501cdb33.zip
Fixed double chaining on note reattachment
Diffstat (limited to 'src/mesh/test_mesh_path_api.c')
-rw-r--r--src/mesh/test_mesh_path_api.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/mesh/test_mesh_path_api.c b/src/mesh/test_mesh_path_api.c
index d033d0c83..36eace93d 100644
--- a/src/mesh/test_mesh_path_api.c
+++ b/src/mesh/test_mesh_path_api.c
@@ -57,6 +57,7 @@ finish(void)
57{ 57{
58 unsigned int i; 58 unsigned int i;
59 59
60 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Finishing...\n");
60 for (i = 0; i < 10; i++) 61 for (i = 0; i < 10; i++)
61 { 62 {
62 GNUNET_free(pi[i]); 63 GNUNET_free(pi[i]);
@@ -117,6 +118,7 @@ main (int argc, char *argv[])
117 path->peers[3] = 3; 118 path->peers[3] = 3;
118 path->length = 4; 119 path->length = 4;
119 120
121 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding first path: 0 1 2 3\n");
120 tree_add_path(tree, path, &cb); 122 tree_add_path(tree, path, &cb);
121 path1 = tree_get_path_to_peer(tree, 3); 123 path1 = tree_get_path_to_peer(tree, 3);
122 if (path->length != path1->length || 124 if (path->length != path1->length ||
@@ -182,11 +184,9 @@ main (int argc, char *argv[])
182 failed++; 184 failed++;
183 } 185 }
184 186
187 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding second path: 0 1 2\n");
185 path->length--; 188 path->length--;
186 tree_add_path(tree, path, &cb); 189 tree_add_path(tree, path, &cb);
187 path->length++;
188 path_destroy(path);
189 finish();
190 190
191 node = tree_find_peer(tree->root, 2); 191 node = tree_find_peer(tree->root, 2);
192 if (node->peer != 2) 192 if (node->peer != 2)
@@ -207,11 +207,13 @@ main (int argc, char *argv[])
207 if (GNUNET_PEER_search(path_get_first_hop(tree, 3)) != 1) 207 if (GNUNET_PEER_search(path_get_first_hop(tree, 3)) != 1)
208 { 208 {
209 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Wrong first hop!\n"); 209 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Wrong first hop!\n");
210 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "3 GOT: %u\n", GNUNET_PEER_search(path_get_first_hop(tree, 3)));
210 failed++; 211 failed++;
211 } 212 }
212 if (GNUNET_PEER_search(path_get_first_hop(tree, 2)) != 1) 213 if (GNUNET_PEER_search(path_get_first_hop(tree, 2)) != 1)
213 { 214 {
214 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Wrong first hop!\n"); 215 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Wrong first hop!\n");
216 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "2 GOT: %u\n", GNUNET_PEER_search(path_get_first_hop(tree, 2)));
215 failed++; 217 failed++;
216 } 218 }
217 219
@@ -231,7 +233,11 @@ main (int argc, char *argv[])
231 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer wrong nchildren!\n"); 233 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer wrong nchildren!\n");
232 failed++; 234 failed++;
233 } 235 }
236 path->length++;
237 path_destroy(path);
238 finish();
234 239
240 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding third path...\n");
235 path->length++; 241 path->length++;
236 path->peers[3] = 4; 242 path->peers[3] = 4;
237 tree_add_path(tree, path, &cb); 243 tree_add_path(tree, path, &cb);
@@ -286,6 +292,8 @@ main (int argc, char *argv[])
286 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer != original\n"); 292 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer != original\n");
287 failed++; 293 failed++;
288 } 294 }
295
296 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Deleting third path...\n");
289 node->status = MESH_PEER_READY; 297 node->status = MESH_PEER_READY;
290 cb_call = 1; 298 cb_call = 1;
291 node2 = tree_del_path(tree, 4, &cb); 299 node2 = tree_del_path(tree, 4, &cb);
@@ -299,7 +307,7 @@ main (int argc, char *argv[])
299 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer != original\n"); 307 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer != original\n");
300 failed++; 308 failed++;
301 } 309 }
302// GNUNET_free(node2); FIXME destroy 310
303 node = tree_find_peer(tree->root, 2); 311 node = tree_find_peer(tree->root, 2);
304 if (node->peer != 2) 312 if (node->peer != 2)
305 { 313 {
@@ -317,6 +325,10 @@ main (int argc, char *argv[])
317 failed++; 325 failed++;
318 } 326 }
319 327
328 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Destroying node copy...\n");
329 tree_node_destroy(node2);
330
331 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding new shorter first path...\n");
320 path->length = 2; 332 path->length = 2;
321 path->peers[1] = 3; 333 path->peers[1] = 3;
322 cb_call = 1; 334 cb_call = 1;