diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:46:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:46:35 +0000 |
commit | 502af2167f7c218366666ca4944bd7cc54b5b19a (patch) | |
tree | a91fec5cc9769d260640bd91c6633cb9cf395524 /src/util/test_peer.c | |
parent | 03af5a603b7cc53432249d5854cd412aa90dde0d (diff) | |
download | gnunet-502af2167f7c218366666ca4944bd7cc54b5b19a.tar.gz gnunet-502af2167f7c218366666ca4944bd7cc54b5b19a.zip |
indentation
Diffstat (limited to 'src/util/test_peer.c')
-rw-r--r-- | src/util/test_peer.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/src/util/test_peer.c b/src/util/test_peer.c index 8dacbd765..395d40712 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); |
@@ -127,13 +125,14 @@ int | |||
127 | main () | 125 | main () |
128 | { | 126 | { |
129 | int i; | 127 | int i; |
128 | |||
130 | GNUNET_log_setup ("test-peer", "ERROR", NULL); | 129 | GNUNET_log_setup ("test-peer", "ERROR", NULL); |
131 | for (i = 0; i < 1; i++) | 130 | for (i = 0; i < 1; i++) |
132 | { | 131 | { |
133 | generatePeerIdList (); | 132 | generatePeerIdList (); |
134 | if (0 != check ()) | 133 | if (0 != check ()) |
135 | return 1; | 134 | return 1; |
136 | } | 135 | } |
137 | return 0; | 136 | return 0; |
138 | } | 137 | } |
139 | 138 | ||