summaryrefslogtreecommitdiff
path: root/auto_tests/toxav_many_test.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2015-02-25 21:09:14 -0500
committerirungentoo <irungentoo@gmail.com>2015-02-25 21:09:14 -0500
commit76dfccf2d6386c1dd1a7e62586ceb1e18618b328 (patch)
tree8bdd109789fbafe50695c5d5f004e2b0310eb78f /auto_tests/toxav_many_test.c
parentca997bda701f27454b4f5cd54a94f4166ab8e235 (diff)
Ported some tests to the new api.
Diffstat (limited to 'auto_tests/toxav_many_test.c')
-rw-r--r--auto_tests/toxav_many_test.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c
index 99012992..4002c4e7 100644
--- a/auto_tests/toxav_many_test.c
+++ b/auto_tests/toxav_many_test.c
@@ -58,10 +58,10 @@ typedef struct _Status {
58 58
59Status status_control; 59Status status_control;
60 60
61void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, uint16_t length, void *userdata) 61void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, size_t length, void *userdata)
62{ 62{
63 if (length == 7 && memcmp("gentoo", data, 7) == 0) { 63 if (length == 7 && memcmp("gentoo", data, 7) == 0) {
64 tox_add_friend_norequest(m, public_key); 64 tox_friend_add_norequest(m, public_key, 0);
65 } 65 }
66} 66}
67 67
@@ -264,12 +264,12 @@ START_TEST(test_AV_three_calls)
264// void test_AV_three_calls() 264// void test_AV_three_calls()
265{ 265{
266 long long unsigned int cur_time = time(NULL); 266 long long unsigned int cur_time = time(NULL);
267 Tox *bootstrap_node = tox_new(0); 267 Tox *bootstrap_node = tox_new(0, 0, 0, 0);
268 Tox *caller = tox_new(0); 268 Tox *caller = tox_new(0, 0, 0, 0);
269 Tox *callees[3] = { 269 Tox *callees[3] = {
270 tox_new(0), 270 tox_new(0, 0, 0, 0),
271 tox_new(0), 271 tox_new(0, 0, 0, 0),
272 tox_new(0), 272 tox_new(0, 0, 0, 0),
273 }; 273 };
274 274
275 275
@@ -284,37 +284,37 @@ START_TEST(test_AV_three_calls)
284 for ( i = 0; i < 3; i ++ ) { 284 for ( i = 0; i < 3; i ++ ) {
285 uint32_t to_compare = 974536; 285 uint32_t to_compare = 974536;
286 tox_callback_friend_request(callees[i], accept_friend_request, &to_compare); 286 tox_callback_friend_request(callees[i], accept_friend_request, &to_compare);
287 uint8_t address[TOX_FRIEND_ADDRESS_SIZE]; 287 uint8_t address[TOX_ADDRESS_SIZE];
288 tox_get_address(callees[i], address); 288 tox_self_get_address(callees[i], address);
289 289
290 int test = tox_add_friend(caller, address, (uint8_t *)"gentoo", 7); 290 uint32_t test = tox_friend_add(caller, address, (uint8_t *)"gentoo", 7, 0);
291 ck_assert_msg( test == i, "Failed to add friend error code: %i", test); 291 ck_assert_msg( test == i, "Failed to add friend error code: %i", test);
292 } 292 }
293 293
294 uint8_t off = 1; 294 uint8_t off = 1;
295 295
296 while (1) { 296 while (1) {
297 tox_do(bootstrap_node); 297 tox_iteration(bootstrap_node);
298 tox_do(caller); 298 tox_iteration(caller);
299 299
300 for (i = 0; i < 3; i ++) { 300 for (i = 0; i < 3; i ++) {
301 tox_do(callees[i]); 301 tox_iteration(callees[i]);
302 } 302 }
303 303
304 304
305 if (tox_isconnected(bootstrap_node) && 305 if (tox_get_connection_status(bootstrap_node) &&
306 tox_isconnected(caller) && 306 tox_get_connection_status(caller) &&
307 tox_isconnected(callees[0]) && 307 tox_get_connection_status(callees[0]) &&
308 tox_isconnected(callees[1]) && 308 tox_get_connection_status(callees[1]) &&
309 tox_isconnected(callees[2]) && off) { 309 tox_get_connection_status(callees[2]) && off) {
310 printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time); 310 printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time);
311 off = 0; 311 off = 0;
312 } 312 }
313 313
314 314
315 if (tox_get_friend_connection_status(caller, 0) == 1 && 315 if (tox_friend_get_connection_status(caller, 0, 0) &&
316 tox_get_friend_connection_status(caller, 1) == 1 && 316 tox_friend_get_connection_status(caller, 1, 0) &&
317 tox_get_friend_connection_status(caller, 2) == 1 ) 317 tox_friend_get_connection_status(caller, 2, 0) )
318 break; 318 break;
319 319
320 c_sleep(20); 320 c_sleep(20);
@@ -351,11 +351,11 @@ START_TEST(test_AV_three_calls)
351 while (call_running[0] || call_running[1] || call_running[2]) { 351 while (call_running[0] || call_running[1] || call_running[2]) {
352 pthread_mutex_lock(&muhmutex); 352 pthread_mutex_lock(&muhmutex);
353 353
354 tox_do(bootstrap_node); 354 tox_iteration(bootstrap_node);
355 tox_do(caller); 355 tox_iteration(caller);
356 tox_do(callees[0]); 356 tox_iteration(callees[0]);
357 tox_do(callees[1]); 357 tox_iteration(callees[1]);
358 tox_do(callees[2]); 358 tox_iteration(callees[2]);
359 359
360 for ( i = 0; i < 3; i++ ) 360 for ( i = 0; i < 3; i++ )
361 toxav_do(status_control.calls[0].Caller.av); 361 toxav_do(status_control.calls[0].Caller.av);