summaryrefslogtreecommitdiff
path: root/auto_tests
diff options
context:
space:
mode:
Diffstat (limited to 'auto_tests')
-rw-r--r--auto_tests/tox_test.c106
-rw-r--r--auto_tests/toxav_basic_test.c26
-rw-r--r--auto_tests/toxav_many_test.c16
3 files changed, 74 insertions, 74 deletions
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c
index 7cae9da6..8df6316f 100644
--- a/auto_tests/tox_test.c
+++ b/auto_tests/tox_test.c
@@ -93,13 +93,13 @@ void handle_custom_packet(Tox *m, uint32_t friend_num, const uint8_t *data, size
93uint8_t filenum; 93uint8_t filenum;
94uint32_t file_accepted; 94uint32_t file_accepted;
95uint64_t file_size; 95uint64_t file_size;
96void tox_file_receive(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_KIND kind, uint64_t filesize, 96void tox_file_receive(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_TYPE kind, uint64_t filesize,
97 const uint8_t *filename, size_t filename_length, void *userdata) 97 const uint8_t *filename, size_t filename_length, void *userdata)
98{ 98{
99 if (*((uint32_t *)userdata) != 974536) 99 if (*((uint32_t *)userdata) != 974536)
100 return; 100 return;
101 101
102 if (kind != TOX_FILE_KIND_DATA) { 102 if (kind != TOX_FILE_TYPE_DATA) {
103 ck_abort_msg("Bad kind"); 103 ck_abort_msg("Bad kind");
104 return; 104 return;
105 } 105 }
@@ -113,10 +113,10 @@ void tox_file_receive(Tox *tox, uint32_t friend_number, uint32_t file_number, TO
113 113
114 TOX_ERR_FILE_CONTROL error; 114 TOX_ERR_FILE_CONTROL error;
115 115
116 if (tox_file_control(tox, friend_number, file_number, TOX_FILE_CONTROL_RESUME, &error)) { 116 if (tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_RESUME, &error)) {
117 ++file_accepted; 117 ++file_accepted;
118 } else { 118 } else {
119 ck_abort_msg("tox_file_control failed. %i", error); 119 ck_abort_msg("tox_file_send_control failed. %i", error);
120 } 120 }
121} 121}
122 122
@@ -221,7 +221,7 @@ START_TEST(test_one)
221 221
222 { 222 {
223 TOX_ERR_GET_PORT error; 223 TOX_ERR_GET_PORT error;
224 ck_assert_msg(tox_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n"); 224 ck_assert_msg(tox_self_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
225 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error"); 225 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
226 } 226 }
227 227
@@ -293,7 +293,7 @@ START_TEST(test_few_clients)
293 293
294 { 294 {
295 TOX_ERR_GET_PORT error; 295 TOX_ERR_GET_PORT error;
296 ck_assert_msg(tox_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n"); 296 ck_assert_msg(tox_self_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
297 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error"); 297 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
298 } 298 }
299 299
@@ -309,9 +309,9 @@ START_TEST(test_few_clients)
309 uint8_t off = 1; 309 uint8_t off = 1;
310 310
311 while (1) { 311 while (1) {
312 tox_iteration(tox1); 312 tox_iterate(tox1);
313 tox_iteration(tox2); 313 tox_iterate(tox2);
314 tox_iteration(tox3); 314 tox_iterate(tox3);
315 315
316 if (tox_get_connection_status(tox1) && tox_get_connection_status(tox2) && tox_get_connection_status(tox3)) { 316 if (tox_get_connection_status(tox1) && tox_get_connection_status(tox2) && tox_get_connection_status(tox3)) {
317 if (off) { 317 if (off) {
@@ -334,17 +334,17 @@ START_TEST(test_few_clients)
334 tox_callback_friend_message(tox3, print_message, &to_compare); 334 tox_callback_friend_message(tox3, print_message, &to_compare);
335 uint8_t msgs[TOX_MAX_MESSAGE_LENGTH + 1]; 335 uint8_t msgs[TOX_MAX_MESSAGE_LENGTH + 1];
336 memset(msgs, 'G', sizeof(msgs)); 336 memset(msgs, 'G', sizeof(msgs));
337 TOX_ERR_SEND_MESSAGE errm; 337 TOX_ERR_FRIEND_SEND_MESSAGE errm;
338 tox_send_message(tox2, 0, msgs, TOX_MAX_MESSAGE_LENGTH + 1, &errm); 338 tox_friend_send_message(tox2, 0, msgs, TOX_MAX_MESSAGE_LENGTH + 1, &errm);
339 ck_assert_msg(errm == TOX_ERR_SEND_MESSAGE_TOO_LONG, "TOX_MAX_MESSAGE_LENGTH is too small\n"); 339 ck_assert_msg(errm == TOX_ERR_FRIEND_SEND_MESSAGE_TOO_LONG, "TOX_MAX_MESSAGE_LENGTH is too small\n");
340 tox_send_message(tox2, 0, msgs, TOX_MAX_MESSAGE_LENGTH, &errm); 340 tox_friend_send_message(tox2, 0, msgs, TOX_MAX_MESSAGE_LENGTH, &errm);
341 ck_assert_msg(errm == TOX_ERR_SEND_MESSAGE_OK, "TOX_MAX_MESSAGE_LENGTH is too big\n"); 341 ck_assert_msg(errm == TOX_ERR_FRIEND_SEND_MESSAGE_OK, "TOX_MAX_MESSAGE_LENGTH is too big\n");
342 342
343 while (1) { 343 while (1) {
344 messages_received = 0; 344 messages_received = 0;
345 tox_iteration(tox1); 345 tox_iterate(tox1);
346 tox_iteration(tox2); 346 tox_iterate(tox2);
347 tox_iteration(tox3); 347 tox_iterate(tox3);
348 348
349 if (messages_received) 349 if (messages_received)
350 break; 350 break;
@@ -361,9 +361,9 @@ START_TEST(test_few_clients)
361 361
362 while (1) { 362 while (1) {
363 name_changes = 0; 363 name_changes = 0;
364 tox_iteration(tox1); 364 tox_iterate(tox1);
365 tox_iteration(tox2); 365 tox_iterate(tox2);
366 tox_iteration(tox3); 366 tox_iterate(tox3);
367 367
368 if (name_changes) 368 if (name_changes)
369 break; 369 break;
@@ -381,9 +381,9 @@ START_TEST(test_few_clients)
381 381
382 while (1) { 382 while (1) {
383 typing_changes = 0; 383 typing_changes = 0;
384 tox_iteration(tox1); 384 tox_iterate(tox1);
385 tox_iteration(tox2); 385 tox_iterate(tox2);
386 tox_iteration(tox3); 386 tox_iterate(tox3);
387 387
388 388
389 if (typing_changes == 2) 389 if (typing_changes == 2)
@@ -399,9 +399,9 @@ START_TEST(test_few_clients)
399 399
400 while (1) { 400 while (1) {
401 typing_changes = 0; 401 typing_changes = 0;
402 tox_iteration(tox1); 402 tox_iterate(tox1);
403 tox_iteration(tox2); 403 tox_iterate(tox2);
404 tox_iteration(tox3); 404 tox_iterate(tox3);
405 405
406 if (typing_changes == 1) 406 if (typing_changes == 1)
407 break; 407 break;
@@ -419,16 +419,16 @@ START_TEST(test_few_clients)
419 tox_callback_friend_lossless_packet(tox3, &handle_custom_packet, &packet_number); 419 tox_callback_friend_lossless_packet(tox3, &handle_custom_packet, &packet_number);
420 uint8_t data_c[TOX_MAX_CUSTOM_PACKET_SIZE + 1]; 420 uint8_t data_c[TOX_MAX_CUSTOM_PACKET_SIZE + 1];
421 memset(data_c, ((uint8_t)packet_number), sizeof(data_c)); 421 memset(data_c, ((uint8_t)packet_number), sizeof(data_c));
422 int ret = tox_send_lossless_packet(tox2, 0, data_c, sizeof(data_c), 0); 422 int ret = tox_friend_send_lossless_packet(tox2, 0, data_c, sizeof(data_c), 0);
423 ck_assert_msg(ret == 0, "tox_send_lossless_packet bigger fail %i", ret); 423 ck_assert_msg(ret == 0, "tox_friend_send_lossless_packet bigger fail %i", ret);
424 ret = tox_send_lossless_packet(tox2, 0, data_c, TOX_MAX_CUSTOM_PACKET_SIZE, 0); 424 ret = tox_friend_send_lossless_packet(tox2, 0, data_c, TOX_MAX_CUSTOM_PACKET_SIZE, 0);
425 ck_assert_msg(ret == 1, "tox_send_lossless_packet fail %i", ret); 425 ck_assert_msg(ret == 1, "tox_friend_send_lossless_packet fail %i", ret);
426 426
427 while (1) { 427 while (1) {
428 custom_packet = 0; 428 custom_packet = 0;
429 tox_iteration(tox1); 429 tox_iterate(tox1);
430 tox_iteration(tox2); 430 tox_iterate(tox2);
431 tox_iteration(tox3); 431 tox_iterate(tox3);
432 432
433 if (custom_packet == 1) 433 if (custom_packet == 1)
434 break; 434 break;
@@ -441,16 +441,16 @@ START_TEST(test_few_clients)
441 packet_number = 200; 441 packet_number = 200;
442 tox_callback_friend_lossy_packet(tox3, &handle_custom_packet, &packet_number); 442 tox_callback_friend_lossy_packet(tox3, &handle_custom_packet, &packet_number);
443 memset(data_c, ((uint8_t)packet_number), sizeof(data_c)); 443 memset(data_c, ((uint8_t)packet_number), sizeof(data_c));
444 ret = tox_send_lossy_packet(tox2, 0, data_c, sizeof(data_c), 0); 444 ret = tox_friend_send_lossy_packet(tox2, 0, data_c, sizeof(data_c), 0);
445 ck_assert_msg(ret == 0, "tox_send_lossy_packet bigger fail %i", ret); 445 ck_assert_msg(ret == 0, "tox_friend_send_lossy_packet bigger fail %i", ret);
446 ret = tox_send_lossy_packet(tox2, 0, data_c, TOX_MAX_CUSTOM_PACKET_SIZE, 0); 446 ret = tox_friend_send_lossy_packet(tox2, 0, data_c, TOX_MAX_CUSTOM_PACKET_SIZE, 0);
447 ck_assert_msg(ret == 1, "tox_send_lossy_packet fail %i", ret); 447 ck_assert_msg(ret == 1, "tox_friend_send_lossy_packet fail %i", ret);
448 448
449 while (1) { 449 while (1) {
450 custom_packet = 0; 450 custom_packet = 0;
451 tox_iteration(tox1); 451 tox_iterate(tox1);
452 tox_iteration(tox2); 452 tox_iterate(tox2);
453 tox_iteration(tox3); 453 tox_iterate(tox3);
454 454
455 if (custom_packet == 1) 455 if (custom_packet == 1)
456 break; 456 break;
@@ -463,20 +463,20 @@ START_TEST(test_few_clients)
463 file_accepted = file_size = file_recv = sendf_ok = size_recv = 0; 463 file_accepted = file_size = file_recv = sendf_ok = size_recv = 0;
464 long long unsigned int f_time = time(NULL); 464 long long unsigned int f_time = time(NULL);
465 tox_callback_file_receive_chunk(tox3, write_file, &to_compare); 465 tox_callback_file_receive_chunk(tox3, write_file, &to_compare);
466 tox_callback_file_control(tox2, file_print_control, &to_compare); 466 tox_callback_file_recv_control(tox2, file_print_control, &to_compare);
467 tox_callback_file_request_chunk(tox2, tox_file_request_chunk, &to_compare); 467 tox_callback_file_request_chunk(tox2, tox_file_request_chunk, &to_compare);
468 tox_callback_file_control(tox3, file_print_control, &to_compare); 468 tox_callback_file_recv_control(tox3, file_print_control, &to_compare);
469 tox_callback_file_receive(tox3, tox_file_receive, &to_compare); 469 tox_callback_file_receive(tox3, tox_file_receive, &to_compare);
470 uint64_t totalf_size = 100 * 1024 * 1024; 470 uint64_t totalf_size = 100 * 1024 * 1024;
471 uint32_t fnum = tox_file_send(tox2, 0, TOX_FILE_KIND_DATA, totalf_size, (uint8_t *)"Gentoo.exe", sizeof("Gentoo.exe"), 471 uint32_t fnum = tox_file_send(tox2, 0, TOX_FILE_TYPE_DATA, totalf_size, (uint8_t *)"Gentoo.exe", sizeof("Gentoo.exe"),
472 0); 472 0);
473 ck_assert_msg(fnum != UINT32_MAX, "tox_new_file_sender fail"); 473 ck_assert_msg(fnum != UINT32_MAX, "tox_new_file_sender fail");
474 474
475 475
476 while (1) { 476 while (1) {
477 tox_iteration(tox1); 477 tox_iterate(tox1);
478 tox_iteration(tox2); 478 tox_iterate(tox2);
479 tox_iteration(tox3); 479 tox_iterate(tox3);
480 480
481 if (file_sending_done) { 481 if (file_sending_done) {
482 if (sendf_ok && file_recv && totalf_size == file_size && size_recv == file_size && sending_pos == size_recv) { 482 if (sendf_ok && file_recv && totalf_size == file_size && size_recv == file_size && sending_pos == size_recv) {
@@ -526,7 +526,7 @@ START_TEST(test_many_clients)
526 526
527 { 527 {
528 TOX_ERR_GET_PORT error; 528 TOX_ERR_GET_PORT error;
529 ck_assert_msg(tox_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n"); 529 ck_assert_msg(tox_self_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
530 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error"); 530 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
531 } 531 }
532 532
@@ -573,7 +573,7 @@ loop_top:
573 } 573 }
574 574
575 for (i = 0; i < NUM_TOXES; ++i) { 575 for (i = 0; i < NUM_TOXES; ++i) {
576 tox_iteration(toxes[i]); 576 tox_iterate(toxes[i]);
577 } 577 }
578 578
579 c_sleep(50); 579 c_sleep(50);
@@ -654,7 +654,7 @@ START_TEST(test_many_group)
654 654
655 { 655 {
656 TOX_ERR_GET_PORT error; 656 TOX_ERR_GET_PORT error;
657 ck_assert_msg(tox_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n"); 657 ck_assert_msg(tox_self_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
658 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error"); 658 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
659 } 659 }
660 660
@@ -678,7 +678,7 @@ START_TEST(test_many_group)
678 break; 678 break;
679 679
680 for (i = 0; i < NUM_GROUP_TOX; ++i) { 680 for (i = 0; i < NUM_GROUP_TOX; ++i) {
681 tox_iteration(toxes[i]); 681 tox_iterate(toxes[i]);
682 } 682 }
683 683
684 c_sleep(50); 684 c_sleep(50);
@@ -696,7 +696,7 @@ START_TEST(test_many_group)
696 696
697 while (1) { 697 while (1) {
698 for (i = 0; i < NUM_GROUP_TOX; ++i) { 698 for (i = 0; i < NUM_GROUP_TOX; ++i) {
699 tox_iteration(toxes[i]); 699 tox_iterate(toxes[i]);
700 } 700 }
701 701
702 if (!invite_counter) { 702 if (!invite_counter) {
@@ -734,7 +734,7 @@ START_TEST(test_many_group)
734 734
735 for (j = 0; j < 20; ++j) { 735 for (j = 0; j < 20; ++j) {
736 for (i = 0; i < NUM_GROUP_TOX; ++i) { 736 for (i = 0; i < NUM_GROUP_TOX; ++i) {
737 tox_iteration(toxes[i]); 737 tox_iterate(toxes[i]);
738 } 738 }
739 739
740 c_sleep(50); 740 c_sleep(50);
@@ -747,7 +747,7 @@ START_TEST(test_many_group)
747 747
748 for (j = 0; j < 10; ++j) { 748 for (j = 0; j < 10; ++j) {
749 for (i = 0; i < NUM_GROUP_TOX; ++i) { 749 for (i = 0; i < NUM_GROUP_TOX; ++i) {
750 tox_iteration(toxes[i]); 750 tox_iterate(toxes[i]);
751 } 751 }
752 752
753 c_sleep(50); 753 c_sleep(50);
diff --git a/auto_tests/toxav_basic_test.c b/auto_tests/toxav_basic_test.c
index 59730edf..3f4a3b8d 100644
--- a/auto_tests/toxav_basic_test.c
+++ b/auto_tests/toxav_basic_test.c
@@ -232,7 +232,7 @@ void register_callbacks(ToxAv *av, void *data)
232 */ 232 */
233#define CALL_AND_START_LOOP(AliceCallType, BobCallType) \ 233#define CALL_AND_START_LOOP(AliceCallType, BobCallType) \
234{ int step = 0, running = 1; while (running) {\ 234{ int step = 0, running = 1; while (running) {\
235 tox_iteration(bootstrap_node); tox_iteration(Alice); tox_iteration(Bob); \ 235 tox_iterate(bootstrap_node); tox_iterate(Alice); tox_iterate(Bob); \
236 toxav_do(status_control.Bob.av); toxav_do(status_control.Alice.av); \ 236 toxav_do(status_control.Bob.av); toxav_do(status_control.Alice.av); \
237 switch ( step ) {\ 237 switch ( step ) {\
238 case 0: /* Alice */ printf("Alice is calling...\n");\ 238 case 0: /* Alice */ printf("Alice is calling...\n");\
@@ -267,9 +267,9 @@ START_TEST(test_AV_flows)
267 uint8_t off = 1; 267 uint8_t off = 1;
268 268
269 while (1) { 269 while (1) {
270 tox_iteration(bootstrap_node); 270 tox_iterate(bootstrap_node);
271 tox_iteration(Alice); 271 tox_iterate(Alice);
272 tox_iteration(Bob); 272 tox_iterate(Bob);
273 273
274 if (tox_get_connection_status(bootstrap_node) && tox_get_connection_status(Alice) && tox_get_connection_status(Bob) 274 if (tox_get_connection_status(bootstrap_node) && tox_get_connection_status(Alice) && tox_get_connection_status(Bob)
275 && off) { 275 && off) {
@@ -484,9 +484,9 @@ START_TEST(test_AV_flows)
484 int running = 1; 484 int running = 1;
485 485
486 while (running) { 486 while (running) {
487 tox_iteration(bootstrap_node); 487 tox_iterate(bootstrap_node);
488 tox_iteration(Alice); 488 tox_iterate(Alice);
489 tox_iteration(Bob); 489 tox_iterate(Bob);
490 490
491 switch ( step ) { 491 switch ( step ) {
492 case 0: /* Alice */ 492 case 0: /* Alice */
@@ -525,9 +525,9 @@ START_TEST(test_AV_flows)
525 int running = 1; 525 int running = 1;
526 526
527 while (running) { 527 while (running) {
528 tox_iteration(bootstrap_node); 528 tox_iterate(bootstrap_node);
529 tox_iteration(Alice); 529 tox_iterate(Alice);
530 tox_iteration(Bob); 530 tox_iterate(Bob);
531 531
532 toxav_do(status_control.Alice.av); 532 toxav_do(status_control.Alice.av);
533 toxav_do(status_control.Bob.av); 533 toxav_do(status_control.Bob.av);
@@ -570,9 +570,9 @@ START_TEST(test_AV_flows)
570 int running = 1; 570 int running = 1;
571 571
572 while (running) { 572 while (running) {
573 tox_iteration(bootstrap_node); 573 tox_iterate(bootstrap_node);
574 tox_iteration(Alice); 574 tox_iterate(Alice);
575 tox_iteration(Bob); 575 tox_iterate(Bob);
576 576
577 toxav_do(status_control.Alice.av); 577 toxav_do(status_control.Alice.av);
578 toxav_do(status_control.Bob.av); 578 toxav_do(status_control.Bob.av);
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c
index 4002c4e7..f22043e1 100644
--- a/auto_tests/toxav_many_test.c
+++ b/auto_tests/toxav_many_test.c
@@ -294,11 +294,11 @@ START_TEST(test_AV_three_calls)
294 uint8_t off = 1; 294 uint8_t off = 1;
295 295
296 while (1) { 296 while (1) {
297 tox_iteration(bootstrap_node); 297 tox_iterate(bootstrap_node);
298 tox_iteration(caller); 298 tox_iterate(caller);
299 299
300 for (i = 0; i < 3; i ++) { 300 for (i = 0; i < 3; i ++) {
301 tox_iteration(callees[i]); 301 tox_iterate(callees[i]);
302 } 302 }
303 303
304 304
@@ -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_iteration(bootstrap_node); 354 tox_iterate(bootstrap_node);
355 tox_iteration(caller); 355 tox_iterate(caller);
356 tox_iteration(callees[0]); 356 tox_iterate(callees[0]);
357 tox_iteration(callees[1]); 357 tox_iterate(callees[1]);
358 tox_iteration(callees[2]); 358 tox_iterate(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);