aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/test_mesh_tree_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesh/test_mesh_tree_api.c')
-rw-r--r--src/mesh/test_mesh_tree_api.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/src/mesh/test_mesh_tree_api.c b/src/mesh/test_mesh_tree_api.c
index ec92a5ece..60e31bdde 100644
--- a/src/mesh/test_mesh_tree_api.c
+++ b/src/mesh/test_mesh_tree_api.c
@@ -78,16 +78,15 @@ test_assert (GNUNET_PEER_Id peer_id, enum MeshPeerState status,
78 if (n->peer != peer_id) 78 if (n->peer != peer_id)
79 { 79 {
80 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 80 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
81 "Retrieved peer has wrong ID! (Got %u, expected %u)\n", 81 "Retrieved peer has wrong ID! (Got %u, expected %u)\n", n->peer,
82 n->peer, peer_id); 82 peer_id);
83 failed++; 83 failed++;
84 } 84 }
85 if (n->status != status) 85 if (n->status != status)
86 { 86 {
87 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 87 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
88 "Retrieved peer has wrong status! (Got %u, expected %u)\n", 88 "Retrieved peer has wrong status! (Got %u, expected %u)\n",
89 n->status, 89 n->status, status);
90 status);
91 failed++; 90 failed++;
92 } 91 }
93 for (c = n->children_head, i = 0; NULL != c; c = c->next, i++) ; 92 for (c = n->children_head, i = 0; NULL != c; c = c->next, i++) ;
@@ -101,7 +100,8 @@ test_assert (GNUNET_PEER_Id peer_id, enum MeshPeerState status,
101 if (0 != first_hop && 100 if (0 != first_hop &&
102 GNUNET_PEER_search (tree_get_first_hop (tree, peer_id)) != first_hop) 101 GNUNET_PEER_search (tree_get_first_hop (tree, peer_id)) != first_hop)
103 { 102 {
104 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Wrong first hop! (Got %u, expected %u)\n", 103 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
104 "Wrong first hop! (Got %u, expected %u)\n",
105 GNUNET_PEER_search (tree_get_first_hop (tree, peer_id)), 105 GNUNET_PEER_search (tree_get_first_hop (tree, peer_id)),
106 first_hop); 106 first_hop);
107 failed++; 107 failed++;
@@ -112,8 +112,8 @@ test_assert (GNUNET_PEER_Id peer_id, enum MeshPeerState status,
112 112
113 GNUNET_PEER_resolve (peer_id, &id); 113 GNUNET_PEER_resolve (peer_id, &id);
114 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 114 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
115 "*** Peer %s (%u) has failed %d checks!\n", 115 "*** Peer %s (%u) has failed %d checks!\n", GNUNET_i2s (&id),
116 GNUNET_i2s (&id), peer_id, failed - pre_failed); 116 peer_id, failed - pre_failed);
117 } 117 }
118} 118}
119 119
@@ -219,41 +219,34 @@ main (int argc, char *argv[])
219 for (i = 1; i < 5; i++) 219 for (i = 1; i < 5; i++)
220 { 220 {
221 path->length = i; 221 path->length = i;
222 if (tree_get_path_cost(tree, path) != 0) 222 if (tree_get_path_cost (tree, path) != 0)
223 { 223 {
224 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 224 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: length %u cost failed!\n",
225 "test: length %u cost failed!\n",
226 i); 225 i);
227 failed++; 226 failed++;
228 } 227 }
229 } 228 }
230 path->length++; 229 path->length++;
231 path->peers[4] = 6; 230 path->peers[4] = 6;
232 if (tree_get_path_cost(tree, path) != 1) 231 if (tree_get_path_cost (tree, path) != 1)
233 { 232 {
234 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 233 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: length %u cost failed!\n", i);
235 "test: length %u cost failed!\n",
236 i);
237 failed++; 234 failed++;
238 } 235 }
239 path->peers[3] = 7; 236 path->peers[3] = 7;
240 if (tree_get_path_cost(tree, path) != 2) 237 if (tree_get_path_cost (tree, path) != 2)
241 { 238 {
242 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 239 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: length %u cost failed!\n", i);
243 "test: length %u cost failed!\n",
244 i);
245 failed++; 240 failed++;
246 } 241 }
247 path->length--; 242 path->length--;
248 if (tree_get_path_cost(tree, path) != 1) 243 if (tree_get_path_cost (tree, path) != 1)
249 { 244 {
250 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 245 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: length %u cost failed!\n", i);
251 "test: length %u cost failed!\n",
252 i);
253 failed++; 246 failed++;
254 } 247 }
255 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Deleting third path (5)\n"); 248 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Deleting third path (5)\n");
256 tree_set_status(tree, 5, MESH_PEER_READY); 249 tree_set_status (tree, 5, MESH_PEER_READY);
257 cb_call = 1; 250 cb_call = 1;
258 node = tree_del_path (tree, 5, &cb, NULL); 251 node = tree_del_path (tree, 5, &cb, NULL);
259 tree_debug (tree); 252 tree_debug (tree);