aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_peer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/test_peer.c')
-rw-r--r--src/util/test_peer.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/src/util/test_peer.c b/src/util/test_peer.c
index 5bf5108bc..3817d8243 100644
--- a/src/util/test_peer.c
+++ b/src/util/test_peer.c
@@ -43,13 +43,13 @@ generatePeerIdList ()
43 int i; 43 int i;
44 44
45 for (i = 0; i < NUMBER_OF_PEERS; i++) 45 for (i = 0; i < NUMBER_OF_PEERS; i++)
46 { 46 {
47 GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, 47 GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
48 &pidArr[i].hashPubKey); 48 &pidArr[i].hashPubKey);
49#if DEBUG 49#if DEBUG
50 printf ("Peer %d: %s\n", i, GNUNET_i2s (&pidArr[i])); 50 printf ("Peer %d: %s\n", i, GNUNET_i2s (&pidArr[i]));
51#endif 51#endif
52 } 52 }
53} 53}
54 54
55 55
@@ -65,27 +65,25 @@ check ()
65 GNUNET_assert (0 == GNUNET_PEER_intern (NULL)); 65 GNUNET_assert (0 == GNUNET_PEER_intern (NULL));
66 /* Insert Peers into PeerEntry table and hashmap */ 66 /* Insert Peers into PeerEntry table and hashmap */
67 for (i = 0; i < NUMBER_OF_PEERS; i++) 67 for (i = 0; i < NUMBER_OF_PEERS; i++)
68 {
69 pid = GNUNET_PEER_intern (&pidArr[i]);
70 if (pid != (i + 1))
68 { 71 {
69 pid = GNUNET_PEER_intern (&pidArr[i]); 72 fprintf (stderr, "Unexpected Peer ID returned by intern function\n");
70 if (pid != (i + 1)) 73 return 1;
71 {
72 fprintf (stderr,
73 "Unexpected Peer ID returned by intern function\n");
74 return 1;
75 }
76 } 74 }
75 }
77 76
78 /* Referencing the first 3 peers once again */ 77 /* Referencing the first 3 peers once again */
79 for (i = 0; i < 3; i++) 78 for (i = 0; i < 3; i++)
79 {
80 pid = GNUNET_PEER_intern (&pidArr[i]);
81 if (pid != (i + 1))
80 { 82 {
81 pid = GNUNET_PEER_intern (&pidArr[i]); 83 fprintf (stderr, "Unexpected Peer ID returned by intern function\n");
82 if (pid != (i + 1)) 84 return 1;
83 {
84 fprintf (stderr,
85 "Unexpected Peer ID returned by intern function\n");
86 return 1;
87 }
88 } 85 }
86 }
89 87
90 /* Dereferencing the first 3 peers once [decrementing their reference count] */ 88 /* Dereferencing the first 3 peers once [decrementing their reference count] */
91 GNUNET_PEER_decrement_rcs (ids, 3); 89 GNUNET_PEER_decrement_rcs (ids, 3);
@@ -130,11 +128,11 @@ main ()
130 128
131 GNUNET_log_setup ("test-peer", "ERROR", NULL); 129 GNUNET_log_setup ("test-peer", "ERROR", NULL);
132 for (i = 0; i < 1; i++) 130 for (i = 0; i < 1; i++)
133 { 131 {
134 generatePeerIdList (); 132 generatePeerIdList ();
135 if (0 != check ()) 133 if (0 != check ())
136 return 1; 134 return 1;
137 } 135 }
138 return 0; 136 return 0;
139} 137}
140 138