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, 24 insertions, 22 deletions
diff --git a/src/util/test_peer.c b/src/util/test_peer.c
index 3817d8243..5bf5108bc 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,25 +65,27 @@ 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))
71 { 68 {
72 fprintf (stderr, "Unexpected Peer ID returned by intern function\n"); 69 pid = GNUNET_PEER_intern (&pidArr[i]);
73 return 1; 70 if (pid != (i + 1))
71 {
72 fprintf (stderr,
73 "Unexpected Peer ID returned by intern function\n");
74 return 1;
75 }
74 } 76 }
75 }
76 77
77 /* Referencing the first 3 peers once again */ 78 /* Referencing the first 3 peers once again */
78 for (i = 0; i < 3; i++) 79 for (i = 0; i < 3; i++)
79 {
80 pid = GNUNET_PEER_intern (&pidArr[i]);
81 if (pid != (i + 1))
82 { 80 {
83 fprintf (stderr, "Unexpected Peer ID returned by intern function\n"); 81 pid = GNUNET_PEER_intern (&pidArr[i]);
84 return 1; 82 if (pid != (i + 1))
83 {
84 fprintf (stderr,
85 "Unexpected Peer ID returned by intern function\n");
86 return 1;
87 }
85 } 88 }
86 }
87 89
88 /* Dereferencing the first 3 peers once [decrementing their reference count] */ 90 /* Dereferencing the first 3 peers once [decrementing their reference count] */
89 GNUNET_PEER_decrement_rcs (ids, 3); 91 GNUNET_PEER_decrement_rcs (ids, 3);
@@ -128,11 +130,11 @@ main ()
128 130
129 GNUNET_log_setup ("test-peer", "ERROR", NULL); 131 GNUNET_log_setup ("test-peer", "ERROR", NULL);
130 for (i = 0; i < 1; i++) 132 for (i = 0; i < 1; i++)
131 { 133 {
132 generatePeerIdList (); 134 generatePeerIdList ();
133 if (0 != check ()) 135 if (0 != check ())
134 return 1; 136 return 1;
135 } 137 }
136 return 0; 138 return 0;
137} 139}
138 140