diff options
Diffstat (limited to 'src/mesh/test_mesh_tree_api.c')
-rw-r--r-- | src/mesh/test_mesh_tree_api.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/mesh/test_mesh_tree_api.c b/src/mesh/test_mesh_tree_api.c index 77fd799bd..6ad5e9189 100644 --- a/src/mesh/test_mesh_tree_api.c +++ b/src/mesh/test_mesh_tree_api.c | |||
@@ -215,6 +215,43 @@ main (int argc, char *argv[]) | |||
215 | test_assert (2, MESH_PEER_RELAY, 1, 0); | 215 | test_assert (2, MESH_PEER_RELAY, 1, 0); |
216 | test_assert (1, MESH_PEER_ROOT, 1, 0); | 216 | test_assert (1, MESH_PEER_ROOT, 1, 0); |
217 | 217 | ||
218 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Calculating costs...\n"); | ||
219 | for (i = 1; i < 5; i++) | ||
220 | { | ||
221 | path->length = i; | ||
222 | if (tree_get_path_cost(tree, path) != 0) | ||
223 | { | ||
224 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
225 | "test: length %u cost failed!\n", | ||
226 | i); | ||
227 | failed++; | ||
228 | } | ||
229 | } | ||
230 | path->length++; | ||
231 | path->peers[4] = 6; | ||
232 | if (tree_get_path_cost(tree, path) != 1) | ||
233 | { | ||
234 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
235 | "test: length %u cost failed!\n", | ||
236 | i); | ||
237 | failed++; | ||
238 | } | ||
239 | path->peers[3] = 7; | ||
240 | if (tree_get_path_cost(tree, path) != 2) | ||
241 | { | ||
242 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
243 | "test: length %u cost failed!\n", | ||
244 | i); | ||
245 | failed++; | ||
246 | } | ||
247 | path->length--; | ||
248 | if (tree_get_path_cost(tree, path) != 1) | ||
249 | { | ||
250 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
251 | "test: length %u cost failed!\n", | ||
252 | i); | ||
253 | failed++; | ||
254 | } | ||
218 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Deleting third path (5)\n"); | 255 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Deleting third path (5)\n"); |
219 | tree_set_status(tree, 5, MESH_PEER_READY); | 256 | tree_set_status(tree, 5, MESH_PEER_READY); |
220 | cb_call = 1; | 257 | cb_call = 1; |