diff options
Diffstat (limited to 'auto_tests')
-rw-r--r-- | auto_tests/toxav_basic_test.c | 30 | ||||
-rw-r--r-- | auto_tests/toxav_many_test.c | 26 |
2 files changed, 45 insertions, 11 deletions
diff --git a/auto_tests/toxav_basic_test.c b/auto_tests/toxav_basic_test.c index 41fb6787..5821a6d4 100644 --- a/auto_tests/toxav_basic_test.c +++ b/auto_tests/toxav_basic_test.c | |||
@@ -2,11 +2,20 @@ | |||
2 | #include "config.h" | 2 | #include "config.h" |
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #ifndef HAVE_LIBCHECK | ||
6 | # include <assert.h> | ||
7 | |||
8 | # define ck_assert(X) assert(X); | ||
9 | # define START_TEST(NAME) void NAME () | ||
10 | # define END_TEST | ||
11 | #else | ||
12 | # include "helpers.h" | ||
13 | #endif | ||
14 | |||
5 | #include <sys/types.h> | 15 | #include <sys/types.h> |
6 | #include <stdint.h> | 16 | #include <stdint.h> |
7 | #include <string.h> | 17 | #include <string.h> |
8 | #include <stdio.h> | 18 | #include <stdio.h> |
9 | #include <check.h> | ||
10 | #include <stdlib.h> | 19 | #include <stdlib.h> |
11 | #include <time.h> | 20 | #include <time.h> |
12 | 21 | ||
@@ -18,7 +27,6 @@ | |||
18 | #include "../toxcore/crypto_core.h" | 27 | #include "../toxcore/crypto_core.h" |
19 | #include "../toxav/toxav.h" | 28 | #include "../toxav/toxav.h" |
20 | 29 | ||
21 | #include "helpers.h" | ||
22 | 30 | ||
23 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) | 31 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) |
24 | #define c_sleep(x) Sleep(1*x) | 32 | #define c_sleep(x) Sleep(1*x) |
@@ -462,19 +470,19 @@ START_TEST(test_AV_flows) | |||
462 | 470 | ||
463 | printf("Call started as audio only\n"); | 471 | printf("Call started as audio only\n"); |
464 | printf("Turning on video for Alice...\n"); | 472 | printf("Turning on video for Alice...\n"); |
465 | ck_assert(toxav_video_bit_rate_set(AliceAV, 0, 1000, false, NULL)); | 473 | ck_assert(toxav_bit_rate_set(AliceAV, 0, -1, 1000, NULL)); |
466 | 474 | ||
467 | iterate_tox(bootstrap, Alice, Bob); | 475 | iterate_tox(bootstrap, Alice, Bob); |
468 | ck_assert(BobCC.state & TOXAV_FRIEND_CALL_STATE_SENDING_V); | 476 | ck_assert(BobCC.state & TOXAV_FRIEND_CALL_STATE_SENDING_V); |
469 | 477 | ||
470 | printf("Turning off video for Alice...\n"); | 478 | printf("Turning off video for Alice...\n"); |
471 | ck_assert(toxav_video_bit_rate_set(AliceAV, 0, 0, false, NULL)); | 479 | ck_assert(toxav_bit_rate_set(AliceAV, 0, -1, 0, NULL)); |
472 | 480 | ||
473 | iterate_tox(bootstrap, Alice, Bob); | 481 | iterate_tox(bootstrap, Alice, Bob); |
474 | ck_assert(!(BobCC.state & TOXAV_FRIEND_CALL_STATE_SENDING_V)); | 482 | ck_assert(!(BobCC.state & TOXAV_FRIEND_CALL_STATE_SENDING_V)); |
475 | 483 | ||
476 | printf("Turning off audio for Alice...\n"); | 484 | printf("Turning off audio for Alice...\n"); |
477 | ck_assert(toxav_audio_bit_rate_set(AliceAV, 0, 0, false, NULL)); | 485 | ck_assert(toxav_bit_rate_set(AliceAV, 0, 0, -1, NULL)); |
478 | 486 | ||
479 | iterate_tox(bootstrap, Alice, Bob); | 487 | iterate_tox(bootstrap, Alice, Bob); |
480 | ck_assert(!(BobCC.state & TOXAV_FRIEND_CALL_STATE_SENDING_A)); | 488 | ck_assert(!(BobCC.state & TOXAV_FRIEND_CALL_STATE_SENDING_A)); |
@@ -564,7 +572,16 @@ START_TEST(test_AV_flows) | |||
564 | } | 572 | } |
565 | END_TEST | 573 | END_TEST |
566 | 574 | ||
567 | 575 | #ifndef HAVE_LIBCHECK | |
576 | int main(int argc, char *argv[]) | ||
577 | { | ||
578 | (void) argc; | ||
579 | (void) argv; | ||
580 | |||
581 | test_AV_flows(); | ||
582 | return 0; | ||
583 | } | ||
584 | #else | ||
568 | Suite *tox_suite(void) | 585 | Suite *tox_suite(void) |
569 | { | 586 | { |
570 | Suite *s = suite_create("ToxAV"); | 587 | Suite *s = suite_create("ToxAV"); |
@@ -589,3 +606,4 @@ int main(int argc, char *argv[]) | |||
589 | 606 | ||
590 | return number_failed; | 607 | return number_failed; |
591 | } | 608 | } |
609 | #endif | ||
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c index 438f2789..7dc82c6f 100644 --- a/auto_tests/toxav_many_test.c +++ b/auto_tests/toxav_many_test.c | |||
@@ -2,18 +2,25 @@ | |||
2 | #include "config.h" | 2 | #include "config.h" |
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #ifndef HAVE_LIBCHECK | ||
6 | # include <assert.h> | ||
7 | |||
8 | # define ck_assert(X) assert(X); | ||
9 | # define START_TEST(NAME) void NAME () | ||
10 | # define END_TEST | ||
11 | #else | ||
12 | # include "helpers.h" | ||
13 | #endif | ||
14 | |||
5 | #include <sys/types.h> | 15 | #include <sys/types.h> |
6 | #include <stdint.h> | 16 | #include <stdint.h> |
7 | #include <string.h> | 17 | #include <string.h> |
8 | #include <stdio.h> | 18 | #include <stdio.h> |
9 | #include <check.h> | ||
10 | #include <stdlib.h> | 19 | #include <stdlib.h> |
11 | #include <time.h> | 20 | #include <time.h> |
12 | 21 | ||
13 | #include <vpx/vpx_image.h> | 22 | #include <vpx/vpx_image.h> |
14 | 23 | ||
15 | #include "helpers.h" | ||
16 | |||
17 | #include "../toxcore/tox.h" | 24 | #include "../toxcore/tox.h" |
18 | #include "../toxcore/util.h" | 25 | #include "../toxcore/util.h" |
19 | #include "../toxcore/logger.h" | 26 | #include "../toxcore/logger.h" |
@@ -331,8 +338,16 @@ START_TEST(test_AV_three_calls) | |||
331 | END_TEST | 338 | END_TEST |
332 | 339 | ||
333 | 340 | ||
334 | 341 | #ifndef HAVE_LIBCHECK | |
335 | 342 | int main(int argc, char *argv[]) | |
343 | { | ||
344 | (void) argc; | ||
345 | (void) argv; | ||
346 | |||
347 | test_AV_three_calls(); | ||
348 | return 0; | ||
349 | } | ||
350 | #else | ||
336 | Suite *tox_suite(void) | 351 | Suite *tox_suite(void) |
337 | { | 352 | { |
338 | Suite *s = suite_create("ToxAV"); | 353 | Suite *s = suite_create("ToxAV"); |
@@ -362,3 +377,4 @@ int main(int argc, char *argv[]) | |||
362 | 377 | ||
363 | return number_failed; | 378 | return number_failed; |
364 | } | 379 | } |
380 | #endif | ||