[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17812 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17812 - gnunet/src/mesh |
Date: |
Thu, 27 Oct 2011 15:06:24 +0200 |
Author: bartpolot
Date: 2011-10-27 15:06:23 +0200 (Thu, 27 Oct 2011)
New Revision: 17812
Modified:
gnunet/src/mesh/test_mesh_path_api.c
Log:
WiP
Modified: gnunet/src/mesh/test_mesh_path_api.c
===================================================================
--- gnunet/src/mesh/test_mesh_path_api.c 2011-10-27 13:01:11 UTC (rev
17811)
+++ gnunet/src/mesh/test_mesh_path_api.c 2011-10-27 13:06:23 UTC (rev
17812)
@@ -75,7 +75,7 @@
struct GNUNET_PeerIdentity *pi;
pi = GNUNET_malloc(sizeof(struct GNUNET_PeerIdentity));
- pi->hashPubKey.bits[0] = id;
+ pi->hashPubKey.bits[0] = id + 1;
return pi;
}
@@ -108,20 +108,19 @@
tree = GNUNET_malloc(sizeof(struct MeshTunnelTree));
tree->first_hops = GNUNET_CONTAINER_multihashmap_create(32);
tree->root = GNUNET_malloc(sizeof(struct MeshTunnelTreeNode));
- tree->root->peer = 0;
+ tree->root->peer = 1;
tree->me = tree->root;
- path = GNUNET_malloc(sizeof(struct MeshPeerPath));
- path->peers = GNUNET_malloc(sizeof(GNUNET_PEER_Id) * 4);
- path->peers[0] = 0;
- path->peers[1] = 1;
- path->peers[2] = 2;
- path->peers[3] = 3;
+ path = path_new (4);
+ path->peers[0] = 1;
+ path->peers[1] = 2;
+ path->peers[2] = 3;
+ path->peers[3] = 4;
path->length = 4;
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding first path: 0 1 2 3\n");
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding first path: 1 2 3 4\n");
tree_add_path(tree, path, &cb);
tree_debug(tree);
- path1 = tree_get_path_to_peer(tree, 3);
+ path1 = tree_get_path_to_peer(tree, 4);
if (path->length != path1->length ||
memcmp(path->peers, path1->peers, path->length) != 0)
{
@@ -129,8 +128,8 @@
failed++;
}
path_destroy(path1);
- node = tree_find_peer(tree->root, 3);
- if (node->peer != 3)
+ node = tree_find_peer(tree->root, 4);
+ if (node->peer != 4)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer != original\n");
failed++;
@@ -140,14 +139,14 @@
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer wrong status!\n");
failed++;
}
- if (GNUNET_PEER_search(path_get_first_hop(tree, 3)) != 1)
+ if (GNUNET_PEER_search(path_get_first_hop(tree, 4)) != 2)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Wrong first hop!\n");
failed++;
}
- node = tree_find_peer(tree->root, 2);
- if (node->peer != 2)
+ node = tree_find_peer(tree->root, 3);
+ if (node->peer != 3)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer != original\n");
failed++;
@@ -162,14 +161,14 @@
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer wrong nchildren!\n");
failed++;
}
- if (GNUNET_PEER_search(path_get_first_hop(tree, 3)) != 1)
+ if (GNUNET_PEER_search(path_get_first_hop(tree, 3)) != 2)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Wrong first hop!\n");
failed++;
}
- node = tree_find_peer(tree->root, 1);
- if (node->peer != 1)
+ node = tree_find_peer(tree->root, 2);
+ if (node->peer != 2)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer != original\n");
failed++;
@@ -185,13 +184,13 @@
failed++;
}
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding second path: 0 1 2\n");
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding second path: 1 2 3\n");
path->length--;
tree_add_path(tree, path, &cb);
tree_debug(tree);
- node = tree_find_peer(tree->root, 2);
- if (node->peer != 2)
+ node = tree_find_peer(tree->root, 4);
+ if (node->peer != 4)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer != original\n");
failed++;
@@ -206,21 +205,21 @@
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer wrong nchildren!\n");
failed++;
}
- if (GNUNET_PEER_search(path_get_first_hop(tree, 3)) != 1)
+ if (GNUNET_PEER_search(path_get_first_hop(tree, 4)) != 2)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Wrong first hop!\n");
- GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "3 GOT: %u\n",
GNUNET_PEER_search(path_get_first_hop(tree, 3)));
+ GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "4 GOT: %u\n",
GNUNET_PEER_search(path_get_first_hop(tree, 4)));
failed++;
}
- if (GNUNET_PEER_search(path_get_first_hop(tree, 2)) != 1)
+ if (GNUNET_PEER_search(path_get_first_hop(tree, 3)) != 2)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Wrong first hop!\n");
- GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "2 GOT: %u\n",
GNUNET_PEER_search(path_get_first_hop(tree, 2)));
+ GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "3 GOT: %u\n",
GNUNET_PEER_search(path_get_first_hop(tree, 3)));
failed++;
}
- node = tree_find_peer(tree->root, 1);
- if (node->peer != 1)
+ node = tree_find_peer(tree->root, 2);
+ if (node->peer != 2)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer != original\n");
failed++;
@@ -238,12 +237,12 @@
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding third path...\n");
path->length++;
- path->peers[3] = 4;
+ path->peers[3] = 5;
tree_add_path(tree, path, &cb);
tree_debug(tree);
- node = tree_find_peer(tree->root, 2);
- if (node->peer != 2)
+ node = tree_find_peer(tree->root, 3);
+ if (node->peer != 3)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer != original\n");
failed++;
@@ -258,19 +257,19 @@
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer wrong nchildren!\n");
failed++;
}
- if (GNUNET_PEER_search(path_get_first_hop(tree, 3)) != 1)
+ if (GNUNET_PEER_search(path_get_first_hop(tree, 3)) != 2)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Wrong first hop!\n");
failed++;
}
- if (GNUNET_PEER_search(path_get_first_hop(tree, 4)) != 1)
+ if (GNUNET_PEER_search(path_get_first_hop(tree, 4)) != 2)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Wrong first hop!\n");
failed++;
}
- node = tree_find_peer(tree->root, 1);
- if (node->peer != 1)
+ node = tree_find_peer(tree->root, 2);
+ if (node->peer != 2)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer != original\n");
failed++;
@@ -286,8 +285,8 @@
failed++;
}
- node = tree_find_peer(tree->root, 4);
- if (node->peer != 4)
+ node = tree_find_peer(tree->root, 5);
+ if (node->peer != 5)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer != original\n");
failed++;
@@ -296,21 +295,21 @@
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Deleting third path...\n");
node->status = MESH_PEER_READY;
cb_call = 1;
- node2 = tree_del_path(tree, 4, &cb);
+ node2 = tree_del_path(tree, 5, &cb);
tree_debug(tree);
if (cb_call != 0)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "%u callbacks missed!\n", cb_call);
failed++;
}
- if (node2->peer != 4)
+ if (node2->peer != 5)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer != original\n");
failed++;
}
- node = tree_find_peer(tree->root, 2);
- if (node->peer != 2)
+ node = tree_find_peer(tree->root, 3);
+ if (node->peer != 3)
{
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer != original\n");
failed++;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17812 - gnunet/src/mesh,
gnunet <=