aboutsummaryrefslogtreecommitdiff
path: root/src/ats
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-06-25 09:57:42 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-06-25 09:57:42 +0000
commitc83d77d730a4ae94dff88ec0c6801fde14490f65 (patch)
treef5284e4be0b41fbdc3f615047d14e3c84ebed1c1 /src/ats
parent28ee0c77c5cd31f45e413e200426cb79370988c3 (diff)
downloadgnunet-c83d77d730a4ae94dff88ec0c6801fde14490f65.tar.gz
gnunet-c83d77d730a4ae94dff88ec0c6801fde14490f65.zip
fixed test
Diffstat (limited to 'src/ats')
-rw-r--r--src/ats/test_ats_normalization_update_quality.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/ats/test_ats_normalization_update_quality.c b/src/ats/test_ats_normalization_update_quality.c
index f7b656487..483994b37 100644
--- a/src/ats/test_ats_normalization_update_quality.c
+++ b/src/ats/test_ats_normalization_update_quality.c
@@ -44,7 +44,7 @@ static int ret;
44/** 44/**
45 * Test address 45 * Test address
46 */ 46 */
47static struct Test_Address test_addr; 47static struct Test_Address test_addr[3];
48 48
49/** 49/**
50 * Test peer 50 * Test peer
@@ -75,7 +75,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
75 75
76 if (sched_ats != NULL) 76 if (sched_ats != NULL)
77 GNUNET_ATS_scheduling_done (sched_ats); 77 GNUNET_ATS_scheduling_done (sched_ats);
78 free_test_address (&test_addr); 78 free_test_address (&test_addr[0]);
79 free_test_address (&test_addr[1]);
80 free_test_address (&test_addr[2]);
79 ret = 0; 81 ret = 0;
80} 82}
81 83
@@ -91,7 +93,9 @@ end ()
91 } 93 }
92 GNUNET_ATS_scheduling_done (sched_ats); 94 GNUNET_ATS_scheduling_done (sched_ats);
93 sched_ats = NULL; 95 sched_ats = NULL;
94 free_test_address (&test_addr); 96 free_test_address (&test_addr[0]);
97 free_test_address (&test_addr[1]);
98 free_test_address (&test_addr[2]);
95} 99}
96 100
97 101
@@ -177,7 +181,7 @@ run (void *cls,
177 181
178 182
179 /* Adding address for peer 0 */ 183 /* Adding address for peer 0 */
180 create_test_address (&test_addr, "test", &test_addr, "test", strlen ("test") + 1); 184 create_test_address (&test_addr[0], "test", &test_addr, "test_p0_a0", strlen ("test_p0_a0") + 1);
181 /* Prepare ATS Information */ 185 /* Prepare ATS Information */
182 test_ats_info[0].type = htonl (GNUNET_ATS_NETWORK_TYPE); 186 test_ats_info[0].type = htonl (GNUNET_ATS_NETWORK_TYPE);
183 test_ats_info[0].value = htonl(GNUNET_ATS_NET_WAN); 187 test_ats_info[0].value = htonl(GNUNET_ATS_NET_WAN);
@@ -186,13 +190,13 @@ run (void *cls,
186 test_ats_count = 2; 190 test_ats_count = 2;
187 191
188 test_hello_address[0].peer = p[0].id; 192 test_hello_address[0].peer = p[0].id;
189 test_hello_address[0].transport_name = test_addr.plugin; 193 test_hello_address[0].transport_name = test_addr[0].plugin;
190 test_hello_address[0].address = test_addr.addr; 194 test_hello_address[0].address = test_addr[0].addr;
191 test_hello_address[0].address_length = test_addr.addr_len; 195 test_hello_address[0].address_length = test_addr[0].addr_len;
192 GNUNET_ATS_address_add (sched_ats, &test_hello_address[0], NULL, test_ats_info, test_ats_count); 196 GNUNET_ATS_address_add (sched_ats, &test_hello_address[0], NULL, test_ats_info, test_ats_count);
193 197
194 /* Adding address for peer 1 */ 198 /* Adding address for peer 1 */
195 create_test_address (&test_addr, "test", &test_addr, "test", strlen ("test") + 1); 199 create_test_address (&test_addr[1], "test", &test_addr, "test_p1_a0", strlen ("test_p1_a0") + 1);
196 test_ats_info[0].type = htonl (GNUNET_ATS_NETWORK_TYPE); 200 test_ats_info[0].type = htonl (GNUNET_ATS_NETWORK_TYPE);
197 test_ats_info[0].value = htonl(GNUNET_ATS_NET_WAN); 201 test_ats_info[0].value = htonl(GNUNET_ATS_NET_WAN);
198 test_ats_info[1].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); 202 test_ats_info[1].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
@@ -200,9 +204,9 @@ run (void *cls,
200 test_ats_count = 2; 204 test_ats_count = 2;
201 205
202 test_hello_address[1].peer = p[1].id; 206 test_hello_address[1].peer = p[1].id;
203 test_hello_address[1].transport_name = test_addr.plugin; 207 test_hello_address[1].transport_name = test_addr[1].plugin;
204 test_hello_address[1].address = test_addr.addr; 208 test_hello_address[1].address = test_addr[1].addr;
205 test_hello_address[1].address_length = test_addr.addr_len; 209 test_hello_address[1].address_length = test_addr[1].addr_len;
206 GNUNET_ATS_address_add (sched_ats, &test_hello_address[1], NULL, test_ats_info, test_ats_count); 210 GNUNET_ATS_address_add (sched_ats, &test_hello_address[1], NULL, test_ats_info, test_ats_count);
207 211
208 /* Adding 2nd address for peer 1 */ 212 /* Adding 2nd address for peer 1 */
@@ -212,11 +216,12 @@ run (void *cls,
212 test_ats_info[1].value = htonl(20); 216 test_ats_info[1].value = htonl(20);
213 test_ats_count = 2; 217 test_ats_count = 2;
214 218
219 create_test_address (&test_addr[2], "test", &test_addr, "test_p1_a1", strlen ("test_p1_a1") + 1);
215 test_hello_address[2].peer = p[1].id; 220 test_hello_address[2].peer = p[1].id;
216 test_hello_address[2].transport_name = test_addr.plugin; 221 test_hello_address[2].transport_name = test_addr[2].plugin;
217 test_hello_address[2].address = test_addr.addr; 222 test_hello_address[2].address = test_addr[2].addr;
218 test_hello_address[2].address_length = test_addr.addr_len; 223 test_hello_address[2].address_length = test_addr[2].addr_len;
219 GNUNET_ATS_address_add (sched_ats, &test_hello_address[3], NULL, test_ats_info, test_ats_count); 224 GNUNET_ATS_address_add (sched_ats, &test_hello_address[2], NULL, test_ats_info, test_ats_count);
220 225
221 /* Request address */ 226 /* Request address */
222 GNUNET_ATS_suggest_address (sched_ats, &p[0].id); 227 GNUNET_ATS_suggest_address (sched_ats, &p[0].id);