diff --git a/.gitignore b/.gitignore index dd920d531..61763ce43 100644 --- a/.gitignore +++ b/.gitignore @@ -85,3 +85,6 @@ tester/linphone_log.gz.txt tools/auto_answer tools/lp-autoanswer build/macos/pkg-distribution.xml +tester/record_for_lc_*.wav +tester/record-call_with_file_player.wav + diff --git a/tester/Makefile.am b/tester/Makefile.am index 020bb4424..86510d794 100644 --- a/tester/Makefile.am +++ b/tester/Makefile.am @@ -33,6 +33,7 @@ liblinphonetester_la_SOURCES = \ upnp_tester.c \ video_tester.c \ common/bc_tester_utils.c + liblinphonetester_ladir = $(includedir)/linphone liblinphonetester_la_HEADERS = common/bc_tester_utils.h diff --git a/tester/call_tester.c b/tester/call_tester.c index f5abb2c31..2cc6455b9 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -157,8 +157,8 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana c1=linphone_core_get_current_call(caller->lc); c2=linphone_core_get_current_call(callee->lc); - CU_ASSERT_PTR_NOT_NULL(c1); - CU_ASSERT_PTR_NOT_NULL(c2); + BC_ASSERT_PTR_NOT_NULL(c1); + BC_ASSERT_PTR_NOT_NULL(c2); if (!c1 || !c2) return; linphone_call_ref(c1); @@ -175,13 +175,13 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana } wait_for_until(caller->lc,callee->lc,&dummy,1,500); /*just to sleep while iterating*/ }while (!liblinphone_tester_clock_elapsed(&ts,12000)); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(c1)->round_trip_delay>0.0); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(c2)->round_trip_delay>0.0); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(c1)->round_trip_delay>0.0); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(c2)->round_trip_delay>0.0); if (linphone_call_log_video_enabled(linphone_call_get_call_log(c1))) { - CU_ASSERT_TRUE(linphone_call_get_video_stats(c1)->round_trip_delay>0.0); + BC_ASSERT_TRUE(linphone_call_get_video_stats(c1)->round_trip_delay>0.0); } if (linphone_call_log_video_enabled(linphone_call_get_call_log(c2))) { - CU_ASSERT_TRUE(linphone_call_get_video_stats(c2)->round_trip_delay>0.0); + BC_ASSERT_TRUE(linphone_call_get_video_stats(c2)->round_trip_delay>0.0); } linphone_call_unref(c1); linphone_call_unref(c2); @@ -213,16 +213,16 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr setup_sdp_handling(callee_test_params, callee_mgr); if (!caller_params){ - CU_ASSERT_PTR_NOT_NULL(linphone_core_invite_address(caller_mgr->lc,callee_mgr->identity)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address(caller_mgr->lc,callee_mgr->identity)); }else{ - CU_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(caller_mgr->lc,callee_mgr->identity,caller_params)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(caller_mgr->lc,callee_mgr->identity,caller_params)); } did_receive_call = wait_for(callee_mgr->lc ,caller_mgr->lc ,&callee_mgr->stat.number_of_LinphoneCallIncomingReceived ,initial_callee.number_of_LinphoneCallIncomingReceived+1); - CU_ASSERT_EQUAL(did_receive_call, !callee_test_params->sdp_simulate_error); + BC_ASSERT_EQUAL(did_receive_call, !callee_test_params->sdp_simulate_error, int, "%d"); sal_default_set_sdp_handling(caller_mgr->lc->sal, SalOpSDPNormal); sal_default_set_sdp_handling(callee_mgr->lc->sal, SalOpSDPNormal); @@ -231,8 +231,8 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr if (linphone_core_get_calls_nb(callee_mgr->lc)<=1) - CU_ASSERT_TRUE(linphone_core_inc_invite_pending(callee_mgr->lc)); - CU_ASSERT_EQUAL(caller_mgr->stat.number_of_LinphoneCallOutgoingProgress,initial_caller.number_of_LinphoneCallOutgoingProgress+1); + BC_ASSERT_TRUE(linphone_core_inc_invite_pending(callee_mgr->lc)); + BC_ASSERT_EQUAL(caller_mgr->stat.number_of_LinphoneCallOutgoingProgress,initial_caller.number_of_LinphoneCallOutgoingProgress+1, int, "%d"); while (caller_mgr->stat.number_of_LinphoneCallOutgoingRinging!=(initial_caller.number_of_LinphoneCallOutgoingRinging + 1) @@ -244,11 +244,11 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr } - CU_ASSERT_TRUE((caller_mgr->stat.number_of_LinphoneCallOutgoingRinging==initial_caller.number_of_LinphoneCallOutgoingRinging+1) + BC_ASSERT_TRUE((caller_mgr->stat.number_of_LinphoneCallOutgoingRinging==initial_caller.number_of_LinphoneCallOutgoingRinging+1) ||(caller_mgr->stat.number_of_LinphoneCallOutgoingEarlyMedia==initial_caller.number_of_LinphoneCallOutgoingEarlyMedia+1)); - CU_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call_remote_address(callee_mgr->lc)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call_remote_address(callee_mgr->lc)); callee_call=linphone_core_get_call_by_remote_address2(callee_mgr->lc,caller_mgr->identity); if(!linphone_core_get_current_call(caller_mgr->lc) || !linphone_core_get_current_call(callee_mgr->lc) || !linphone_core_get_current_call_remote_address(callee_mgr->lc)) { @@ -260,9 +260,9 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr if (linphone_call_params_get_privacy(linphone_call_get_current_params(linphone_core_get_current_call(caller_mgr->lc))) == LinphonePrivacyNone) { /*don't check in case of p asserted id*/ if (!lp_config_get_int(callee_mgr->lc->config,"sip","call_logs_use_asserted_id_instead_of_from",0)) - CU_ASSERT_TRUE(linphone_address_weak_equal(callee_from,linphone_call_get_remote_address(callee_call))); + BC_ASSERT_TRUE(linphone_address_weak_equal(callee_from,linphone_call_get_remote_address(callee_call))); } else { - CU_ASSERT_FALSE(linphone_address_weak_equal(callee_from,linphone_call_get_remote_address(linphone_core_get_current_call(callee_mgr->lc)))); + BC_ASSERT_FALSE(linphone_address_weak_equal(callee_from,linphone_call_get_remote_address(linphone_core_get_current_call(callee_mgr->lc)))); } linphone_address_destroy(callee_from); } @@ -279,8 +279,8 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr linphone_core_accept_call(callee_mgr->lc,callee_call); } - CU_ASSERT_TRUE(wait_for(callee_mgr->lc,caller_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallConnected,initial_callee.number_of_LinphoneCallConnected+1)); - CU_ASSERT_TRUE(wait_for(callee_mgr->lc,caller_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallConnected,initial_callee.number_of_LinphoneCallConnected+1)); + BC_ASSERT_TRUE(wait_for(callee_mgr->lc,caller_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallConnected,initial_callee.number_of_LinphoneCallConnected+1)); + BC_ASSERT_TRUE(wait_for(callee_mgr->lc,caller_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallConnected,initial_callee.number_of_LinphoneCallConnected+1)); /*just to sleep*/ result = wait_for(callee_mgr->lc,caller_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallStreamsRunning,initial_caller.number_of_LinphoneCallStreamsRunning+1) && @@ -298,9 +298,9 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr wait_for(callee_mgr->lc,caller_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallEncryptedOn,initial_callee.number_of_LinphoneCallEncryptedOn+1); { const LinphoneCallParams* call_param = linphone_call_get_current_params(callee_call); - CU_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller_mgr->lc)); + BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller_mgr->lc), int, "%d"); call_param = linphone_call_get_current_params(linphone_core_get_current_call(caller_mgr->lc)); - CU_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller_mgr->lc)); + BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller_mgr->lc), int, "%d"); } } @@ -334,10 +334,10 @@ bool_t call(LinphoneCoreManager* caller_mgr,LinphoneCoreManager* callee_mgr){ void end_call(LinphoneCoreManager *m1, LinphoneCoreManager *m2){ linphone_core_terminate_all_calls(m1->lc); - CU_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m1->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m2->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m1->stat.number_of_LinphoneCallReleased,1)); - CU_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m2->stat.number_of_LinphoneCallReleased,1)); + BC_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m1->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m2->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m1->stat.number_of_LinphoneCallReleased,1)); + BC_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m2->stat.number_of_LinphoneCallReleased,1)); } void simple_call_base(bool_t enable_multicast_recv_side) { @@ -375,18 +375,18 @@ void simple_call_base(bool_t enable_multicast_recv_side) { linphone_core_enable_audio_multicast(pauline->lc,enable_multicast_recv_side); - CU_ASSERT_TRUE(call(marie,pauline)); + BC_ASSERT_TRUE(call(marie,pauline)); pauline_call=linphone_core_get_current_call(pauline->lc); - CU_ASSERT_PTR_NOT_NULL(pauline_call); + BC_ASSERT_PTR_NOT_NULL(pauline_call); /*check that display name is correctly propagated in From */ if (pauline_call){ from=linphone_call_get_remote_address(linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_PTR_NOT_NULL(from); + BC_ASSERT_PTR_NOT_NULL(from); if (from){ const char *dname=linphone_address_get_display_name(from); - CU_ASSERT_PTR_NOT_NULL(dname); + BC_ASSERT_PTR_NOT_NULL(dname); if (dname){ - CU_ASSERT_STRING_EQUAL(dname, "Super Marie"); + BC_ASSERT_STRING_EQUAL(dname, "Super Marie"); } } } @@ -398,7 +398,7 @@ void simple_call_base(bool_t enable_multicast_recv_side) { linphone_core_manager_destroy(pauline); leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } @@ -420,7 +420,7 @@ static void call_with_timeouted_bye(void) { marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new( "pauline_rc"); - CU_ASSERT_TRUE(call(marie,pauline)); + BC_ASSERT_TRUE(call(marie,pauline)); sal_set_send_error(pauline->lc->sal,1500); /*to trash the message without generating error*/ timer_config.T1=50; /*to have timer F = 3s*/ @@ -431,20 +431,20 @@ static void call_with_timeouted_bye(void) { belle_sip_stack_set_timer_config(sal_get_belle_sip_stack(pauline->lc->sal),&timer_config); linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallReleased,1,timer_config.T1*84)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallReleased,1,timer_config.T1*84)); sal_set_send_error(pauline->lc->sal,0); linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1,5000)); - CU_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallReleased,1,5000)); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1,5000)); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallReleased,1,5000)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } @@ -457,27 +457,27 @@ static void phone_number_normalization(void){ linphone_proxy_config_set_dial_prefix(cfg, "33"); linphone_proxy_config_normalize_number(cfg, "0952636505", result, sizeof(result)); - CU_ASSERT_STRING_EQUAL(result, "+33952636505"); + BC_ASSERT_STRING_EQUAL(result, "+33952636505"); linphone_proxy_config_normalize_number(cfg, "09 52 63 65 05", result, sizeof(result)); - CU_ASSERT_STRING_EQUAL(result, "+33952636505"); + BC_ASSERT_STRING_EQUAL(result, "+33952636505"); linphone_proxy_config_normalize_number(cfg, "09-52-63-65-05", result, sizeof(result)); - CU_ASSERT_STRING_EQUAL(result, "+33952636505"); + BC_ASSERT_STRING_EQUAL(result, "+33952636505"); linphone_proxy_config_normalize_number(cfg, "+31952636505", result, sizeof(result)); - CU_ASSERT_STRING_EQUAL(result, "+31952636505"); + BC_ASSERT_STRING_EQUAL(result, "+31952636505"); linphone_proxy_config_normalize_number(cfg, "0033952636505", result, sizeof(result)); - CU_ASSERT_STRING_EQUAL(result, "+33952636505"); + BC_ASSERT_STRING_EQUAL(result, "+33952636505"); linphone_proxy_config_normalize_number(cfg, "0033952636505", result, sizeof(result)); - CU_ASSERT_STRING_EQUAL(result, "+33952636505"); + BC_ASSERT_STRING_EQUAL(result, "+33952636505"); linphone_proxy_config_normalize_number(cfg, "toto", result, sizeof(result)); - CU_ASSERT_STRING_EQUAL(result, "toto"); + BC_ASSERT_STRING_EQUAL(result, "toto"); linphone_proxy_config_set_dial_escape_plus(cfg, TRUE); linphone_proxy_config_normalize_number(cfg, "0033952636505", result, sizeof(result)); - CU_ASSERT_STRING_EQUAL(result, "0033952636505"); + BC_ASSERT_STRING_EQUAL(result, "0033952636505"); linphone_proxy_config_normalize_number(cfg, "0952636505", result, sizeof(result)); - CU_ASSERT_STRING_EQUAL(result, "0033952636505"); + BC_ASSERT_STRING_EQUAL(result, "0033952636505"); linphone_proxy_config_normalize_number(cfg, "+34952636505", result, sizeof(result)); - CU_ASSERT_STRING_EQUAL(result, "0034952636505"); + BC_ASSERT_STRING_EQUAL(result, "0034952636505"); linphone_proxy_config_unref(cfg); linphone_core_manager_destroy(marie); @@ -498,19 +498,19 @@ static void direct_call_over_ipv6(){ linphone_core_set_default_proxy_config(marie->lc,NULL); /*wait for register in v6 mode, however sip2.linphone.org has an ipv6 address but doesn't listen to it*/ #if 0 - CU_ASSERT_TRUE(wait_for_until(pauline->lc, NULL, &pauline->stat.number_of_LinphoneRegistrationOk, 2, 2000)); - CU_ASSERT_TRUE(wait_for_until(pauline->lc, NULL, &marie->stat.number_of_LinphoneRegistrationOk, 2, 2000)); + BC_ASSERT_TRUE(wait_for_until(pauline->lc, NULL, &pauline->stat.number_of_LinphoneRegistrationOk, 2, 2000)); + BC_ASSERT_TRUE(wait_for_until(pauline->lc, NULL, &marie->stat.number_of_LinphoneRegistrationOk, 2, 2000)); #endif linphone_core_get_sip_transports_used(pauline->lc,&pauline_transports); linphone_address_set_port(pauline_dest,pauline_transports.tcp_port); linphone_core_invite_address(marie->lc,pauline_dest); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallOutgoingRinging,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallIncomingReceived,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallOutgoingRinging,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallIncomingReceived,1)); linphone_core_accept_call(pauline->lc,linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,1)); liblinphone_tester_check_rtcp(marie,pauline); end_call(marie,pauline); @@ -530,8 +530,8 @@ static void call_outbound_with_multiple_proxy() { linphone_core_get_default_proxy(marie->lc, &lpc); linphone_core_set_default_proxy(marie->lc,NULL); - CU_ASSERT_FATAL(lpc != NULL); - CU_ASSERT_FATAL(registered_lpc != NULL); + BC_ASSERT_FATAL(lpc != NULL); + BC_ASSERT_FATAL(registered_lpc != NULL); // create new LPC that will successfully register linphone_proxy_config_set_identity(registered_lpc, linphone_proxy_config_get_identity(lpc)); @@ -547,13 +547,13 @@ static void call_outbound_with_multiple_proxy() { linphone_proxy_config_set_route(lpc, "12.13.14.15:5223;transport=udp;lr"); linphone_proxy_config_done(lpc); - CU_ASSERT_TRUE(wait_for_until(pauline->lc, NULL, &pauline->stat.number_of_LinphoneRegistrationOk, 1, 2000)); + BC_ASSERT_TRUE(wait_for_until(pauline->lc, NULL, &pauline->stat.number_of_LinphoneRegistrationOk, 1, 2000)); - CU_ASSERT_TRUE(wait_for_until(marie->lc, NULL, &marie->stat.number_of_LinphoneRegistrationProgress, 2, 200)); - CU_ASSERT_TRUE(wait_for_until(marie->lc, NULL, &marie->stat.number_of_LinphoneRegistrationOk, 1, 2000)); + BC_ASSERT_TRUE(wait_for_until(marie->lc, NULL, &marie->stat.number_of_LinphoneRegistrationProgress, 2, 200)); + BC_ASSERT_TRUE(wait_for_until(marie->lc, NULL, &marie->stat.number_of_LinphoneRegistrationOk, 1, 2000)); // calling marie should go through the second proxy config - CU_ASSERT_TRUE(call(marie, pauline)); + BC_ASSERT_TRUE(call(marie, pauline)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -575,27 +575,27 @@ static void multiple_answers_call() { lcs = ms_list_append(lcs,marie2->lc); - CU_ASSERT_TRUE(wait_for_until(pauline->lc, NULL, &pauline->stat.number_of_LinphoneRegistrationOk, 1, 2000)); + BC_ASSERT_TRUE(wait_for_until(pauline->lc, NULL, &pauline->stat.number_of_LinphoneRegistrationOk, 1, 2000)); - CU_ASSERT_PTR_NOT_NULL( linphone_core_invite_address(pauline->lc, marie1->identity ) ); + BC_ASSERT_PTR_NOT_NULL( linphone_core_invite_address(pauline->lc, marie1->identity ) ); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallIncomingReceived, 1, 2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived, 1, 2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingProgress, 1, 2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallIncomingReceived, 1, 2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived, 1, 2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingProgress, 1, 2000)); // marie 1 and 2 answer at the same time call1 = linphone_core_get_current_call(marie1->lc); call2 = linphone_core_get_current_call(marie2->lc); - CU_ASSERT_PTR_NOT_NULL_FATAL(call1); - CU_ASSERT_PTR_NOT_NULL_FATAL(call2); + BC_ASSERT_PTR_NOT_NULL_FATAL(call1); + BC_ASSERT_PTR_NOT_NULL_FATAL(call2); - CU_ASSERT_EQUAL( linphone_core_accept_call(marie1->lc, call1), 0); - CU_ASSERT_EQUAL( linphone_core_accept_call(marie2->lc, call2), 0); + BC_ASSERT_EQUAL( linphone_core_accept_call(marie1->lc, call1), 0, int, "%d"); + BC_ASSERT_EQUAL( linphone_core_accept_call(marie2->lc, call2), 0, int, "%d"); - CU_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1, 2000) ); - CU_ASSERT_TRUE( wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallStreamsRunning, 1, 2000) ); - CU_ASSERT_TRUE( wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallEnd, 1, 2000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1, 2000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallStreamsRunning, 1, 2000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallEnd, 1, 2000) ); linphone_core_manager_destroy(pauline); @@ -623,27 +623,27 @@ static void multiple_answers_call_with_media_relay(void) { linphone_core_set_user_agent(marie1->lc, "Natted Linphone", NULL); linphone_core_set_user_agent(marie2->lc, "Natted Linphone", NULL); - CU_ASSERT_TRUE(wait_for_until(pauline->lc, NULL, &pauline->stat.number_of_LinphoneRegistrationOk, 1, 2000)); + BC_ASSERT_TRUE(wait_for_until(pauline->lc, NULL, &pauline->stat.number_of_LinphoneRegistrationOk, 1, 2000)); - CU_ASSERT_PTR_NOT_NULL( linphone_core_invite_address(pauline->lc, marie1->identity ) ); + BC_ASSERT_PTR_NOT_NULL( linphone_core_invite_address(pauline->lc, marie1->identity ) ); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallIncomingReceived, 1, 2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived, 1, 2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingProgress, 1, 2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallIncomingReceived, 1, 2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived, 1, 2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingProgress, 1, 2000)); // marie 1 and 2 answer at the same time call1 = linphone_core_get_current_call(marie1->lc); call2 = linphone_core_get_current_call(marie2->lc); - CU_ASSERT_PTR_NOT_NULL_FATAL(call1); - CU_ASSERT_PTR_NOT_NULL_FATAL(call2); + BC_ASSERT_PTR_NOT_NULL_FATAL(call1); + BC_ASSERT_PTR_NOT_NULL_FATAL(call2); - CU_ASSERT_EQUAL( linphone_core_accept_call(marie1->lc, call1), 0); - CU_ASSERT_EQUAL( linphone_core_accept_call(marie2->lc, call2), 0); + BC_ASSERT_EQUAL( linphone_core_accept_call(marie1->lc, call1), 0, int, "%d"); + BC_ASSERT_EQUAL( linphone_core_accept_call(marie2->lc, call2), 0, int, "%d"); - CU_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1, 2000) ); - CU_ASSERT_TRUE( wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallStreamsRunning, 1, 2000) ); - CU_ASSERT_TRUE( wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallEnd, 1, 2000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1, 2000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallStreamsRunning, 1, 2000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallEnd, 1, 2000) ); linphone_core_manager_destroy(pauline); @@ -690,13 +690,13 @@ static void call_with_specified_codec_bitrate(void) { linphone_core_find_payload_type(pauline->lc,codec,rate,-1), min_bw); - CU_ASSERT_TRUE((call_ok=call(pauline,marie))); + BC_ASSERT_TRUE((call_ok=call(pauline,marie))); if (!call_ok) goto end; liblinphone_tester_check_rtcp(marie,pauline); marie_stats=linphone_call_get_audio_stats(linphone_core_get_current_call(marie->lc)); pauline_stats=linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_TRUE(marie_stats->download_bandwidth<(min_bw+5+min_bw*.1)); - CU_ASSERT_TRUE(pauline_stats->download_bandwidth>(max_bw-5-max_bw*.1)); + BC_ASSERT_TRUE(marie_stats->download_bandwidth<(min_bw+5+min_bw*.1)); + BC_ASSERT_TRUE(pauline_stats->download_bandwidth>(max_bw-5-max_bw*.1)); end: linphone_core_manager_destroy(marie); @@ -719,7 +719,7 @@ static void simple_call_compatibility_mode(void) { LCSipTransports transport; linphone_core_get_default_proxy(lc_marie,&proxy); - CU_ASSERT_PTR_NOT_NULL (proxy); + BC_ASSERT_PTR_NOT_NULL (proxy); identity = linphone_address_new(linphone_proxy_config_get_identity(proxy)); @@ -739,31 +739,31 @@ static void simple_call_compatibility_mode(void) { linphone_core_set_sip_transports(lc_marie,&transport); stat_marie->number_of_LinphoneRegistrationOk=0; - CU_ASSERT_TRUE (wait_for(lc_marie,lc_marie,&stat_marie->number_of_LinphoneRegistrationOk,1)); + BC_ASSERT_TRUE (wait_for(lc_marie,lc_marie,&stat_marie->number_of_LinphoneRegistrationOk,1)); linphone_core_invite_address(lc_marie,pauline->identity); - CU_ASSERT_TRUE (wait_for(lc_pauline,lc_marie,&stat_pauline->number_of_LinphoneCallIncomingReceived,1)); - CU_ASSERT_TRUE(linphone_core_inc_invite_pending(lc_pauline)); - CU_ASSERT_EQUAL(stat_marie->number_of_LinphoneCallOutgoingProgress,1); - CU_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_marie->number_of_LinphoneCallOutgoingRinging,1)); + BC_ASSERT_TRUE (wait_for(lc_pauline,lc_marie,&stat_pauline->number_of_LinphoneCallIncomingReceived,1)); + BC_ASSERT_TRUE(linphone_core_inc_invite_pending(lc_pauline)); + BC_ASSERT_EQUAL(stat_marie->number_of_LinphoneCallOutgoingProgress,1, int, "%d"); + BC_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_marie->number_of_LinphoneCallOutgoingRinging,1)); - CU_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call_remote_address(lc_pauline)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call_remote_address(lc_pauline)); if (linphone_core_get_current_call_remote_address(lc_pauline)) { - CU_ASSERT_TRUE(linphone_address_weak_equal(identity,linphone_core_get_current_call_remote_address(lc_pauline))); + BC_ASSERT_TRUE(linphone_address_weak_equal(identity,linphone_core_get_current_call_remote_address(lc_pauline))); linphone_address_destroy(identity); linphone_core_accept_call(lc_pauline,linphone_core_get_current_call(lc_pauline)); - CU_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_pauline->number_of_LinphoneCallConnected,1)); - CU_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_marie->number_of_LinphoneCallConnected,1)); - CU_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_pauline->number_of_LinphoneCallStreamsRunning,1)); - CU_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_marie->number_of_LinphoneCallStreamsRunning,1)); + BC_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_pauline->number_of_LinphoneCallConnected,1)); + BC_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_marie->number_of_LinphoneCallConnected,1)); + BC_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_pauline->number_of_LinphoneCallStreamsRunning,1)); + BC_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_marie->number_of_LinphoneCallStreamsRunning,1)); /*just to sleep*/ wait_for(lc_pauline,lc_marie,&stat_marie->number_of_LinphoneCallStreamsRunning,3); linphone_core_terminate_all_calls(lc_pauline); - CU_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_pauline->number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_marie->number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_pauline->number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_marie->number_of_LinphoneCallEnd,1)); } linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -776,14 +776,14 @@ static void cancelled_call(void) { LinphoneCall* out_call = linphone_core_invite_address(pauline->lc,marie->identity); linphone_call_ref(out_call); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1)); linphone_core_terminate_call(pauline->lc,out_call); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - //CU_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonCanceled); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallEnd,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallIncomingReceived,0); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallReleased,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + //BC_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonCanceled, int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallEnd,1, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallIncomingReceived,0, int, "%d"); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallReleased,1)); linphone_call_unref(out_call); linphone_core_manager_destroy(marie); @@ -799,7 +799,7 @@ void disable_all_audio_codecs_except_one(LinphoneCore *lc, const char *mime, int linphone_core_enable_payload_type(lc,pt,FALSE); } pt=linphone_core_find_payload_type(lc,mime,rate,-1); - CU_ASSERT_PTR_NOT_NULL_FATAL(pt); + BC_ASSERT_PTR_NOT_NULL_FATAL(pt); linphone_core_enable_payload_type(lc,pt,TRUE); } @@ -812,7 +812,8 @@ void disable_all_video_codecs_except_one(LinphoneCore *lc, const char *mime) { for(it = codecs; it != NULL; it = it->next) { linphone_core_enable_payload_type(lc, (PayloadType *)it->data, FALSE); } - CU_ASSERT_PTR_NOT_NULL_FATAL(pt = linphone_core_find_payload_type(lc, mime, -1, -1)); + pt = linphone_core_find_payload_type(lc, mime, -1, -1); + BC_ASSERT_PTR_NOT_NULL_FATAL(pt); linphone_core_enable_payload_type(lc, pt, TRUE); } #endif @@ -830,10 +831,10 @@ static void call_with_dns_time_out(void) { ms_usleep(200000); linphone_core_iterate(marie->lc); } - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallOutgoingInit,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallOutgoingProgress,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallError,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallReleased,1); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallOutgoingInit,1, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallOutgoingProgress,1, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallError,1, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallReleased,1, int, "%d"); linphone_core_manager_destroy(marie); } @@ -843,21 +844,21 @@ static void early_cancelled_call(void) { LinphoneCall* out_call = linphone_core_invite_address(pauline->lc,marie->identity); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1)); linphone_core_terminate_call(pauline->lc,out_call); /*since everything is executed in a row, no response can be received from the server, thus the CANCEL cannot be sent. It will ring at Marie's side.*/ - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallEnd,1); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallEnd,1, int, "%d"); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallIncomingReceived,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallIncomingReceived,1)); /* now the CANCEL should have been sent and the the call at marie's side should terminate*/ - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallReleased,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallReleased,1)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -869,13 +870,13 @@ static void cancelled_ringing_call(void) { LinphoneCall* out_call = linphone_core_invite_address(pauline->lc,marie->identity); linphone_call_ref(out_call); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallIncomingReceived,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallIncomingReceived,1)); linphone_core_terminate_call(pauline->lc,out_call); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallReleased,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallReleased,1)); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallEnd,1); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallEnd,1); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallReleased,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallReleased,1)); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallEnd,1, int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallEnd,1, int, "%d"); linphone_call_unref(out_call); linphone_core_manager_destroy(marie); @@ -893,15 +894,15 @@ static void early_declined_call(void) { linphone_call_ref(out_call); /*wait until flexisip transfers the busy...*/ - CU_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1,33000)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallError,1); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1,33000)); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallError,1, int, "%d"); /* FIXME http://git.linphone.org/mantis/view.php?id=757 - CU_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonBusy); + BC_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonBusy, int, "%d"); */ if (ms_list_size(linphone_core_get_call_logs(pauline->lc))>0) { - CU_ASSERT_PTR_NOT_NULL(out_call_log=(LinphoneCallLog*)(linphone_core_get_call_logs(pauline->lc)->data)); - CU_ASSERT_EQUAL(linphone_call_log_get_status(out_call_log),LinphoneCallAborted); + BC_ASSERT_PTR_NOT_NULL(out_call_log=(LinphoneCallLog*)(linphone_core_get_call_logs(pauline->lc)->data)); + BC_ASSERT_EQUAL(linphone_call_log_get_status(out_call_log),LinphoneCallAborted, int, "%d"); } linphone_call_unref(out_call); linphone_core_manager_destroy(marie); @@ -914,10 +915,10 @@ static void call_busy_when_calling_self(void) { linphone_call_ref(out_call); /*wait until flexisip transfers the busy...*/ - CU_ASSERT_TRUE(wait_for_until(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCallError,1,33000)); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallError,1); + BC_ASSERT_TRUE(wait_for_until(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCallError,1,33000)); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallError,1, int, "%d"); - CU_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonBusy); + BC_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonBusy, int, "%d"); linphone_call_unref(out_call); linphone_core_manager_destroy(marie); } @@ -930,17 +931,17 @@ static void call_declined(void) { LinphoneCall* in_call; LinphoneCall* out_call = linphone_core_invite_address(pauline->lc,marie->identity); linphone_call_ref(out_call); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallIncomingReceived,1)); - CU_ASSERT_PTR_NOT_NULL(in_call=linphone_core_get_current_call(marie->lc)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallIncomingReceived,1)); + BC_ASSERT_PTR_NOT_NULL(in_call=linphone_core_get_current_call(marie->lc)); if (in_call) { linphone_call_ref(in_call); linphone_core_terminate_call(marie->lc,in_call); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallReleased,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallReleased,1)); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallEnd,1); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallEnd,1); - CU_ASSERT_EQUAL(linphone_call_get_reason(in_call),LinphoneReasonDeclined); - CU_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonDeclined); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallReleased,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallReleased,1)); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallEnd,1, int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallEnd,1, int, "%d"); + BC_ASSERT_EQUAL(linphone_call_get_reason(in_call),LinphoneReasonDeclined, int, "%d"); + BC_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonDeclined, int, "%d"); linphone_call_unref(in_call); } linphone_call_unref(out_call); @@ -952,11 +953,11 @@ static void call_terminated_by_caller(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); - CU_ASSERT_TRUE(call(pauline,marie)); + BC_ASSERT_TRUE(call(pauline,marie)); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -968,11 +969,11 @@ static void call_with_no_sdp(void) { linphone_core_enable_sdp_200_ack(marie->lc,TRUE); - CU_ASSERT_TRUE(call(marie,pauline)); + BC_ASSERT_TRUE(call(marie,pauline)); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -986,13 +987,13 @@ static void call_with_no_sdp_ack_without_sdp(void){ linphone_core_enable_sdp_200_ack(marie->lc,TRUE); linphone_core_invite_address(marie->lc,pauline->identity); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallIncomingReceived,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallIncomingReceived,1)); call=linphone_core_get_current_call(pauline->lc); if (call){ sal_call_set_sdp_handling(call->op, SalOpSDPSimulateError); /*this will have the effect that the SDP received in the ACK will be ignored*/ linphone_core_accept_call(pauline->lc, call); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); } linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -1009,13 +1010,13 @@ static bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee c1=linphone_core_get_current_call(caller->lc); c2=linphone_core_get_current_call(callee->lc); - CU_ASSERT_PTR_NOT_NULL(c1); - CU_ASSERT_PTR_NOT_NULL(c2); + BC_ASSERT_PTR_NOT_NULL(c1); + BC_ASSERT_PTR_NOT_NULL(c2); if (!c1 || !c2) return FALSE; linphone_call_ref(c1); linphone_call_ref(c2); - CU_ASSERT_EQUAL(linphone_call_params_video_enabled(linphone_call_get_current_params(c1)),linphone_call_params_video_enabled(linphone_call_get_current_params(c2))); + BC_ASSERT_EQUAL(linphone_call_params_video_enabled(linphone_call_get_current_params(c1)),linphone_call_params_video_enabled(linphone_call_get_current_params(c2)), int, "%d"); video_enabled=linphone_call_params_video_enabled(linphone_call_get_current_params(c1)); liblinphone_tester_clock_start(&ts); do{ @@ -1050,11 +1051,11 @@ static bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee /*make sure encryption mode are preserved*/ if (c1) { const LinphoneCallParams* call_param = linphone_call_get_current_params(c1); - CU_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller->lc)); + BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller->lc), int, "%d"); } if (c2) { const LinphoneCallParams* call_param = linphone_call_get_current_params(c2); - CU_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(callee->lc)); + BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(callee->lc), int, "%d"); } linphone_call_unref(c1); linphone_call_unref(c2); @@ -1078,23 +1079,23 @@ static void _call_with_ice_base(LinphoneCoreManager* pauline,LinphoneCoreManager linphone_core_set_video_port(pauline->lc,-1); } - CU_ASSERT_TRUE((call_ok=call(pauline,marie))); + BC_ASSERT_TRUE((call_ok=call(pauline,marie))); if (!call_ok) goto end; if (callee_with_ice && caller_with_ice) { /*wait for the ICE reINVITE to complete*/ - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); - CU_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection)); + BC_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection)); } liblinphone_tester_check_rtcp(marie,pauline); /*then close the call*/ linphone_core_terminate_all_calls(pauline->lc); end: - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); } static void _call_with_ice(bool_t caller_with_ice, bool_t callee_with_ice, bool_t random_ports) { @@ -1163,22 +1164,22 @@ static void call_with_custom_headers(void) { linphone_call_params_add_custom_header(params,"Weather","bad"); linphone_call_params_add_custom_header(params,"Working","yes"); - CU_ASSERT_TRUE(call_with_caller_params(pauline,marie,params)); + BC_ASSERT_TRUE(call_with_caller_params(pauline,marie,params)); linphone_call_params_destroy(params); call_marie=linphone_core_get_current_call(marie->lc); call_pauline=linphone_core_get_current_call(pauline->lc); - CU_ASSERT_PTR_NOT_NULL(call_marie); - CU_ASSERT_PTR_NOT_NULL(call_pauline); + BC_ASSERT_PTR_NOT_NULL(call_marie); + BC_ASSERT_PTR_NOT_NULL(call_pauline); marie_remote_params=linphone_call_get_remote_params(call_marie); hvalue=linphone_call_params_get_custom_header(marie_remote_params,"Weather"); - CU_ASSERT_PTR_NOT_NULL(hvalue); - CU_ASSERT_STRING_EQUAL(hvalue,"bad"); + BC_ASSERT_PTR_NOT_NULL(hvalue); + BC_ASSERT_STRING_EQUAL(hvalue,"bad"); hvalue=linphone_call_params_get_custom_header(marie_remote_params,"uriHeader"); - CU_ASSERT_PTR_NOT_NULL(hvalue); - CU_ASSERT_STRING_EQUAL(hvalue,"myUriHeader"); + BC_ASSERT_PTR_NOT_NULL(hvalue); + BC_ASSERT_STRING_EQUAL(hvalue,"myUriHeader"); // FIXME: we have to strdup because successive calls to get_remote_params erase the returned const char*!! @@ -1188,12 +1189,12 @@ static void call_with_custom_headers(void) { marie_remote_contact = ms_strdup(linphone_call_get_remote_contact(call_marie)); marie_remote_contact_header = ms_strdup(linphone_call_params_get_custom_header(linphone_call_get_remote_params(call_marie), "Contact")); - CU_ASSERT_PTR_NOT_NULL(pauline_remote_contact); - CU_ASSERT_PTR_NOT_NULL(pauline_remote_contact_header); - CU_ASSERT_PTR_NOT_NULL(marie_remote_contact); - CU_ASSERT_PTR_NOT_NULL(marie_remote_contact_header); - CU_ASSERT_STRING_EQUAL(pauline_remote_contact,pauline_remote_contact_header); - CU_ASSERT_STRING_EQUAL(marie_remote_contact,marie_remote_contact_header); + BC_ASSERT_PTR_NOT_NULL(pauline_remote_contact); + BC_ASSERT_PTR_NOT_NULL(pauline_remote_contact_header); + BC_ASSERT_PTR_NOT_NULL(marie_remote_contact); + BC_ASSERT_PTR_NOT_NULL(marie_remote_contact_header); + BC_ASSERT_STRING_EQUAL(pauline_remote_contact,pauline_remote_contact_header); + BC_ASSERT_STRING_EQUAL(marie_remote_contact,marie_remote_contact_header); ms_free(pauline_remote_contact); ms_free(pauline_remote_contact_header); @@ -1203,8 +1204,8 @@ static void call_with_custom_headers(void) { /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -1219,7 +1220,7 @@ void call_paused_resumed_base(bool_t multicast) { linphone_core_enable_audio_multicast(pauline->lc,multicast); - CU_ASSERT_TRUE((call_ok=call(pauline,marie))); + BC_ASSERT_TRUE((call_ok=call(pauline,marie))); if (!call_ok) goto end; @@ -1228,28 +1229,28 @@ void call_paused_resumed_base(bool_t multicast) { wait_for_until(pauline->lc, marie->lc, NULL, 5, 3000); linphone_core_pause_call(pauline->lc,call_pauline); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausing,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPaused,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausing,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPaused,1)); /*stay in pause a little while in order to generate traffic*/ wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000); linphone_core_resume_call(pauline->lc,call_pauline); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); /*same here: wait a while for a bit of a traffic, we need to receive a RTCP packet*/ wait_for_until(pauline->lc, marie->lc, NULL, 5, 5000); /*since RTCP streams are reset when call is paused/resumed, there should be no loss at all*/ stats = rtp_session_get_stats(call_pauline->sessions->rtp_session); - CU_ASSERT_EQUAL(stats->cum_packet_loss, 0); + BC_ASSERT_EQUAL(stats->cum_packet_loss, 0, int, "%d"); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); end: linphone_core_manager_destroy(marie); @@ -1261,11 +1262,11 @@ static void call_paused_resumed(void) { #define CHECK_CURRENT_LOSS_RATE() \ rtcp_count_current = pauline->stat.number_of_rtcp_sent; \ /*wait for an RTCP packet to have an accurate cumulative lost value*/ \ - CU_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &pauline->stat.number_of_rtcp_sent, rtcp_count_current+1, 10000)); \ + BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &pauline->stat.number_of_rtcp_sent, rtcp_count_current+1, 10000)); \ stats = rtp_session_get_stats(call_pauline->audiostream->ms.sessions.rtp_session); \ loss_percentage = stats->cum_packet_loss * 100.f / (stats->packet_recv + stats->cum_packet_loss); \ - CU_ASSERT_TRUE(.75 * params.loss_rate < loss_percentage); \ - CU_ASSERT_TRUE(loss_percentage < 1.25 * params.loss_rate) + BC_ASSERT_TRUE(.75 * params.loss_rate < loss_percentage); \ + BC_ASSERT_TRUE(loss_percentage < 1.25 * params.loss_rate) static void call_paused_resumed_with_loss(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); @@ -1279,7 +1280,7 @@ static void call_paused_resumed_with_loss(void) { params.enabled=TRUE; params.loss_rate=20; - CU_ASSERT_TRUE(call(pauline,marie)); + BC_ASSERT_TRUE(call(pauline,marie)); call_pauline = linphone_core_get_current_call(pauline->lc); if (call_pauline){ rtp_session_enable_network_simulation(call_pauline->audiostream->ms.sessions.rtp_session,¶ms); @@ -1290,25 +1291,25 @@ static void call_paused_resumed_with_loss(void) { /*pause call*/ linphone_core_pause_call(pauline->lc,call_pauline); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausing,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPaused,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausing,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPaused,1)); /*stay in pause a little while in order to generate traffic*/ wait_for_until(pauline->lc, marie->lc, NULL, 5, 5000); CHECK_CURRENT_LOSS_RATE(); /*resume*/ linphone_core_resume_call(pauline->lc,call_pauline); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); wait_for_until(pauline->lc, marie->lc, NULL, 5, 6000); /*since stats are NOT totally reset during pause, the stats->packet_recv is computed from the start of call. This test ensures that the loss rate is consistent during the entire call.*/ CHECK_CURRENT_LOSS_RATE(); linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); } linphone_core_manager_destroy(marie); @@ -1319,11 +1320,11 @@ bool_t pause_call_1(LinphoneCoreManager* mgr_1,LinphoneCall* call_1,LinphoneCore stats initial_call_stat_1=mgr_1->stat; stats initial_call_stat_2=mgr_2->stat; linphone_core_pause_call(mgr_1->lc,call_1); - CU_ASSERT_TRUE(wait_for(mgr_1->lc,mgr_2->lc,&mgr_1->stat.number_of_LinphoneCallPausing,initial_call_stat_1.number_of_LinphoneCallPausing+1)); - CU_ASSERT_TRUE(wait_for(mgr_1->lc,mgr_2->lc,&mgr_1->stat.number_of_LinphoneCallPaused,initial_call_stat_1.number_of_LinphoneCallPaused+1)); - CU_ASSERT_TRUE(wait_for(mgr_1->lc,mgr_2->lc,&mgr_2->stat.number_of_LinphoneCallPausedByRemote,initial_call_stat_2.number_of_LinphoneCallPausedByRemote+1)); - CU_ASSERT_EQUAL(linphone_call_get_state(call_1),LinphoneCallPaused); - CU_ASSERT_EQUAL(linphone_call_get_state(call_2),LinphoneCallPausedByRemote); + BC_ASSERT_TRUE(wait_for(mgr_1->lc,mgr_2->lc,&mgr_1->stat.number_of_LinphoneCallPausing,initial_call_stat_1.number_of_LinphoneCallPausing+1)); + BC_ASSERT_TRUE(wait_for(mgr_1->lc,mgr_2->lc,&mgr_1->stat.number_of_LinphoneCallPaused,initial_call_stat_1.number_of_LinphoneCallPaused+1)); + BC_ASSERT_TRUE(wait_for(mgr_1->lc,mgr_2->lc,&mgr_2->stat.number_of_LinphoneCallPausedByRemote,initial_call_stat_2.number_of_LinphoneCallPausedByRemote+1)); + BC_ASSERT_EQUAL(linphone_call_get_state(call_1),LinphoneCallPaused, int, "%d"); + BC_ASSERT_EQUAL(linphone_call_get_state(call_2),LinphoneCallPausedByRemote, int, "%d"); return linphone_call_get_state(call_1) == LinphoneCallPaused && linphone_call_get_state(call_2)==LinphoneCallPausedByRemote; } #if 0 @@ -1334,37 +1335,37 @@ void concurrent_paused_resumed_base() { const rtp_stats_t * stats; - CU_ASSERT_TRUE(call(pauline,marie)); + BC_ASSERT_TRUE(call(pauline,marie)); call_pauline = linphone_core_get_current_call(pauline->lc); call_marie = linphone_core_get_current_call(marie->lc); linphone_core_pause_call(pauline->lc,call_pauline); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausing,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausing,1)); linphone_core_pause_call(marie->lc,call_marie); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPaused,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPaused,1)); /*stay in pause a little while in order to generate traffic*/ wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000); linphone_core_resume_call(pauline->lc,call_pauline); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); /*same here: wait a while for a bit of a traffic, we need to receive a RTCP packet*/ wait_for_until(pauline->lc, marie->lc, NULL, 5, 5000); /*since RTCP streams are reset when call is paused/resumed, there should be no loss at all*/ stats = rtp_session_get_stats(call_pauline->sessions->rtp_session); - CU_ASSERT_EQUAL(stats->cum_packet_loss, 0); + BC_ASSERT_EQUAL(stats->cum_packet_loss, 0, int, "%d"); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); linphone_core_manager_destroy(marie); @@ -1378,32 +1379,32 @@ static void call_paused_resumed_from_callee(void) { const rtp_stats_t * stats; bool_t call_ok; - CU_ASSERT_TRUE((call_ok=call(pauline,marie))); + BC_ASSERT_TRUE((call_ok=call(pauline,marie))); if (!call_ok) goto end; call_marie = linphone_core_get_current_call(marie->lc); linphone_core_pause_call(marie->lc,call_marie); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausing,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausedByRemote,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPaused,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausing,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausedByRemote,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPaused,1)); /*stay in pause a little while in order to generate traffic*/ wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000); linphone_core_resume_call(marie->lc,call_marie); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); /*same here: wait a while for a bit of a traffic, we need to receive a RTCP packet*/ wait_for_until(pauline->lc, marie->lc, NULL, 5, 5000); /*since RTCP streams are reset when call is paused/resumed, there should be no loss at all*/ stats = rtp_session_get_stats(call_marie->sessions->rtp_session); - CU_ASSERT_EQUAL(stats->cum_packet_loss, 0); + BC_ASSERT_EQUAL(stats->cum_packet_loss, 0, int, "%d"); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -1421,12 +1422,12 @@ static void audio_call_with_ice_no_matching_audio_codecs(void) { out_call = linphone_core_invite_address(marie->lc, pauline->identity); linphone_call_ref(out_call); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingInit, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingInit, 1)); /* flexisip will retain the 488 until the "urgent reply" timeout arrives. */ - CU_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallError, 1, 6000)); - CU_ASSERT_EQUAL(linphone_call_get_reason(out_call), LinphoneReasonNotAcceptable); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallIncomingReceived, 0); + BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallError, 1, 6000)); + BC_ASSERT_EQUAL(linphone_call_get_reason(out_call), LinphoneReasonNotAcceptable, int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallIncomingReceived, 0, int, "%d"); linphone_call_unref(out_call); linphone_core_manager_destroy(marie); @@ -1470,18 +1471,18 @@ bool_t add_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee, bool_t const LinphoneVideoPolicy *video_policy; LinphoneCall *call_obj; if ((call_obj=setup_video(caller, callee, change_video_policy))){ - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallUpdatedByRemote,initial_caller_stat.number_of_LinphoneCallUpdatedByRemote+1)); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallUpdating,initial_callee_stat.number_of_LinphoneCallUpdating+1)); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallStreamsRunning,initial_callee_stat.number_of_LinphoneCallStreamsRunning+1)); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallStreamsRunning,initial_caller_stat.number_of_LinphoneCallStreamsRunning+1)); + BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallUpdatedByRemote,initial_caller_stat.number_of_LinphoneCallUpdatedByRemote+1)); + BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallUpdating,initial_callee_stat.number_of_LinphoneCallUpdating+1)); + BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallStreamsRunning,initial_callee_stat.number_of_LinphoneCallStreamsRunning+1)); + BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallStreamsRunning,initial_caller_stat.number_of_LinphoneCallStreamsRunning+1)); video_policy = linphone_core_get_video_policy(caller->lc); if (video_policy->automatically_accept) { - CU_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc)))); - CU_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc)))); + BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc)))); + BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc)))); } else { - CU_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc)))); - CU_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc)))); + BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc)))); + BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc)))); } if (linphone_core_get_media_encryption(caller->lc) != LinphoneMediaEncryptionNone && linphone_core_get_media_encryption(callee->lc) != LinphoneMediaEncryptionNone) { @@ -1508,9 +1509,9 @@ bool_t add_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee, bool_t } call_param = linphone_call_get_current_params(linphone_core_get_current_call(callee->lc)); - CU_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller->lc)); + BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller->lc), int, "%d"); call_param = linphone_call_get_current_params(linphone_core_get_current_call(caller->lc)); - CU_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller->lc)); + BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller->lc), int, "%d"); } @@ -1547,13 +1548,13 @@ static bool_t remove_video(LinphoneCoreManager *caller, LinphoneCoreManager *cal linphone_call_params_enable_video(callee_params, FALSE); linphone_core_update_call(callee->lc, call_obj, callee_params); - CU_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallUpdatedByRemote, initial_caller_stat.number_of_LinphoneCallUpdatedByRemote + 1)); - CU_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &callee->stat.number_of_LinphoneCallUpdating, initial_callee_stat.number_of_LinphoneCallUpdating + 1)); - CU_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &callee->stat.number_of_LinphoneCallStreamsRunning, initial_callee_stat.number_of_LinphoneCallStreamsRunning + 1)); - CU_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallStreamsRunning, initial_caller_stat.number_of_LinphoneCallStreamsRunning + 1)); + BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallUpdatedByRemote, initial_caller_stat.number_of_LinphoneCallUpdatedByRemote + 1)); + BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &callee->stat.number_of_LinphoneCallUpdating, initial_callee_stat.number_of_LinphoneCallUpdating + 1)); + BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &callee->stat.number_of_LinphoneCallStreamsRunning, initial_callee_stat.number_of_LinphoneCallStreamsRunning + 1)); + BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallStreamsRunning, initial_caller_stat.number_of_LinphoneCallStreamsRunning + 1)); - CU_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc)))); - CU_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc)))); + BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc)))); + BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc)))); return TRUE; } @@ -1565,14 +1566,14 @@ static void call_with_video_added(void) { LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); bool_t call_ok; - CU_ASSERT_TRUE((call_ok=call(pauline,marie))); + BC_ASSERT_TRUE((call_ok=call(pauline,marie))); if (!call_ok) goto end; - CU_ASSERT_TRUE(add_video(pauline,marie, TRUE)); + BC_ASSERT_TRUE(add_video(pauline,marie, TRUE)); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); end: linphone_core_manager_destroy(marie); @@ -1592,14 +1593,14 @@ static void call_with_video_added_2(void) { linphone_core_enable_video_capture(marie->lc, TRUE); linphone_core_enable_video_display(marie->lc, FALSE); - CU_ASSERT_TRUE(call_ok=call(pauline,marie)); + BC_ASSERT_TRUE(call_ok=call(pauline,marie)); if (!call_ok) goto end; - CU_ASSERT_TRUE(add_video(marie,pauline, TRUE)); + BC_ASSERT_TRUE(add_video(marie,pauline, TRUE)); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -1615,14 +1616,14 @@ static void call_with_video_added_random_ports(void) { linphone_core_set_audio_port(pauline->lc,-1); linphone_core_set_video_port(pauline->lc,-1); - CU_ASSERT_TRUE(call_ok=call(pauline,marie)); + BC_ASSERT_TRUE(call_ok=call(pauline,marie)); if (!call_ok) goto end; - CU_ASSERT_TRUE(add_video(pauline,marie, TRUE)); + BC_ASSERT_TRUE(add_video(pauline,marie, TRUE)); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -1633,20 +1634,20 @@ static void call_with_several_video_switches(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); bool_t call_ok; - CU_ASSERT_TRUE(call_ok=call(pauline,marie)); + BC_ASSERT_TRUE(call_ok=call(pauline,marie)); if (!call_ok) goto end; - CU_ASSERT_TRUE(add_video(pauline,marie, TRUE)); + BC_ASSERT_TRUE(add_video(pauline,marie, TRUE)); wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */ - CU_ASSERT_TRUE(remove_video(pauline,marie)); - CU_ASSERT_TRUE(add_video(pauline,marie, TRUE)); + BC_ASSERT_TRUE(remove_video(pauline,marie)); + BC_ASSERT_TRUE(add_video(pauline,marie, TRUE)); wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */ - CU_ASSERT_TRUE(remove_video(pauline,marie)); + BC_ASSERT_TRUE(remove_video(pauline,marie)); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -1662,19 +1663,19 @@ static void srtp_call_with_several_video_switches(void) { linphone_core_set_media_encryption(marie->lc, LinphoneMediaEncryptionSRTP); linphone_core_set_media_encryption(pauline->lc, LinphoneMediaEncryptionSRTP); - CU_ASSERT_TRUE(call_ok=call(pauline,marie)); + BC_ASSERT_TRUE(call_ok=call(pauline,marie)); if (!call_ok) goto end; - CU_ASSERT_TRUE(add_video(pauline,marie, TRUE)); + BC_ASSERT_TRUE(add_video(pauline,marie, TRUE)); wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */ - CU_ASSERT_TRUE(remove_video(pauline,marie)); - CU_ASSERT_TRUE(add_video(pauline,marie, TRUE)); + BC_ASSERT_TRUE(remove_video(pauline,marie)); + BC_ASSERT_TRUE(add_video(pauline,marie, TRUE)); wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */ - CU_ASSERT_TRUE(remove_video(pauline,marie)); + BC_ASSERT_TRUE(remove_video(pauline,marie)); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); } else { ms_warning("Not tested because SRTP is not available."); } @@ -1716,7 +1717,7 @@ static void call_with_declined_video_base(bool_t using_policy) { linphone_call_params_enable_video(callee_test_params.base,FALSE); } - CU_ASSERT_TRUE((call_ok=call_with_params2(pauline,marie,&caller_test_params,&callee_test_params,using_policy))); + BC_ASSERT_TRUE((call_ok=call_with_params2(pauline,marie,&caller_test_params,&callee_test_params,using_policy))); if (!call_ok) goto end; linphone_call_params_destroy(caller_test_params.base); @@ -1724,13 +1725,13 @@ static void call_with_declined_video_base(bool_t using_policy) { marie_call=linphone_core_get_current_call(marie->lc); pauline_call=linphone_core_get_current_call(pauline->lc); - CU_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(marie_call))); - CU_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(pauline_call))); + BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(marie_call))); + BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(pauline_call))); linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); end: linphone_core_manager_destroy(marie); @@ -1795,7 +1796,7 @@ static void video_call_base_2(LinphoneCoreManager* pauline,LinphoneCoreManager* linphone_call_params_enable_video(callee_test_params.base,TRUE); } - CU_ASSERT_TRUE(call_with_params2(pauline,marie,&caller_test_params,&callee_test_params,using_policy)); + BC_ASSERT_TRUE(call_with_params2(pauline,marie,&caller_test_params,&callee_test_params,using_policy)); marie_call=linphone_core_get_current_call(marie->lc); pauline_call=linphone_core_get_current_call(pauline->lc); @@ -1804,16 +1805,16 @@ static void video_call_base_2(LinphoneCoreManager* pauline,LinphoneCoreManager* if (marie_call && pauline_call ) { if (callee_video_enabled && caller_video_enabled) { - CU_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(marie_call))); - CU_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(pauline_call))); + BC_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(marie_call))); + BC_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(pauline_call))); /*check video path*/ linphone_call_set_next_video_frame_decoded_callback(marie_call,linphone_call_cb,marie->lc); linphone_call_send_vfu_request(marie_call); - CU_ASSERT_TRUE( wait_for(marie->lc,pauline->lc,&marie->stat.number_of_IframeDecoded,1)); + BC_ASSERT_TRUE( wait_for(marie->lc,pauline->lc,&marie->stat.number_of_IframeDecoded,1)); } else { - CU_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(marie_call))); - CU_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(pauline_call))); + BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(marie_call))); + BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(pauline_call))); } liblinphone_tester_check_rtcp(marie,pauline); @@ -1824,8 +1825,8 @@ static void video_call_base_2(LinphoneCoreManager* pauline,LinphoneCoreManager* static void video_call_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled) { video_call_base_2(pauline,marie,using_policy,mode,callee_video_enabled,caller_video_enabled); linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); } static void video_call(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); @@ -1920,30 +1921,30 @@ static void _call_with_ice_video(LinphoneVideoPolicy caller_policy, LinphoneVide linphone_core_set_audio_port(pauline->lc, -1); linphone_core_set_video_port(pauline->lc, -1); - CU_ASSERT_TRUE(call_ok = call(pauline, marie)); + BC_ASSERT_TRUE(call_ok = call(pauline, marie)); if (!call_ok) goto end; - CU_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection)); + BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection)); /* Wait for ICE reINVITEs to complete. */ - CU_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2) + BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2) && wait_for(pauline->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2)); if (video_added_by_caller) { - CU_ASSERT_TRUE(add_video(marie, pauline, FALSE)); + BC_ASSERT_TRUE(add_video(marie, pauline, FALSE)); } else if (video_added_by_callee) { - CU_ASSERT_TRUE(add_video(pauline, marie, FALSE)); + BC_ASSERT_TRUE(add_video(pauline, marie, FALSE)); } if (video_added_by_caller || video_added_by_callee) { - CU_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection)); + BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection)); } if (video_removed_by_caller) { - CU_ASSERT_TRUE(remove_video(marie, pauline)); + BC_ASSERT_TRUE(remove_video(marie, pauline)); } else if (video_removed_by_callee) { - CU_ASSERT_TRUE(remove_video(pauline, marie)); + BC_ASSERT_TRUE(remove_video(pauline, marie)); } if (video_removed_by_caller || video_removed_by_callee) { - CU_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection)); + BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection)); } end: @@ -1994,32 +1995,32 @@ static void video_call_with_early_media_no_matching_audio_codecs(void) { out_call = linphone_core_invite_address(marie->lc, pauline->identity); linphone_call_ref(out_call); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingInit, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallIncomingReceived, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingRinging, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingInit, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallIncomingReceived, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingRinging, 1)); pauline_call = linphone_core_get_current_call(pauline->lc); if (!pauline_call) goto end; linphone_core_accept_early_media(pauline->lc, pauline_call); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia, 1)); /*audio stream shall not have been requested to start*/ - CU_ASSERT_PTR_NULL(pauline_call->audiostream->soundread); + BC_ASSERT_PTR_NULL(pauline_call->audiostream->soundread); - CU_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(out_call))==TRUE); - CU_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(pauline_call))==TRUE); + BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(out_call))==TRUE); + BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(pauline_call))==TRUE); linphone_core_accept_call(pauline->lc, pauline_call); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1)); linphone_core_terminate_call(marie->lc, out_call); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); end: linphone_call_unref(out_call); @@ -2036,8 +2037,8 @@ static void video_call_limited_bandwidth(void) { /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -2060,18 +2061,18 @@ static void _call_with_media_relay(bool_t random_ports) { linphone_core_set_video_port(pauline->lc,-1); } - CU_ASSERT_TRUE(call_ok=call(pauline,marie)); + BC_ASSERT_TRUE(call_ok=call(pauline,marie)); if (!call_ok) goto end; liblinphone_tester_check_rtcp(pauline,marie); #ifdef VIDEO_ENABLED - CU_ASSERT_TRUE(add_video(pauline,marie, TRUE)); + BC_ASSERT_TRUE(add_video(pauline,marie, TRUE)); liblinphone_tester_check_rtcp(pauline,marie); #endif /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -2094,51 +2095,51 @@ static void call_with_privacy(void) { params=linphone_core_create_default_call_parameters(pauline->lc); linphone_call_params_set_privacy(params,LinphonePrivacyId); - CU_ASSERT_TRUE(call_with_caller_params(pauline,marie,params)); + BC_ASSERT_TRUE(call_with_caller_params(pauline,marie,params)); linphone_call_params_destroy(params); c1=linphone_core_get_current_call(pauline->lc); c2=linphone_core_get_current_call(marie->lc); - CU_ASSERT_PTR_NOT_NULL(c1); - CU_ASSERT_PTR_NOT_NULL(c2); + BC_ASSERT_PTR_NOT_NULL(c1); + BC_ASSERT_PTR_NOT_NULL(c2); if (c1 && c2){ /*make sure local identity is unchanged*/ - CU_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_log_get_from(linphone_call_get_call_log(c1)),pauline->identity)); + BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_log_get_from(linphone_call_get_call_log(c1)),pauline->identity)); /*make sure remote identity is hidden*/ - CU_ASSERT_FALSE(linphone_address_weak_equal(linphone_call_get_remote_address(c2),pauline->identity)); + BC_ASSERT_FALSE(linphone_address_weak_equal(linphone_call_get_remote_address(c2),pauline->identity)); - CU_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId); + BC_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId, int, "%d"); } /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); /*test proxy config privacy*/ linphone_core_get_default_proxy(pauline->lc,&pauline_proxy); linphone_proxy_config_set_privacy(pauline_proxy,LinphonePrivacyId); - CU_ASSERT_TRUE(call(pauline,marie)); + BC_ASSERT_TRUE(call(pauline,marie)); c1=linphone_core_get_current_call(pauline->lc); c2=linphone_core_get_current_call(marie->lc); - CU_ASSERT_PTR_NOT_NULL(c1); - CU_ASSERT_PTR_NOT_NULL(c2); + BC_ASSERT_PTR_NOT_NULL(c1); + BC_ASSERT_PTR_NOT_NULL(c2); if (c1 && c2){ /*make sure remote identity is hidden*/ - CU_ASSERT_FALSE(linphone_address_weak_equal(linphone_call_get_remote_address(c2),pauline->identity)); + BC_ASSERT_FALSE(linphone_address_weak_equal(linphone_call_get_remote_address(c2),pauline->identity)); - CU_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId); + BC_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId, int, "%d"); } /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,2)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,2)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -2159,47 +2160,47 @@ static void call_with_privacy2(void) { linphone_proxy_config_enable_register(pauline_proxy,FALSE); linphone_proxy_config_done(pauline_proxy); - CU_ASSERT_TRUE(call_with_caller_params(pauline,marie,params)); + BC_ASSERT_TRUE(call_with_caller_params(pauline,marie,params)); linphone_call_params_destroy(params); c1=linphone_core_get_current_call(pauline->lc); c2=linphone_core_get_current_call(marie->lc); - CU_ASSERT_PTR_NOT_NULL(c1); - CU_ASSERT_PTR_NOT_NULL(c2); + BC_ASSERT_PTR_NOT_NULL(c1); + BC_ASSERT_PTR_NOT_NULL(c2); if (c1 && c2){ /*make sure local identity is unchanged*/ - CU_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_log_get_from(linphone_call_get_call_log(c1)),pauline->identity)); + BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_log_get_from(linphone_call_get_call_log(c1)),pauline->identity)); /*make sure remote identity is hidden*/ - CU_ASSERT_FALSE(linphone_address_weak_equal(linphone_call_get_remote_address(c2),pauline->identity)); + BC_ASSERT_FALSE(linphone_address_weak_equal(linphone_call_get_remote_address(c2),pauline->identity)); - CU_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId); + BC_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId, int, "%d"); } /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); /*test proxy config privacy*/ linphone_proxy_config_set_privacy(pauline_proxy,LinphonePrivacyId); - CU_ASSERT_TRUE(call(pauline,marie)); + BC_ASSERT_TRUE(call(pauline,marie)); c1=linphone_core_get_current_call(pauline->lc); c2=linphone_core_get_current_call(marie->lc); - CU_ASSERT_PTR_NOT_NULL(c1); - CU_ASSERT_PTR_NOT_NULL(c2); + BC_ASSERT_PTR_NOT_NULL(c1); + BC_ASSERT_PTR_NOT_NULL(c2); if (c1 && c2){ /*make sure remote identity is hidden*/ - CU_ASSERT_FALSE(linphone_address_weak_equal(linphone_call_get_remote_address(c2),pauline->identity)); - CU_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId); + BC_ASSERT_FALSE(linphone_address_weak_equal(linphone_call_get_remote_address(c2),pauline->identity)); + BC_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId, int, "%d"); } linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,2)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,2)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -2257,11 +2258,11 @@ static void call_with_declined_srtp(void) { if (linphone_core_media_encryption_supported(marie->lc,LinphoneMediaEncryptionSRTP)) { linphone_core_set_media_encryption(pauline->lc,LinphoneMediaEncryptionSRTP); - CU_ASSERT_TRUE(call(pauline,marie)); + BC_ASSERT_TRUE(call(pauline,marie)); linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); } else { ms_warning ("not tested because srtp not available"); } @@ -2293,8 +2294,8 @@ static void call_srtp_paused_and_resumed(void) { linphone_core_pause_call(pauline->lc, pauline_call); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPaused,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPaused,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1)); linphone_core_resume_call(pauline->lc, pauline_call); if (!BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2))) goto end; @@ -2302,13 +2303,13 @@ static void call_srtp_paused_and_resumed(void) { /*assert that after pause and resume, SRTP is still being used*/ params = linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_TRUE(linphone_call_params_get_media_encryption(params) == LinphoneMediaEncryptionSRTP); + BC_ASSERT_TRUE(linphone_call_params_get_media_encryption(params) == LinphoneMediaEncryptionSRTP); params = linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)); - CU_ASSERT_TRUE(linphone_call_params_get_media_encryption(params) == LinphoneMediaEncryptionSRTP); + BC_ASSERT_TRUE(linphone_call_params_get_media_encryption(params) == LinphoneMediaEncryptionSRTP); linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -2341,31 +2342,31 @@ static void call_with_file_player(void) { linphone_core_set_play_file(pauline->lc,NULL); linphone_core_set_record_file(pauline->lc,recordpath); - CU_ASSERT_TRUE((call_ok=call(marie,pauline))); + BC_ASSERT_TRUE((call_ok=call(marie,pauline))); if (!call_ok) goto end; player=linphone_call_get_player(linphone_core_get_current_call(marie->lc)); - CU_ASSERT_PTR_NOT_NULL(player); + BC_ASSERT_PTR_NOT_NULL(player); if (player){ - CU_ASSERT_TRUE(linphone_player_open(player,hellopath,on_eof,marie)==0); - CU_ASSERT_TRUE(linphone_player_start(player)==0); + BC_ASSERT_TRUE(linphone_player_open(player,hellopath,on_eof,marie)==0); + BC_ASSERT_TRUE(linphone_player_start(player)==0); } /* This assert should be modified to be at least as long as the WAV file */ - CU_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&marie->stat.number_of_player_eof,1,10000)); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&marie->stat.number_of_player_eof,1,10000)); /*just to sleep*/ linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); /*cannot run on iphone simulator because locks main loop beyond permitted time (should run on another thread) */ #if !defined(__arm__) && !defined(__arm64__) && !TARGET_IPHONE_SIMULATOR && !defined(ANDROID) { double similar; const int threshold = 90; - BC_ASSERT_EQUAL_WITH_TYPE(ms_audio_diff(hellopath,recordpath,&similar,audio_cmp_min_overlap,NULL,NULL), 0, int, "%d"); - BC_ASSERT_GREATER_WITH_TYPE(100*similar, threshold, int, "%d"); - BC_ASSERT_LOWER_WITH_TYPE(100*similar, 100, int, "%d"); + BC_ASSERT_EQUAL(ms_audio_diff(hellopath,recordpath,&similar,audio_cmp_min_overlap,NULL,NULL), 0, int, "%d"); + BC_ASSERT_GREATER(100*similar, threshold, int, "%d"); + BC_ASSERT_LOWER(100*similar, 100, int, "%d"); if (threshold < 100*similar && 100*similar < 100) { remove(recordpath); } @@ -2420,30 +2421,30 @@ static void call_with_mkv_file_player(void) { linphone_core_set_play_file(pauline->lc,hellowav); /*just to send something but we are not testing what is sent by pauline*/ linphone_core_set_record_file(pauline->lc,recordpath); - CU_ASSERT_TRUE((call_ok=call(marie,pauline))); + BC_ASSERT_TRUE((call_ok=call(marie,pauline))); if (!call_ok) goto end; player=linphone_call_get_player(linphone_core_get_current_call(marie->lc)); - CU_ASSERT_PTR_NOT_NULL(player); + BC_ASSERT_PTR_NOT_NULL(player); if (player){ int res = linphone_player_open(player,hellomkv,on_eof,marie); if(!ms_filter_codec_supported("opus")) { - CU_ASSERT_EQUAL(res, -1); + BC_ASSERT_EQUAL(res, -1, int, "%d"); goto end; } - CU_ASSERT_EQUAL(res, 0); - CU_ASSERT_TRUE(linphone_player_start(player)==0); - CU_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&marie->stat.number_of_player_eof,1,12000)); + BC_ASSERT_EQUAL(res, 0, int, "%d"); + BC_ASSERT_TRUE(linphone_player_start(player)==0); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&marie->stat.number_of_player_eof,1,12000)); linphone_player_close(player); } /*just to sleep*/ linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); #ifdef DO_AUDIO_CMP - CU_ASSERT_TRUE(ms_audio_diff(hellowav,recordpath,&similar,audio_cmp_min_overlap,NULL,NULL)==0); - CU_ASSERT_TRUE(similar>threshold); - CU_ASSERT_TRUE(similar<=1.0); + BC_ASSERT_TRUE(ms_audio_diff(hellowav,recordpath,&similar,audio_cmp_min_overlap,NULL,NULL)==0); + BC_ASSERT_TRUE(similar>threshold); + BC_ASSERT_TRUE(similar<=1.0); if(similar>threshold && similar<=1.0) { remove(recordpath); } @@ -2483,7 +2484,7 @@ void call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enable_video linphone_core_iterate(marie->lc); ms_usleep(200000); } - CU_ASSERT_TRUE(linphone_tunnel_connected(linphone_core_get_tunnel(marie->lc))); + BC_ASSERT_TRUE(linphone_tunnel_connected(linphone_core_get_tunnel(marie->lc))); } if (linphone_core_media_encryption_supported(marie->lc,mode)) { @@ -2497,7 +2498,7 @@ void call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enable_video linphone_core_set_firewall_policy(marie->lc,policy); linphone_core_set_firewall_policy(pauline->lc,policy); - CU_ASSERT_TRUE((call_ok=call(pauline,marie))); + BC_ASSERT_TRUE((call_ok=call(pauline,marie))); if (!call_ok) goto end; if (linphone_core_get_media_encryption(pauline->lc) == LinphoneMediaEncryptionZRTP && linphone_core_get_media_encryption(pauline->lc) == LinphoneMediaEncryptionZRTP) { @@ -2508,7 +2509,7 @@ void call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enable_video && linphone_call_get_authentication_token(linphone_core_get_current_call(marie->lc))) { /*check SAS*/ - CU_ASSERT_STRING_EQUAL(linphone_call_get_authentication_token(linphone_core_get_current_call(pauline->lc)) + BC_ASSERT_STRING_EQUAL(linphone_call_get_authentication_token(linphone_core_get_current_call(pauline->lc)) ,linphone_call_get_authentication_token(linphone_core_get_current_call(marie->lc))); liblinphone_tester_check_rtcp(pauline,marie); break; @@ -2522,7 +2523,7 @@ void call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enable_video if (policy == LinphonePolicyUseIce){ int i=0; - CU_ASSERT_TRUE(check_ice(pauline,marie,enable_tunnel?LinphoneIceStateReflexiveConnection:LinphoneIceStateHostConnection)); + BC_ASSERT_TRUE(check_ice(pauline,marie,enable_tunnel?LinphoneIceStateReflexiveConnection:LinphoneIceStateHostConnection)); for (i=0;i<100;i++) { /*fixme to workaround a crash*/ ms_usleep(20000); linphone_core_iterate(marie->lc); @@ -2534,11 +2535,11 @@ void call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enable_video if (linphone_core_video_supported(marie->lc)) { add_video(pauline,marie, TRUE); if (policy == LinphonePolicyUseIce) - CU_ASSERT_TRUE(check_ice(pauline,marie,enable_tunnel?LinphoneIceStateReflexiveConnection:LinphoneIceStateHostConnection)); + BC_ASSERT_TRUE(check_ice(pauline,marie,enable_tunnel?LinphoneIceStateReflexiveConnection:LinphoneIceStateHostConnection)); liblinphone_tester_check_rtcp(marie,pauline); /*wait for ice to found the direct path*/ - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_IframeDecoded,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_IframeDecoded,1)); } else { ms_warning ("not tested because video not available"); } @@ -2548,8 +2549,8 @@ void call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enable_video /*just to sleep*/ linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); } else { ms_warning ("not tested because %s not available", linphone_media_encryption_to_string(mode)); } @@ -2590,20 +2591,20 @@ static void early_media_call(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_early_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); - CU_ASSERT_TRUE(call(pauline,marie)); + BC_ASSERT_TRUE(call(pauline,marie)); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallIncomingEarlyMedia,1); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallIncomingEarlyMedia,1, int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1, int, "%d"); wait_for_until(pauline->lc,marie->lc,NULL,0,1000); /*added because a bug related to early-media caused the Connected state to be reached two times*/ - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallConnected,1); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallConnected,1, int, "%d"); /*just to sleep*/ linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); @@ -2630,8 +2631,8 @@ static void early_media_call_with_ringing(void){ marie_call = linphone_core_invite_address(marie->lc, pauline->identity); marie_call_log = linphone_call_get_call_log(marie_call); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging,1,1000)); if (linphone_core_inc_invite_pending(pauline->lc)) { @@ -2639,18 +2640,18 @@ static void early_media_call_with_ringing(void){ linphone_core_accept_early_media(pauline->lc, linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) ); - CU_ASSERT_TRUE( wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,2000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,2000) ); liblinphone_tester_check_rtcp(marie, pauline); linphone_core_accept_call(pauline->lc, linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000)); connected_time=ms_get_cur_time_ms(); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000)); - CU_ASSERT_EQUAL(marie_call, linphone_core_get_current_call(marie->lc)); + BC_ASSERT_PTR_EQUAL(marie_call, linphone_core_get_current_call(marie->lc)); liblinphone_tester_check_rtcp(marie, pauline); /*just to have a call duration !=0*/ @@ -2658,10 +2659,10 @@ static void early_media_call_with_ringing(void){ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); ended_time=ms_get_cur_time_ms(); - CU_ASSERT_TRUE( labs((linphone_call_log_get_duration(marie_call_log)*1000) - (int64_t)(ended_time - connected_time)) <=1000 ); + BC_ASSERT_TRUE( labs((linphone_call_log_get_duration(marie_call_log)*1000) - (int64_t)(ended_time - connected_time)) <=1000 ); ms_list_free(lcs); } @@ -2688,15 +2689,15 @@ static void early_media_call_with_update_base(bool_t media_change){ marie_call = linphone_core_invite_address(marie->lc, pauline->identity); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,5000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging,1,5000)); pauline_call = linphone_core_get_current_call(pauline->lc); if (!pauline_call) goto end; /* send a 183 to initiate the early media */ linphone_core_accept_early_media(pauline->lc, pauline_call); - CU_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia,1,1000) ); - CU_ASSERT_TRUE( wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,5000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia,1,1000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,5000) ); pauline_params = linphone_call_params_copy(linphone_call_get_current_params(pauline_call)); @@ -2709,30 +2710,30 @@ static void early_media_call_with_update_base(bool_t media_change){ linphone_call_params_set_session_name(pauline_params,UPDATED_SESSION_NAME); linphone_core_update_call(pauline->lc, pauline_call, pauline_params); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallEarlyUpdating,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallEarlyUpdatedByRemote,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallEarlyUpdating,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallEarlyUpdatedByRemote,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000)); /*just to wait 2s*/ liblinphone_tester_check_rtcp(marie, pauline); - CU_ASSERT_STRING_EQUAL( linphone_call_params_get_session_name(linphone_call_get_remote_params(marie_call)) + BC_ASSERT_STRING_EQUAL( linphone_call_params_get_session_name(linphone_call_get_remote_params(marie_call)) , UPDATED_SESSION_NAME); linphone_core_accept_call(pauline->lc, linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallConnected, 1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallConnected, 1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1,1000)); liblinphone_tester_check_rtcp(marie, pauline); linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); end: @@ -2751,9 +2752,9 @@ static void early_media_call_with_codec_update(void){ static void check_call_state(LinphoneCoreManager* mgr,LinphoneCallState state) { - CU_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(mgr->lc)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(mgr->lc)); if (linphone_core_get_current_call(mgr->lc)) - CU_ASSERT_EQUAL(linphone_call_get_state(linphone_core_get_current_call(mgr->lc)),state); + BC_ASSERT_EQUAL(linphone_call_get_state(linphone_core_get_current_call(mgr->lc)),state, int, "%d"); } static void call_established_with_rejected_info(void) { @@ -2762,7 +2763,7 @@ static void call_established_with_rejected_info(void) { int dummy=0; bool_t call_ok=FALSE; - CU_ASSERT_TRUE((call_ok=call(pauline,marie))); + BC_ASSERT_TRUE((call_ok=call(pauline,marie))); if (call_ok){ sal_enable_unconditional_answer(marie->lc->sal,TRUE); @@ -2773,16 +2774,16 @@ static void call_established_with_rejected_info(void) { sal_enable_unconditional_answer(marie->lc->sal,FALSE); linphone_call_send_info_message(linphone_core_get_current_call(pauline->lc),linphone_core_create_info_message(pauline->lc)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_inforeceived,1)); - CU_ASSERT_EQUAL(marie->stat.number_of_inforeceived,1); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_inforeceived,1)); + BC_ASSERT_EQUAL(marie->stat.number_of_inforeceived,1, int, "%d"); check_call_state(pauline,LinphoneCallStreamsRunning); check_call_state(marie,LinphoneCallStreamsRunning); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); } linphone_core_manager_destroy(marie); @@ -2795,7 +2796,7 @@ static void call_established_with_rejected_reinvite(void) { LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); bool_t call_ok=FALSE; - CU_ASSERT_TRUE(call_ok=call(pauline,marie)); + BC_ASSERT_TRUE(call_ok=call(pauline,marie)); if (call_ok){ linphone_core_enable_payload_type(pauline->lc,linphone_core_find_payload_type(pauline->lc,"PCMU",8000,1),FALSE); /*disable PCMU*/ linphone_core_enable_payload_type(pauline->lc,linphone_core_find_payload_type(pauline->lc,"PCMA",8000,1),TRUE); /*enable PCMA*/ @@ -2806,18 +2807,18 @@ static void call_established_with_rejected_reinvite(void) { ,linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); - CU_ASSERT_EQUAL(linphone_call_get_reason(linphone_core_get_current_call(pauline->lc)),LinphoneReasonNotAcceptable); + BC_ASSERT_EQUAL(linphone_call_get_reason(linphone_core_get_current_call(pauline->lc)),LinphoneReasonNotAcceptable, int, "%d"); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallStreamsRunning,1); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallStreamsRunning,1, int, "%d"); check_call_state(pauline,LinphoneCallStreamsRunning); check_call_state(marie,LinphoneCallStreamsRunning); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); } linphone_core_manager_destroy(marie); @@ -2829,7 +2830,7 @@ static void call_established_with_rejected_incoming_reinvite(void) { LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); bool_t call_ok=FALSE; - CU_ASSERT_TRUE((call_ok=call(pauline,marie))); + BC_ASSERT_TRUE((call_ok=call(pauline,marie))); if (call_ok){ @@ -2844,19 +2845,19 @@ static void call_established_with_rejected_incoming_reinvite(void) { ,linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdating,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdating,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); - CU_ASSERT_EQUAL(linphone_call_get_reason(linphone_core_get_current_call(marie->lc)),LinphoneReasonNotAcceptable); + BC_ASSERT_EQUAL(linphone_call_get_reason(linphone_core_get_current_call(marie->lc)),LinphoneReasonNotAcceptable, int, "%d"); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallStreamsRunning,1); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallStreamsRunning,1, int, "%d"); check_call_state(pauline,LinphoneCallStreamsRunning); check_call_state(marie,LinphoneCallStreamsRunning); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); } linphone_core_manager_destroy(marie); @@ -2880,7 +2881,7 @@ static void call_redirect(void){ marie_call = linphone_core_invite_address(marie->lc, pauline->identity); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,6000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,6000)); if (linphone_core_get_current_call(pauline->lc)){ margaux_url = linphone_address_as_string(laure->identity); @@ -2888,25 +2889,25 @@ static void call_redirect(void){ ms_free(margaux_url); /* laure should be ringing now */ - CU_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneCallIncomingReceived,1,6000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneCallIncomingReceived,1,6000)); /* pauline should have ended the call */ - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallEnd,1,1000)); /* the call should still be ringing on marie's side */ - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging, 1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging, 1,1000)); linphone_core_accept_call(laure->lc, linphone_core_get_current_call(laure->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneCallStreamsRunning, 1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneCallStreamsRunning, 1,1000)); - CU_ASSERT_EQUAL(marie_call, linphone_core_get_current_call(marie->lc)); + BC_ASSERT_PTR_EQUAL(marie_call, linphone_core_get_current_call(marie->lc)); liblinphone_tester_check_rtcp(marie, laure); linphone_core_terminate_all_calls(laure->lc); - CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,5000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,5000)); } ms_list_free(lcs); @@ -2922,7 +2923,7 @@ static void call_established_with_rejected_reinvite_with_error(void) { LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); bool_t call_ok=TRUE; - CU_ASSERT_TRUE((call_ok=call(pauline,marie))); + BC_ASSERT_TRUE((call_ok=call(pauline,marie))); if (call_ok){ linphone_core_enable_payload_type(pauline->lc,linphone_core_find_payload_type(pauline->lc,"PCMA",8000,1),TRUE); /*add PCMA*/ @@ -2934,18 +2935,18 @@ static void call_established_with_rejected_reinvite_with_error(void) { ,linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); - CU_ASSERT_EQUAL(linphone_call_get_reason(linphone_core_get_current_call(pauline->lc)),LinphoneReasonTemporarilyUnavailable); /*might be change later*/ + BC_ASSERT_EQUAL(linphone_call_get_reason(linphone_core_get_current_call(pauline->lc)),LinphoneReasonTemporarilyUnavailable, int, "%d"); /*might be change later*/ - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallStreamsRunning,1); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallStreamsRunning,1, int, "%d"); check_call_state(pauline,LinphoneCallStreamsRunning); check_call_state(marie,LinphoneCallStreamsRunning); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); } linphone_core_manager_destroy(marie); @@ -2968,19 +2969,19 @@ static void call_rejected_because_wrong_credentials_with_params(const char* user linphone_core_add_auth_info(marie->lc,wrong_auth_info); } - CU_ASSERT_PTR_NOT_NULL(linphone_core_invite_address(marie->lc,marie->identity)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address(marie->lc,marie->identity)); result=wait_for(marie->lc,marie->lc,&marie->stat.number_of_auth_info_requested,1); if (enable_auth_req_cb) { - CU_ASSERT_TRUE(result); + BC_ASSERT_TRUE(result); /*automatically re-inititae the call*/ linphone_core_add_auth_info(marie->lc,wrong_auth_info); } - CU_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCallError,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCallError,1)); if (enable_auth_req_cb) { - CU_ASSERT_EQUAL(marie->stat.number_of_auth_info_requested,2); + BC_ASSERT_EQUAL(marie->stat.number_of_auth_info_requested,2, int, "%d"); } /*to make sure unregister will work*/ linphone_core_clear_all_auth_info(marie->lc); @@ -3038,47 +3039,47 @@ static void multiple_early_media(void) { linphone_core_invite_address_with_params(pauline->lc,marie1->identity,params); linphone_call_params_destroy(params); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,3000)); pauline_call=linphone_core_get_current_call(pauline->lc); marie1_call=linphone_core_get_current_call(marie1->lc); marie2_call=linphone_core_get_current_call(marie2->lc); - CU_ASSERT_PTR_NOT_NULL(pauline_call); - CU_ASSERT_PTR_NOT_NULL(marie1_call); - CU_ASSERT_PTR_NOT_NULL(marie2_call); + BC_ASSERT_PTR_NOT_NULL(pauline_call); + BC_ASSERT_PTR_NOT_NULL(marie1_call); + BC_ASSERT_PTR_NOT_NULL(marie2_call); if (pauline_call && marie1_call && marie2_call){ /*wait a bit that streams are established*/ wait_for_list(lcs,&dummy,1,6000); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>70); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>70); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie2_call)->download_bandwidth>70); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>70); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>70); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie2_call)->download_bandwidth>70); linphone_core_accept_call(marie1->lc,linphone_core_get_current_call(marie1->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallStreamsRunning,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallStreamsRunning,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,3000)); /*marie2 should get her call terminated*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000)); /*wait a bit that streams are established*/ wait_for_list(lcs,&dummy,1,3000); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>71); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>71); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>71); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>71); /*send an INFO in reverse side to check that dialogs are properly established*/ info=linphone_core_create_info_message(marie1->lc); linphone_call_send_info_message(marie1_call,info); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_inforeceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_inforeceived,1,3000)); } linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallEnd,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallEnd,1,3000)); ms_list_free(lcs); linphone_core_manager_destroy(marie1); @@ -3087,14 +3088,14 @@ static void multiple_early_media(void) { } void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, MSList* lcs,LinphoneMediaDirection audio_dir, LinphoneMediaDirection video_dir) { - CU_ASSERT_PTR_NOT_NULL(call); + BC_ASSERT_PTR_NOT_NULL(call); if (call) { int current_recv_iframe = mgr->stat.number_of_IframeDecoded; int expected_recv_iframe=0; int dummy = 0; const LinphoneCallParams *params = linphone_call_get_current_params(call); - CU_ASSERT_EQUAL(audio_dir,linphone_call_params_get_audio_direction(params)); - CU_ASSERT_EQUAL(video_dir,linphone_call_params_get_video_direction(params)); + BC_ASSERT_EQUAL(audio_dir,linphone_call_params_get_audio_direction(params), int, "%d"); + BC_ASSERT_EQUAL(video_dir,linphone_call_params_get_video_direction(params), int, "%d"); linphone_call_set_next_video_frame_decoded_callback(call,linphone_call_cb,mgr->lc); linphone_call_send_vfu_request(call); @@ -3103,32 +3104,32 @@ void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, MSList* switch (video_dir) { case LinphoneMediaDirectionInactive: - CU_ASSERT_TRUE(linphone_call_get_video_stats(call)->upload_bandwidth<5); + BC_ASSERT_TRUE(linphone_call_get_video_stats(call)->upload_bandwidth<5); case LinphoneMediaDirectionSendOnly: expected_recv_iframe = 0; - CU_ASSERT_TRUE(linphone_call_get_video_stats(call)->download_bandwidth<5); + BC_ASSERT_TRUE(linphone_call_get_video_stats(call)->download_bandwidth<5); break; case LinphoneMediaDirectionRecvOnly: - CU_ASSERT_TRUE(linphone_call_get_video_stats(call)->upload_bandwidth<5); + BC_ASSERT_TRUE(linphone_call_get_video_stats(call)->upload_bandwidth<5); case LinphoneMediaDirectionSendRecv: expected_recv_iframe = 1; break; } - CU_ASSERT_TRUE(wait_for_list(lcs, &mgr->stat.number_of_IframeDecoded,current_recv_iframe + expected_recv_iframe,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &mgr->stat.number_of_IframeDecoded,current_recv_iframe + expected_recv_iframe,3000)); switch (audio_dir) { case LinphoneMediaDirectionInactive: - CU_ASSERT_TRUE(linphone_call_get_audio_stats(call)->upload_bandwidth<5); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(call)->upload_bandwidth<5); case LinphoneMediaDirectionSendOnly: - CU_ASSERT_TRUE(linphone_call_get_video_stats(call)->download_bandwidth<5); - if (audio_dir == LinphoneMediaDirectionSendOnly) CU_ASSERT_TRUE(wait_for_list(lcs,&mgr->stat.audio_upload_bandwidth,70,4000)); + BC_ASSERT_TRUE(linphone_call_get_video_stats(call)->download_bandwidth<5); + if (audio_dir == LinphoneMediaDirectionSendOnly) BC_ASSERT_TRUE(wait_for_list(lcs,&mgr->stat.audio_upload_bandwidth,70,4000)); break; case LinphoneMediaDirectionRecvOnly: - CU_ASSERT_TRUE(linphone_call_get_audio_stats(call)->upload_bandwidth<5); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(call)->upload_bandwidth<5); case LinphoneMediaDirectionSendRecv: - CU_ASSERT_TRUE(wait_for_list(lcs,&mgr->stat.audio_download_bandwidth,70,4000)); - if (audio_dir == LinphoneMediaDirectionSendRecv) CU_ASSERT_TRUE(wait_for_list(lcs,&mgr->stat.audio_upload_bandwidth,70,4000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&mgr->stat.audio_download_bandwidth,70,4000)); + if (audio_dir == LinphoneMediaDirectionSendRecv) BC_ASSERT_TRUE(wait_for_list(lcs,&mgr->stat.audio_upload_bandwidth,70,4000)); break; } } @@ -3156,7 +3157,7 @@ static void accept_call_in_send_only_base(LinphoneCoreManager* pauline, Linphone ,pauline->lc); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallIncomingReceived,1,DEFAULT_WAIT_FOR)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallIncomingReceived,1,DEFAULT_WAIT_FOR)); { char* remote_uri = linphone_address_as_string_uri_only(pauline->identity); @@ -3171,8 +3172,8 @@ static void accept_call_in_send_only_base(LinphoneCoreManager* pauline, Linphone linphone_core_accept_call_with_params(marie->lc,call,params); linphone_call_params_destroy(params); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning,1,DEFAULT_WAIT_FOR)); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallPausedByRemote,1,DEFAULT_WAIT_FOR)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning,1,DEFAULT_WAIT_FOR)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallPausedByRemote,1,DEFAULT_WAIT_FOR)); check_media_direction(marie,call,lcs,LinphoneMediaDirectionSendOnly,LinphoneMediaDirectionSendOnly); } @@ -3212,7 +3213,7 @@ static void accept_call_in_send_base(bool_t caller_has_ice) { leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } @@ -3258,7 +3259,7 @@ void two_accepted_call_in_send_only() { leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } @@ -3312,15 +3313,15 @@ static void record_call(const char *filename, bool_t enableVideo) { filepath = create_filepath(bc_tester_writable_dir_prefix, filename, format); remove(filepath); linphone_call_params_set_record_file(marieParams, filepath); - CU_ASSERT_TRUE(call_succeeded = call_with_params(marie, pauline, marieParams, paulineParams)); - CU_ASSERT_PTR_NOT_NULL(callInst = linphone_core_get_current_call(marie->lc)); + BC_ASSERT_TRUE(call_succeeded = call_with_params(marie, pauline, marieParams, paulineParams)); + BC_ASSERT_PTR_NOT_NULL(callInst = linphone_core_get_current_call(marie->lc)); if ((call_succeeded == TRUE) && (callInst != NULL)) { ms_message("call_recording(): start recording into %s", filepath); linphone_call_start_recording(callInst); wait_for_until(marie->lc,pauline->lc,&dummy,1,5000); linphone_call_stop_recording(callInst); end_call(marie, pauline); - CU_ASSERT_EQUAL(access(filepath, F_OK), 0); + BC_ASSERT_EQUAL(access(filepath, F_OK), 0, int, "%d"); } remove(filepath); ms_free(filepath); @@ -3358,12 +3359,12 @@ static void video_call_snapshot(void) { linphone_call_params_enable_video(marieParams, TRUE); linphone_call_params_enable_video(paulineParams, TRUE); - CU_ASSERT_TRUE(call_succeeded = call_with_params(marie, pauline, marieParams, paulineParams)); - CU_ASSERT_PTR_NOT_NULL(callInst = linphone_core_get_current_call(marie->lc)); + BC_ASSERT_TRUE(call_succeeded = call_with_params(marie, pauline, marieParams, paulineParams)); + BC_ASSERT_PTR_NOT_NULL(callInst = linphone_core_get_current_call(marie->lc)); if((call_succeeded == TRUE) && (callInst != NULL)) { linphone_call_take_video_snapshot(callInst, filename); wait_for_until(marie->lc, pauline->lc, &dummy, 1, 5000); - CU_ASSERT_EQUAL(access(filename, F_OK), 0); + BC_ASSERT_EQUAL(access(filename, F_OK), 0, int, "%d"); remove(filename); } ms_free(filename); @@ -3386,7 +3387,7 @@ static void call_with_in_dialog_update(void) { marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new( "pauline_rc"); - CU_ASSERT_TRUE(call_ok=call(pauline,marie)); + BC_ASSERT_TRUE(call_ok=call(pauline,marie)); if (!call_ok) goto end; liblinphone_tester_check_rtcp(marie,pauline); @@ -3394,10 +3395,10 @@ static void call_with_in_dialog_update(void) { params->no_user_consent=TRUE; linphone_core_update_call(marie->lc,linphone_core_get_current_call(marie->lc),params); linphone_call_params_destroy(params); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdating,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallUpdatedByRemote,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdating,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallUpdatedByRemote,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); end_call(marie,pauline); end: @@ -3405,7 +3406,7 @@ end: linphone_core_manager_destroy(pauline); leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } @@ -3424,7 +3425,7 @@ static void call_with_in_dialog_codec_change_base(bool_t no_sdp) { marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new( "pauline_rc"); - CU_ASSERT_TRUE(call_ok=call(pauline,marie)); + BC_ASSERT_TRUE(call_ok=call(pauline,marie)); if (!call_ok) goto end; liblinphone_tester_check_rtcp(marie,pauline); @@ -3439,14 +3440,14 @@ static void call_with_in_dialog_codec_change_base(bool_t no_sdp) { } linphone_core_update_call(marie->lc,linphone_core_get_current_call(marie->lc),params); linphone_call_params_destroy(params); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdating,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallUpdatedByRemote,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); - CU_ASSERT_STRING_EQUAL("PCMA",linphone_payload_type_get_mime_type(linphone_call_params_get_used_audio_codec(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))))); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdating,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallUpdatedByRemote,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_STRING_EQUAL("PCMA",linphone_payload_type_get_mime_type(linphone_call_params_get_used_audio_codec(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))))); wait_for_until(marie->lc, pauline->lc, &dummy, 1, 5000); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(marie->lc))->download_bandwidth>70); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth>70); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(marie->lc))->download_bandwidth>70); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth>70); end_call(marie,pauline); end: @@ -3454,7 +3455,7 @@ end: linphone_core_manager_destroy(pauline); leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } @@ -3481,14 +3482,14 @@ static void call_with_custom_supported_tags(void) { pauline = linphone_core_manager_new( "pauline_rc"); linphone_core_add_supported_tag(marie->lc,"pouet-tag"); - CU_ASSERT_TRUE(call_ok=call(pauline,marie)); + BC_ASSERT_TRUE(call_ok=call(pauline,marie)); if (!call_ok) goto end; liblinphone_tester_check_rtcp(marie,pauline); remote_params=linphone_call_get_remote_params(linphone_core_get_current_call(pauline->lc)); recv_supported=linphone_call_params_get_custom_header(remote_params,"supported"); - CU_ASSERT_PTR_NOT_NULL(recv_supported); + BC_ASSERT_PTR_NOT_NULL(recv_supported); if (recv_supported){ - CU_ASSERT_TRUE(strstr(recv_supported,"pouet-tag")!=NULL); + BC_ASSERT_TRUE(strstr(recv_supported,"pouet-tag")!=NULL); } end_call(marie,pauline); end: @@ -3496,7 +3497,7 @@ end: linphone_core_manager_destroy(pauline); leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } @@ -3521,24 +3522,24 @@ static void call_log_from_taken_from_p_asserted_id(void) { lp_config_set_int(marie_lp,"sip","call_logs_use_asserted_id_instead_of_from",1); - CU_ASSERT_TRUE(call_ok=call_with_caller_params(pauline,marie,params)); + BC_ASSERT_TRUE(call_ok=call_with_caller_params(pauline,marie,params)); if (!call_ok) goto end; c1=linphone_core_get_current_call(pauline->lc); c2=linphone_core_get_current_call(marie->lc); - CU_ASSERT_PTR_NOT_NULL(c1); - CU_ASSERT_PTR_NOT_NULL(c2); + BC_ASSERT_PTR_NOT_NULL(c1); + BC_ASSERT_PTR_NOT_NULL(c2); /*make sure remote identity is hidden*/ - CU_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_get_remote_address(c2),paulie_asserted_id_addr)); + BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_get_remote_address(c2),paulie_asserted_id_addr)); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); end: linphone_call_params_destroy(params); linphone_core_manager_destroy(marie); @@ -3551,12 +3552,12 @@ static void incoming_invite_with_invalid_sdp() { LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0}; callee_test_params.sdp_simulate_error = TRUE; - CU_ASSERT_FALSE(call_with_params2(caller,callee,&caller_test_params, &callee_test_params, FALSE)); + BC_ASSERT_FALSE(call_with_params2(caller,callee,&caller_test_params, &callee_test_params, FALSE)); - CU_ASSERT_PTR_NULL(linphone_core_get_current_call(callee->lc)); - CU_ASSERT_EQUAL(caller->stat.number_of_LinphoneCallError,1); + BC_ASSERT_PTR_NULL(linphone_core_get_current_call(callee->lc)); + BC_ASSERT_EQUAL(caller->stat.number_of_LinphoneCallError,1, int, "%d"); /*call will be drop before presented to the application, because it is invalid*/ - CU_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallIncomingReceived,0); + BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallIncomingReceived,0, int, "%d"); linphone_core_manager_destroy(callee); linphone_core_manager_destroy(caller); @@ -3568,14 +3569,14 @@ static void outgoing_invite_with_invalid_sdp() { LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0}; caller_test_params.sdp_simulate_error = TRUE; - CU_ASSERT_FALSE(call_with_params2(caller,callee,&caller_test_params, &callee_test_params, FALSE)); + BC_ASSERT_FALSE(call_with_params2(caller,callee,&caller_test_params, &callee_test_params, FALSE)); - CU_ASSERT_PTR_NULL(linphone_core_get_current_call(callee->lc)); - CU_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallIncomingReceived,1); - CU_ASSERT_EQUAL(caller->stat.number_of_LinphoneCallError,1); + BC_ASSERT_PTR_NULL(linphone_core_get_current_call(callee->lc)); + BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallIncomingReceived,1, int, "%d"); + BC_ASSERT_EQUAL(caller->stat.number_of_LinphoneCallError,1, int, "%d"); // actually callee does not receive error, because it just get a BYE from the other part - CU_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallError,0); - CU_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallEnd,1); + BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallError,0, int, "%d"); + BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallEnd,1, int, "%d"); linphone_core_manager_destroy(callee); linphone_core_manager_destroy(caller); @@ -3586,35 +3587,35 @@ static void incoming_reinvite_with_invalid_ack_sdp(){ LinphoneCoreManager* caller = linphone_core_manager_new( "pauline_rc"); LinphoneCoreManager* callee = linphone_core_manager_new( "marie_rc"); LinphoneCall * inc_call; - CU_ASSERT_TRUE(call(caller,callee)); + BC_ASSERT_TRUE(call(caller,callee)); inc_call = linphone_core_get_current_call(callee->lc); - CU_ASSERT_PTR_NOT_NULL(inc_call); + BC_ASSERT_PTR_NOT_NULL(inc_call); if (inc_call) { const LinphoneCallParams *caller_params; stats initial_caller_stat=caller->stat; stats initial_callee_stat=callee->stat; sal_call_set_sdp_handling(inc_call->op, SalOpSDPSimulateError); /* will force a parse error for the ACK SDP*/ - CU_ASSERT_PTR_NOT_NULL(setup_video(caller, callee, TRUE)); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallUpdating,initial_callee_stat.number_of_LinphoneCallUpdating+1)); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallStreamsRunning,initial_callee_stat.number_of_LinphoneCallStreamsRunning+1)); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallStreamsRunning,initial_caller_stat.number_of_LinphoneCallStreamsRunning)); + BC_ASSERT_PTR_NOT_NULL(setup_video(caller, callee, TRUE)); + BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallUpdating,initial_callee_stat.number_of_LinphoneCallUpdating+1)); + BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallStreamsRunning,initial_callee_stat.number_of_LinphoneCallStreamsRunning+1)); + BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallStreamsRunning,initial_caller_stat.number_of_LinphoneCallStreamsRunning)); /*Basically the negotiation failed but since the call was already running, we expect it to restore to the previous state so error stats should not be changed*/ - CU_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallError,initial_callee_stat.number_of_LinphoneCallError); + BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallError,initial_callee_stat.number_of_LinphoneCallError, int, "%d"); /*and remote should have received an update notification*/ - CU_ASSERT_EQUAL(caller->stat.number_of_LinphoneCallUpdatedByRemote,initial_caller_stat.number_of_LinphoneCallUpdatedByRemote+1); + BC_ASSERT_EQUAL(caller->stat.number_of_LinphoneCallUpdatedByRemote,initial_caller_stat.number_of_LinphoneCallUpdatedByRemote+1, int, "%d"); - CU_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc)))); + BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc)))); caller_params = linphone_call_get_current_params(linphone_core_get_current_call(caller->lc)); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,(int*)&caller_params->has_video,FALSE)); + BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,(int*)&caller_params->has_video,FALSE)); sal_call_set_sdp_handling(inc_call->op, SalOpSDPNormal); } linphone_core_terminate_all_calls(caller->lc); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallEnd,1)); linphone_core_manager_destroy(callee); linphone_core_manager_destroy(caller); @@ -3628,32 +3629,32 @@ static void outgoing_reinvite_with_invalid_ack_sdp() { LinphoneCoreManager* caller = linphone_core_manager_new( "pauline_rc"); LinphoneCoreManager* callee = linphone_core_manager_new( "marie_rc"); LinphoneCall * out_call; - CU_ASSERT_TRUE(call(caller,callee)); + BC_ASSERT_TRUE(call(caller,callee)); out_call = linphone_core_get_current_call(caller->lc); - CU_ASSERT_PTR_NOT_NULL(out_call); + BC_ASSERT_PTR_NOT_NULL(out_call); if (out_call) { stats initial_caller_stat=caller->stat; stats initial_callee_stat=callee->stat; sal_call_set_sdp_handling(out_call->op, SalOpSDPSimulateError); /* will force a parse error for the ACK SDP*/ - CU_ASSERT_PTR_NOT_NULL(setup_video(caller, callee, TRUE)); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallUpdating,initial_callee_stat.number_of_LinphoneCallUpdating+1)); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallStreamsRunning,initial_callee_stat.number_of_LinphoneCallStreamsRunning+1)); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallStreamsRunning,initial_caller_stat.number_of_LinphoneCallStreamsRunning)); + BC_ASSERT_PTR_NOT_NULL(setup_video(caller, callee, TRUE)); + BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallUpdating,initial_callee_stat.number_of_LinphoneCallUpdating+1)); + BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallStreamsRunning,initial_callee_stat.number_of_LinphoneCallStreamsRunning+1)); + BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallStreamsRunning,initial_caller_stat.number_of_LinphoneCallStreamsRunning)); /*Basically the negotiation failed but since the call was already running, we expect it to restore to the previous state so error stats should not be changed*/ - CU_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallError,initial_callee_stat.number_of_LinphoneCallError); + BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallError,initial_callee_stat.number_of_LinphoneCallError, int, "%d"); /*and remote should not have received any update notification*/ - CU_ASSERT_EQUAL(caller->stat.number_of_LinphoneCallUpdatedByRemote,initial_caller_stat.number_of_LinphoneCallUpdatedByRemote); + BC_ASSERT_EQUAL(caller->stat.number_of_LinphoneCallUpdatedByRemote,initial_caller_stat.number_of_LinphoneCallUpdatedByRemote, int, "%d"); - CU_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc)))); - CU_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc)))); + BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc)))); + BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc)))); sal_call_set_sdp_handling(out_call->op, SalOpSDPNormal); } linphone_core_terminate_all_calls(caller->lc); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallEnd,1)); linphone_core_manager_destroy(callee); linphone_core_manager_destroy(caller); @@ -3676,11 +3677,11 @@ static void call_with_paused_no_sdp_on_resume() { marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new( "pauline_rc"); - CU_ASSERT_TRUE(call(pauline,marie)); + BC_ASSERT_TRUE(call(pauline,marie)); liblinphone_tester_check_rtcp(marie,pauline); call_marie = linphone_core_get_current_call(marie->lc); - CU_ASSERT_PTR_NOT_NULL(call_marie); + BC_ASSERT_PTR_NOT_NULL(call_marie); if (!call_marie) goto end; ms_message("== Call is OK =="); @@ -3690,9 +3691,9 @@ static void call_with_paused_no_sdp_on_resume() { linphone_core_pause_call(marie->lc,call_marie); ms_message("== Call pausing =="); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausing,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausedByRemote,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPaused,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausing,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausedByRemote,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPaused,1)); /*stay in pause a little while in order to generate traffic*/ wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000); @@ -3703,19 +3704,19 @@ static void call_with_paused_no_sdp_on_resume() { linphone_core_resume_call(marie->lc,call_marie); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); wait_for_until(marie->lc, pauline->lc, &dummy, 1, 3000); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(call_marie)->download_bandwidth>70); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth>70); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(call_marie)->download_bandwidth>70); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth>70); end: end_call(marie,pauline); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } @@ -3755,8 +3756,8 @@ static void early_media_without_sdp_in_200_base( bool_t use_video, bool_t use_ic marie_call = linphone_core_invite_address_with_params(marie->lc, pauline->identity, params); marie_call_log = linphone_call_get_call_log(marie_call); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging,1,1000)); if (linphone_core_inc_invite_pending(pauline->lc)) { LinphoneCall* pauline_call = linphone_core_get_current_call(pauline->lc); @@ -3764,8 +3765,8 @@ static void early_media_without_sdp_in_200_base( bool_t use_video, bool_t use_ic /* send a 183 to initiate the early media */ linphone_core_accept_early_media(pauline->lc, pauline_call); - CU_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) ); - CU_ASSERT_TRUE( wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,2000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,2000) ); liblinphone_tester_check_rtcp(marie, pauline); @@ -3773,11 +3774,11 @@ static void early_media_without_sdp_in_200_base( bool_t use_video, bool_t use_ic sal_call_set_sdp_handling(pauline_call->op, SalOpSDPSimulateRemove); linphone_core_accept_call(pauline->lc, pauline_call); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000)); connected_time=ms_get_cur_time_ms(); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,3000)); - CU_ASSERT_EQUAL(marie_call, linphone_core_get_current_call(marie->lc)); + BC_ASSERT_PTR_EQUAL(marie_call, linphone_core_get_current_call(marie->lc)); liblinphone_tester_check_rtcp(marie, pauline); /*just to have a call duration !=0*/ @@ -3785,10 +3786,10 @@ static void early_media_without_sdp_in_200_base( bool_t use_video, bool_t use_ic linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); ended_time=ms_get_cur_time_ms(); - CU_ASSERT_TRUE( labs((linphone_call_log_get_duration(marie_call_log)*1000) - (int64_t)(ended_time - connected_time)) <=1000 ); + BC_ASSERT_TRUE( labs((linphone_call_log_get_duration(marie_call_log)*1000) - (int64_t)(ended_time - connected_time)) <=1000 ); ms_list_free(lcs); } @@ -3832,15 +3833,15 @@ static void call_with_generic_cn(void) { linphone_core_set_record_file(pauline->lc, recorded_file); linphone_core_enable_generic_confort_noise(marie->lc, TRUE); linphone_core_enable_generic_confort_noise(pauline->lc, TRUE); - CU_ASSERT_TRUE(call(marie,pauline)); + BC_ASSERT_TRUE(call(marie,pauline)); pauline_call=linphone_core_get_current_call(pauline->lc); - CU_ASSERT_PTR_NOT_NULL(pauline_call); + BC_ASSERT_PTR_NOT_NULL(pauline_call); if (pauline_call){ const rtp_stats_t *rtps; wait_for_until(marie->lc, pauline->lc, NULL, 0, 8000); rtps=rtp_session_get_stats(pauline_call->audiostream->ms.sessions.rtp_session); - CU_ASSERT_TRUE(rtps->packet_recv<=300 && rtps->packet_recv>=200); + BC_ASSERT_TRUE(rtps->packet_recv<=300 && rtps->packet_recv>=200); } end_call(marie,pauline); @@ -3849,9 +3850,9 @@ static void call_with_generic_cn(void) { int err; err=stat(recorded_file,&stbuf); - CU_ASSERT_EQUAL(err, 0); + BC_ASSERT_EQUAL(err, 0, int, "%d"); if (err==0){ - CU_ASSERT_TRUE(stbuf.st_size>120000); + BC_ASSERT_TRUE(stbuf.st_size>120000); } } @@ -3859,7 +3860,7 @@ static void call_with_generic_cn(void) { linphone_core_manager_destroy(pauline); leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } @@ -3913,24 +3914,24 @@ static void call_with_transport_change_base(bool_t succesfull_call) { sip_tr.tls_port = 0; linphone_core_set_sip_transports(marie->lc,&sip_tr); if (succesfull_call) { - CU_ASSERT_TRUE(call(marie,pauline)); + BC_ASSERT_TRUE(call(marie,pauline)); linphone_core_terminate_all_calls(marie->lc); } else linphone_core_invite(marie->lc,"nexiste_pas"); if (succesfull_call) - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallReleased,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallReleased,1)); if (succesfull_call) { - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallReleased,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallReleased,1)); } linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } @@ -3975,9 +3976,9 @@ static void video_call_with_re_invite_inactive_followed_by_re_invite_base(Linpho linphone_core_update_call(marie->lc, linphone_core_get_current_call(marie->lc),params); linphone_call_params_destroy(params); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdating,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallPaused,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallPausedByRemote,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdating,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallPaused,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallPausedByRemote,1)); check_media_direction(marie,linphone_core_get_current_call(marie->lc),lcs,LinphoneMediaDirectionInactive,LinphoneMediaDirectionInactive); check_media_direction(pauline,linphone_core_get_current_call(pauline->lc), lcs, LinphoneMediaDirectionInactive, LinphoneMediaDirectionInactive); @@ -3997,18 +3998,18 @@ static void video_call_with_re_invite_inactive_followed_by_re_invite_base(Linpho linphone_core_resume_call(marie->lc,linphone_core_get_current_call(marie->lc)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallResuming,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallResuming,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); check_media_direction(marie,linphone_core_get_current_call(marie->lc),lcs,LinphoneMediaDirectionSendRecv,LinphoneMediaDirectionSendRecv); check_media_direction(pauline,linphone_core_get_current_call(pauline->lc),lcs,LinphoneMediaDirectionSendRecv,LinphoneMediaDirectionSendRecv); /*assert that after pause and resume, SRTP is still being used*/ current_params = linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_TRUE(linphone_call_params_get_media_encryption(current_params) == mode); + BC_ASSERT_TRUE(linphone_call_params_get_media_encryption(current_params) == mode); current_params = linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)); - CU_ASSERT_TRUE(linphone_call_params_get_media_encryption(current_params) == mode); + BC_ASSERT_TRUE(linphone_call_params_get_media_encryption(current_params) == mode); } end_call(marie,pauline); @@ -4016,7 +4017,7 @@ static void video_call_with_re_invite_inactive_followed_by_re_invite_base(Linpho linphone_core_manager_destroy(pauline); leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } diff --git a/tester/common/bc_tester_utils.c b/tester/common/bc_tester_utils.c index 77eb0372c..7c47dc25f 100644 --- a/tester/common/bc_tester_utils.c +++ b/tester/common/bc_tester_utils.c @@ -24,6 +24,7 @@ along with this program. If not, see . #include +#include "CUnit/Basic.h" #include "CUnit/Automated.h" #if WINAPI_FAMILY_PHONE_APP diff --git a/tester/common/bc_tester_utils.h b/tester/common/bc_tester_utils.h index 6bd17b03c..fcde1af9d 100644 --- a/tester/common/bc_tester_utils.h +++ b/tester/common/bc_tester_utils.h @@ -20,9 +20,10 @@ #ifndef TESTER_UTILS_H #define TESTER_UTILS_H -#include "CUnit/Basic.h" #include #include +#include +#include extern const char *bc_tester_read_dir_prefix; extern const char *bc_tester_writable_dir_prefix; @@ -31,6 +32,8 @@ extern int bc_printf_verbosity_info; extern int bc_printf_verbosity_error; typedef void (*test_function_t)(void); +typedef int (*init_function_t)(void); +typedef int (*cleanup_function_t)(void); typedef int (*test_suite_function_t)(const char *name); typedef struct { @@ -40,8 +43,8 @@ typedef struct { typedef struct { const char *name; - CU_InitializeFunc init_func; - CU_CleanupFunc cleanup_func; + init_function_t init_func; + cleanup_function_t cleanup_func; int nb_tests; test_t *tests; } test_suite_t; @@ -85,63 +88,62 @@ int bc_tester_suite_index(const char *suite_name); */ char * bc_tester_res(const char *name); -/*Redefine the CU_... macros WITHOUT final ';' semicolon, to allow IF conditions */ -#define BC_ASSERT_EQUAL(actual, expected) CU_assertImplementation(((actual) == (expected)), __LINE__, ("CU_ASSERT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE) -#define BC_PASS(msg) CU_assertImplementation(CU_TRUE, __LINE__, ("CU_PASS(" #msg ")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT(value) CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_FALSE) -#define BC_ASSERT_FATAL(value) CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_TRUE) -#define BC_TEST(value) CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_FALSE) -#define BC_TEST_FATAL(value) CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_TRUE) -#define BC_ASSERT_TRUE(value) CU_assertImplementation((value), __LINE__, ("CU_ASSERT_TRUE(" #value ")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT_TRUE_FATAL(value) CU_assertImplementation((value), __LINE__, ("CU_ASSERT_TRUE_FATAL(" #value ")"), __FILE__, "", CU_TRUE) -#define BC_ASSERT_FALSE(value) CU_assertImplementation(!(value), __LINE__, ("CU_ASSERT_FALSE(" #value ")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT_FALSE_FATAL(value) CU_assertImplementation(!(value), __LINE__, ("CU_ASSERT_FALSE_FATAL(" #value ")"), __FILE__, "", CU_TRUE) -#define BC_ASSERT_EQUAL(actual, expected) CU_assertImplementation(((actual) == (expected)), __LINE__, ("CU_ASSERT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT_EQUAL_FATAL(actual, expected) CU_assertImplementation(((actual) == (expected)), __LINE__, ("CU_ASSERT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE) -#define BC_ASSERT_NOT_EQUAL(actual, expected) CU_assertImplementation(((actual) != (expected)), __LINE__, ("CU_ASSERT_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT_NOT_EQUAL_FATAL(actual, expected) CU_assertImplementation(((actual) != (expected)), __LINE__, ("CU_ASSERT_NOT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE) -#define BC_ASSERT_PTR_EQUAL(actual, expected) CU_assertImplementation(((const void*)(actual) == (const void*)(expected)), __LINE__, ("CU_ASSERT_PTR_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT_PTR_EQUAL_FATAL(actual, expected) CU_assertImplementation(((const void*)(actual) == (const void*)(expected)), __LINE__, ("CU_ASSERT_PTR_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE) -#define BC_ASSERT_PTR_NOT_EQUAL(actual, expected) CU_assertImplementation(((const void*)(actual) != (const void*)(expected)), __LINE__, ("CU_ASSERT_PTR_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT_PTR_NOT_EQUAL_FATAL(actual, expected) CU_assertImplementation(((const void*)(actual) != (const void*)(expected)), __LINE__, ("CU_ASSERT_PTR_NOT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE) -#define BC_ASSERT_PTR_NULL(value) CU_assertImplementation((NULL == (const void*)(value)), __LINE__, ("CU_ASSERT_PTR_NULL(" #value")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT_PTR_NULL_FATAL(value) CU_assertImplementation((NULL == (const void*)(value)), __LINE__, ("CU_ASSERT_PTR_NULL_FATAL(" #value")"), __FILE__, "", CU_TRUE) -#define BC_ASSERT_PTR_NOT_NULL(value) CU_assertImplementation((NULL != (const void*)(value)), __LINE__, ("CU_ASSERT_PTR_NOT_NULL(" #value")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT_PTR_NOT_NULL_FATAL(value) CU_assertImplementation((NULL != (const void*)(value)), __LINE__, ("CU_ASSERT_PTR_NOT_NULL_FATAL(" #value")"), __FILE__, "", CU_TRUE) -#define BC_ASSERT_STRING_EQUAL(actual, expected) CU_assertImplementation(!(strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT_STRING_EQUAL_FATAL(actual, expected) CU_assertImplementation(!(strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE) -#define BC_ASSERT_STRING_NOT_EQUAL(actual, expected) CU_assertImplementation((strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT_STRING_NOT_EQUAL_FATAL(actual, expected) CU_assertImplementation((strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_NOT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE) -#define BC_ASSERT_NSTRING_EQUAL(actual, expected, count) CU_assertImplementation(!(strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_EQUAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT_NSTRING_EQUAL_FATAL(actual, expected, count) CU_assertImplementation(!(strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_EQUAL_FATAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_TRUE) -#define BC_ASSERT_NSTRING_NOT_EQUAL(actual, expected, count) CU_assertImplementation((strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_NOT_EQUAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT_NSTRING_NOT_EQUAL_FATAL(actual, expected, count) CU_assertImplementation((strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_NOT_EQUAL_FATAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_TRUE) -#define BC_ASSERT_DOUBLE_EQUAL(actual, expected, granularity) CU_assertImplementation(((fabs((double)(actual) - (expected)) <= fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_EQUAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT_DOUBLE_EQUAL_FATAL(actual, expected, granularity) CU_assertImplementation(((fabs((double)(actual) - (expected)) <= fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_EQUAL_FATAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_TRUE) -#define BC_ASSERT_DOUBLE_NOT_EQUAL(actual, expected, granularity) CU_assertImplementation(((fabs((double)(actual) - (expected)) > fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_NOT_EQUAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT_DOUBLE_NOT_EQUAL_FATAL(actual, expected, granularity) CU_assertImplementation(((fabs((double)(actual) - (expected)) > fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_NOT_EQUAL_FATAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_TRUE) -#define BC_ASSERT_GREATER(actual, expected) CU_assertImplementation(((actual) >= (expected)), __LINE__, ("CU_ASSERT_GREATER(" #actual "," #expected ")"), __FILE__, "", CU_FALSE) -#define BC_ASSERT_LOWER(actual, expected) CU_assertImplementation(((actual) <= (expected)), __LINE__, ("CU_ASSERT_LOWER(" #actual "," #expected ")"), __FILE__, "", CU_FALSE) -/*Add some custom defines with logs in case of fail*/ -#define BC_ASSERT_EQUAL_WITH_TYPE(actual, expected, type, type_format) { \ - type cactual = (actual), cexpected = (expected); \ - if (! BC_ASSERT_EQUAL(cactual, cexpected)) { \ - bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " = " #expected " but was " type_format " != " type_format "\n", __FILE__, __LINE__, cactual, cexpected); \ - } \ -} -#define BC_ASSERT_GREATER_WITH_TYPE(actual, expected, type, type_format) { \ - type cactual = (actual), cexpected = (expected); \ - if (! BC_ASSERT_GREATER(cactual, cexpected)) { \ - bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " >= " #expected " but was " type_format " < " type_format "\n", __FILE__, __LINE__, cactual, cexpected); \ - } \ -} -#define BC_ASSERT_LOWER_WITH_TYPE(actual, expected, type, type_format) { \ - type cactual = (actual), cexpected = (expected); \ - if (! BC_ASSERT_LOWER(cactual, cexpected)) { \ - bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " <= " #expected " but was " type_format " > " type_format "\n", __FILE__, __LINE__, cactual, cexpected); \ - } \ -} +/*Redefine the CU_... macros WITHOUT final ';' semicolon, to allow IF conditions and with smarter error message */ +extern int CU_assertImplementation(int bValue, + unsigned int uiLine, + const char *strCondition, + const char *strFile, + const char *strFunction, + int bFatal); + +#define _BC_ASSERT(pred, format, fatal) CU_assertImplementation(pred, __LINE__, format, __FILE__, "", fatal) +#define _BC_ASSERT_PRED(name, pred, actual, expected, type, fatal, ...) \ + do { \ + char format[4096] = {0}; \ + type cactual = (actual); \ + type cexpected = (expected); \ + snprintf(format, 4096, name "(" #actual ", " #expected ") - " __VA_ARGS__); \ + _BC_ASSERT(pred, format, fatal); \ + } while (0) +#define BC_PASS(msg) _BC_ASSERT(TRUE, "BC_PASS(" #msg ").", FALSE) +#define BC_FAIL(msg) _BC_ASSERT(FALSE, "BC_FAIL(" #msg ").", FALSE) +#define BC_ASSERT(value) _BC_ASSERT((value), #value, FALSE) +#define BC_ASSERT_FATAL(value) _BC_ASSERT((value), #value, TRUE) +#define BC_TEST(value) _BC_ASSERT((value), #value, FALSE) +#define BC_TEST_FATAL(value) _BC_ASSERT((value), #value, TRUE) +#define BC_ASSERT_TRUE(value) _BC_ASSERT((value), ("BC_ASSERT_TRUE(" #value ")"), FALSE) +#define BC_ASSERT_TRUE_FATAL(value) _BC_ASSERT((value), ("BC_ASSERT_TRUE_FATAL(" #value ")"), TRUE) +#define BC_ASSERT_FALSE(value) _BC_ASSERT(!(value), ("BC_ASSERT_FALSE(" #value ")"), FALSE) +#define BC_ASSERT_FALSE_FATAL(value) _BC_ASSERT(!(value), ("BC_ASSERT_FALSE_FATAL(" #value ")"), TRUE) +#define BC_ASSERT_EQUAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_EQUAL", ((cactual) == (cexpected)), actual, expected, type, FALSE, "Expected " type_format " but was " type_format ".", cexpected, cactual) +#define BC_ASSERT_EQUAL_FATAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_EQUAL_FATAL", ((cactual) == (cexpected)), actual, expected, type, TRUE, "Expected " type_format " but was " type_format ".", cexpected, cactual) +#define BC_ASSERT_NOT_EQUAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_NOT_EQUAL", ((cactual) != (cexpected)), actual, expected, type, FALSE, "Expected NOT " type_format " but it was.", cexpected) +#define BC_ASSERT_NOT_EQUAL_FATAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_NOT_EQUAL_FATAL", ((cactual) != (cexpected)), actual, expected, type, TRUE, "Expected NOT " type_format " but it was.", cexpected) +#define BC_ASSERT_PTR_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_EQUAL", ((cactual) == (cexpected)), (const void*)(actual), (const void*)(expected), const void*, FALSE, "Expected %p but was %p.", cexpected, cactual) +#define BC_ASSERT_PTR_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_EQUAL_FATAL", ((cactual) == (cexpected)), (const void*)(actual), (const void*)(expected), const void*, TRUE, "Expected %p but was %p.", cexpected, cactual) +#define BC_ASSERT_PTR_NOT_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_EQUAL", ((cactual) != (cexpected)), (const void*)(actual), (const void*)(expected), const void*, FALSE, "Expected NOT %p but it was.", cexpected) +#define BC_ASSERT_PTR_NOT_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_EQUAL_FATAL", ((cactual) != (cexpected)), (const void*)(actual), (const void*)(expected), const void*, TRUE, "Expected NOT %p but it was.", cexpected) +#define BC_ASSERT_PTR_NULL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NULL", ((cactual) == (cexpected)), (const void*)(value), (const void*)NULL, const void*, FALSE, "Expected NULL but was %p.", cactual) +#define BC_ASSERT_PTR_NULL_FATAL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NULL_FATAL", ((cactual) == (cexpected)), (const void*)(value), (const void*)NULL, const void*, TRUE, "Expected NULL but was %p.", cactual) +#define BC_ASSERT_PTR_NOT_NULL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_NULL", ((cactual) != (cexpected)), (const void*)(value), (const void*)NULL, const void*, FALSE, "Expected NOT NULL but it was.") +#define BC_ASSERT_PTR_NOT_NULL_FATAL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_NULL_FATAL", ((cactual) != (cexpected)), (const void*)(value), (const void*)NULL, const void*, TRUE, "Expected NOT NULL but it was.") +#define BC_ASSERT_STRING_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_EQUAL", !(strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, FALSE, "Expected %s but was %s.", cexpected, cactual) +#define BC_ASSERT_STRING_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_EQUAL_FATAL", !(strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, TRUE, "Expected %s but was %s.", cexpected, cactual) +#define BC_ASSERT_STRING_NOT_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_NOT_EQUAL", (strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, FALSE, "Expected NOT %s but it was.", cexpected) +#define BC_ASSERT_STRING_NOT_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_NOT_EQUAL_FATAL", (strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, TRUE, "Expected NOT %s but it was.", cexpected) +#define BC_ASSERT_NSTRING_EQUAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_EQUAL", !(strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, FALSE, "Expected %*s but was %*s.", (int)(count), cexpected, (int)(count), cactual) +#define BC_ASSERT_NSTRING_EQUAL_FATAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_EQUAL_FATAL", !(strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, TRUE, "Expected %*s but was %*s.", (int)count, cexpected, (int)count, cactual) +#define BC_ASSERT_NSTRING_NOT_EQUAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_NOT_EQUAL", (strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, FALSE, "Expected %*s but it was.", (int)count, cexpected) +#define BC_ASSERT_NSTRING_NOT_EQUAL_FATAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_NOT_EQUAL_FATAL", (strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, TRUE, "Expected %*s but it was.", (int)count, cexpected) +#define BC_ASSERT_DOUBLE_EQUAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_EQUAL", ((fabs((double)(cactual) - (cexpected)) <= fabs((double)(granularity)))), actual, expected, double, FALSE, "Expected %f but was %f.", cexpected, cactual) +#define BC_ASSERT_DOUBLE_EQUAL_FATAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_EQUAL_FATAL", ((fabs((double)(cactual) - (cexpected)) <= fabs((double)(granularity)))), actual, expected, double, TRUE, "Expected %f but was %f.", cexpected, cactual) +#define BC_ASSERT_DOUBLE_NOT_EQUAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_NOT_EQUAL", ((fabs((double)(cactual) - (cexpected)) > fabs((double)(granularity)))), actual, expected, double, FALSE, "Expected %f but was %f.", cexpected, cactual) +#define BC_ASSERT_DOUBLE_NOT_EQUAL_FATAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_NOT_EQUAL_FATAL", ((fabs((double)(cactual) - (cexpected)) > fabs((double)(granularity)))), actual, expected, double, TRUE, "Expected %f but was %f.", cexpected, cactual) + +/*Custom defines*/ +#define BC_ASSERT_GREATER(actual, lower, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_GREATER", ((cactual) >= (cexpected)), actual, lower, type, FALSE, "Expected " type_format " but was " type_format ".", cexpected, cactual) +#define BC_ASSERT_LOWER(actual, lower, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_LOWER", ((cactual) <= (cexpected)), actual, lower, type, FALSE, "Expected " type_format " but was " type_format ".", cexpected, cactual) #ifdef __cplusplus } diff --git a/tester/dtmf_tester.c b/tester/dtmf_tester.c index c4c2e3bfe..22d03837c 100644 --- a/tester/dtmf_tester.c +++ b/tester/dtmf_tester.c @@ -43,12 +43,12 @@ void send_dtmf_base(bool_t use_rfc2833, bool_t use_sipinfo, char dtmf, char* dtm linphone_core_set_use_rfc2833_for_dtmf(pauline->lc, use_rfc2833); linphone_core_set_use_info_for_dtmf(pauline->lc, use_sipinfo); - CU_ASSERT_TRUE(call(pauline,marie)); + BC_ASSERT_TRUE(call(pauline,marie)); marie_call = linphone_core_get_current_call(marie->lc); - - CU_ASSERT_PTR_NOT_NULL(marie_call); - + + BC_ASSERT_PTR_NOT_NULL(marie_call); + if (!marie_call) return; if (dtmf != '\0') { @@ -56,7 +56,7 @@ void send_dtmf_base(bool_t use_rfc2833, bool_t use_sipinfo, char dtmf, char* dtm linphone_call_send_dtmf(marie_call, dtmf); /*wait for the DTMF to be received from pauline*/ - CU_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.dtmf_count, dtmf_count_prev+1, 10000)); + BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.dtmf_count, dtmf_count_prev+1, 10000)); expected = ms_strdup_printf("%c", dtmf); } @@ -66,29 +66,29 @@ void send_dtmf_base(bool_t use_rfc2833, bool_t use_sipinfo, char dtmf, char* dtm linphone_call_send_dtmfs(marie_call, dtmf_seq); /*wait for the DTMF sequence to be received from pauline*/ - CU_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.dtmf_count, dtmf_count_prev + strlen(dtmf_seq), 10000 + dtmf_delay_ms * strlen(dtmf_seq))); + BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.dtmf_count, dtmf_count_prev + strlen(dtmf_seq), 10000 + dtmf_delay_ms * strlen(dtmf_seq))); expected = (dtmf!='\0')?ms_strdup_printf("%c%s",dtmf,dtmf_seq):ms_strdup(dtmf_seq); } if (expected != NULL) { - CU_ASSERT_PTR_NOT_NULL(pauline->stat.dtmf_list_received); + BC_ASSERT_PTR_NOT_NULL(pauline->stat.dtmf_list_received); if (pauline->stat.dtmf_list_received) { - CU_ASSERT_STRING_EQUAL(pauline->stat.dtmf_list_received, expected); + BC_ASSERT_STRING_EQUAL(pauline->stat.dtmf_list_received, expected); } ms_free(expected); } else { - CU_ASSERT_PTR_NULL(pauline->stat.dtmf_list_received); + BC_ASSERT_PTR_NULL(pauline->stat.dtmf_list_received); } } void send_dtmf_cleanup() { - CU_ASSERT_PTR_NULL(marie_call->dtmfs_timer); - CU_ASSERT_PTR_NULL(marie_call->dtmf_sequence); + BC_ASSERT_PTR_NULL(marie_call->dtmfs_timer); + BC_ASSERT_PTR_NULL(marie_call->dtmf_sequence); /*just to sleep*/ linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -116,7 +116,7 @@ static void send_dtmfs_sequence_sip_info() { static void send_dtmfs_sequence_not_ready() { marie = linphone_core_manager_new( "marie_rc"); - CU_ASSERT_EQUAL(linphone_call_send_dtmfs(linphone_core_get_current_call(marie->lc), "123"), -1); + BC_ASSERT_EQUAL(linphone_call_send_dtmfs(linphone_core_get_current_call(marie->lc), "123"), -1, int, "%d"); linphone_core_manager_destroy(marie); } @@ -127,13 +127,13 @@ static void send_dtmfs_sequence_call_state_changed() { linphone_call_send_dtmfs(marie_call, "123456789123456789"); /*just after, change call state, and expect DTMF to be canceled*/ linphone_core_pause_call(marie_call->core,marie_call); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallPausing,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallPaused,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallPausing,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallPaused,1)); /*wait a few time to ensure that no DTMF are received*/ wait_for_until(marie->lc, pauline->lc, NULL, 0, 1000); - CU_ASSERT_PTR_NULL(pauline->stat.dtmf_list_received); + BC_ASSERT_PTR_NULL(pauline->stat.dtmf_list_received); send_dtmf_cleanup(); } diff --git a/tester/eventapi_tester.c b/tester/eventapi_tester.c index fbe48f9a4..8ac8e2c18 100644 --- a/tester/eventapi_tester.c +++ b/tester/eventapi_tester.c @@ -17,8 +17,7 @@ */ -#include -#include "CUnit/Basic.h" + #include "linphonecore.h" #include "private.h" #include "lpconfig.h" @@ -39,8 +38,8 @@ const char *liblinphone_tester_get_notify_content(void){ void linphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *eventname, const LinphoneContent *content){ LinphoneCoreManager *mgr; - CU_ASSERT_PTR_NOT_NULL_FATAL(content); - CU_ASSERT_TRUE(strcmp(notify_content,(const char*)linphone_content_get_buffer(content))==0); + BC_ASSERT_PTR_NOT_NULL_FATAL(content); + BC_ASSERT_TRUE(strcmp(notify_content,(const char*)linphone_content_get_buffer(content))==0); mgr=get_manager(lc); mgr->stat.number_of_NotifyReceived++; } @@ -55,7 +54,7 @@ void linphone_subscription_state_change(LinphoneCore *lc, LinphoneEvent *lev, Li linphone_content_set_type(content,"application"); linphone_content_set_subtype(content,"somexml2"); linphone_content_set_buffer(content,notify_content,strlen(notify_content)); - + ms_message("Subscription state [%s] from [%s]",linphone_subscription_state_to_string(state),from); ms_free(from); @@ -107,10 +106,10 @@ void linphone_publish_state_changed(LinphoneCore *lc, LinphoneEvent *ev, Linphon ms_free(from); switch(state){ case LinphonePublishProgress: counters->number_of_LinphonePublishProgress++; break; - case LinphonePublishOk: + case LinphonePublishOk: /*make sure custom header access API is working*/ - CU_ASSERT_PTR_NOT_NULL(linphone_event_get_custom_header(ev,"From")); - counters->number_of_LinphonePublishOk++; + BC_ASSERT_PTR_NOT_NULL(linphone_event_get_custom_header(ev,"From")); + counters->number_of_LinphonePublishOk++; break; case LinphonePublishError: counters->number_of_LinphonePublishError++; break; case LinphonePublishExpiring: counters->number_of_LinphonePublishExpiring++; break; @@ -118,7 +117,7 @@ void linphone_publish_state_changed(LinphoneCore *lc, LinphoneEvent *ev, Linphon default: break; } - + } static void subscribe_test_declined(void) { @@ -140,16 +139,16 @@ static void subscribe_test_declined(void) { lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",600,content); linphone_event_ref(lev); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionError,1,21000));/*yes flexisip may wait 20 secs in case of forking*/ + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionError,1,21000));/*yes flexisip may wait 20 secs in case of forking*/ ei=linphone_event_get_error_info(lev); - CU_ASSERT_PTR_NOT_NULL(ei); + BC_ASSERT_PTR_NOT_NULL(ei); if (ei){ - CU_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),603); - CU_ASSERT_PTR_NOT_NULL(linphone_error_info_get_phrase(ei)); + BC_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),603, int, "%d"); + BC_ASSERT_PTR_NOT_NULL(linphone_error_info_get_phrase(ei)); } - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000)); linphone_content_unref(content); linphone_event_unref(lev); @@ -183,33 +182,33 @@ static void subscribe_test_with_args(bool_t terminated_by_subscriber, RefreshTes linphone_content_set_buffer(content,subscribe_content,strlen(subscribe_content)); lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",expires,content); - - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,1,1000)); + + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,1,1000)); /*make sure marie receives first notification before terminating*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,1000)); if (refresh_type==AutoRefresh){ wait_for_list(lcs,NULL,0,6000); - CU_ASSERT_TRUE(linphone_event_get_subscription_state(pauline->lev)==LinphoneSubscriptionActive); + BC_ASSERT_TRUE(linphone_event_get_subscription_state(pauline->lev)==LinphoneSubscriptionActive); }else if (refresh_type==ManualRefresh){ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionExpiring,1,4000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionExpiring,1,4000)); linphone_event_update_subscribe(lev,NULL); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,2,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,2,2000)); } if (terminated_by_subscriber){ linphone_event_terminate(lev); }else{ - CU_ASSERT_PTR_NOT_NULL_FATAL(pauline->lev); + BC_ASSERT_PTR_NOT_NULL_FATAL(pauline->lev); linphone_event_terminate(pauline->lev); } - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000)); linphone_content_unref(content); linphone_core_manager_destroy(marie); @@ -223,7 +222,7 @@ static void subscribe_test_with_args2(bool_t terminated_by_subscriber, RefreshTe LinphoneEvent *lev; int expires= refresh_type!=NoRefresh ? 4 : 600; MSList* lcs=ms_list_append(NULL,marie->lc); - + lcs=ms_list_append(lcs,pauline->lc); if (refresh_type==ManualRefresh){ @@ -240,37 +239,37 @@ static void subscribe_test_with_args2(bool_t terminated_by_subscriber, RefreshTe linphone_event_add_custom_header(lev,"My-Header2","pimpon"); linphone_event_send_subscribe(lev,content); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000)); /*check good receipt of custom headers*/ - CU_ASSERT_STRING_EQUAL(linphone_event_get_custom_header(pauline->lev,"My-Header"),"pouet"); - CU_ASSERT_STRING_EQUAL(linphone_event_get_custom_header(pauline->lev,"My-Header2"),"pimpon"); - - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,5000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,1,5000)); + BC_ASSERT_STRING_EQUAL(linphone_event_get_custom_header(pauline->lev,"My-Header"),"pouet"); + BC_ASSERT_STRING_EQUAL(linphone_event_get_custom_header(pauline->lev,"My-Header2"),"pimpon"); + + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,1,5000)); /*make sure marie receives first notification before terminating*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,5000)); - + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,5000)); + if (refresh_type==AutoRefresh){ wait_for_list(lcs,NULL,0,6000); - CU_ASSERT_TRUE(linphone_event_get_subscription_state(pauline->lev)==LinphoneSubscriptionActive); + BC_ASSERT_TRUE(linphone_event_get_subscription_state(pauline->lev)==LinphoneSubscriptionActive); }else if (refresh_type==ManualRefresh){ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionExpiring,1,4000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionExpiring,1,4000)); linphone_event_update_subscribe(lev,NULL); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,2,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,2,5000)); } if (terminated_by_subscriber){ linphone_event_terminate(lev); }else{ - CU_ASSERT_PTR_NOT_NULL_FATAL(pauline->lev); + BC_ASSERT_PTR_NOT_NULL_FATAL(pauline->lev); linphone_event_terminate(pauline->lev); } - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,5000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,5000)); linphone_content_unref(content); linphone_core_manager_destroy(marie); @@ -285,7 +284,7 @@ static void subscribe_test_terminated_by_notifier(void){ subscribe_test_with_args(FALSE,NoRefresh); } -/* Caution: this test does not really check that the subscribe are refreshed, because the core is not managing the expiration of +/* Caution: this test does not really check that the subscribe are refreshed, because the core is not managing the expiration of * unrefreshed subscribe dialogs. So it is just checking that it is not crashing. */ static void subscribe_test_refreshed(void){ @@ -320,21 +319,21 @@ static void publish_test_with_args(bool_t refresh, int expires){ linphone_event_send_publish(lev,content); linphone_event_ref(lev); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishProgress,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishProgress,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,3000)); if (!refresh){ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishExpiring,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishExpiring,1,5000)); linphone_event_update_publish(lev,content); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishProgress,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishProgress,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,3000)); }else{ - + } linphone_event_terminate(lev); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishCleared,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishCleared,1,3000)); linphone_event_unref(lev); diff --git a/tester/flexisip_tester.c b/tester/flexisip_tester.c index d32740440..9c381aea3 100644 --- a/tester/flexisip_tester.c +++ b/tester/flexisip_tester.c @@ -16,8 +16,7 @@ along with this program. If not, see . */ -#include -#include "CUnit/Basic.h" + #include "linphonecore.h" #include "lpconfig.h" #include "private.h" @@ -42,13 +41,13 @@ static void subscribe_forking(void) { lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",expires,content); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline2->stat.number_of_LinphoneSubscriptionIncomingReceived,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline2->stat.number_of_LinphoneSubscriptionIncomingReceived,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,1000)); /*make sure marie receives first notification before terminating*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,1000)); linphone_event_terminate(lev); @@ -72,10 +71,10 @@ static void message_forking(void) { lcs=ms_list_append(lcs,marie2->lc); linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,1000)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,1000)); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d"); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(marie2); linphone_core_manager_destroy(pauline); @@ -102,21 +101,21 @@ static void message_forking_with_unreachable_recipients(void) { linphone_core_set_network_reachable(marie3->lc,FALSE); linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,1000)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1); - CU_ASSERT_TRUE( marie2->stat.number_of_LinphoneMessageReceived==0); - CU_ASSERT_TRUE( marie3->stat.number_of_LinphoneMessageReceived==0); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,1000)); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d"); + BC_ASSERT_TRUE( marie2->stat.number_of_LinphoneMessageReceived==0); + BC_ASSERT_TRUE( marie3->stat.number_of_LinphoneMessageReceived==0); /*marie 2 goes online */ linphone_core_set_network_reachable(marie2->lc,TRUE); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,3000)); /*wait a long time so that all transactions are expired*/ wait_for_list(lcs,NULL,0,32000); /*marie 3 goes online now*/ linphone_core_set_network_reachable(marie3->lc,TRUE); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneMessageReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneMessageReceived,1,3000)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(marie2); @@ -146,27 +145,27 @@ static void message_forking_with_all_recipients_unreachable(void) { linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageInProgress,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageInProgress,1,5000)); /*flexisip will accept the message with 202 after 16 seconds*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,18000)); - CU_ASSERT_TRUE( marie->stat.number_of_LinphoneMessageReceived==0); - CU_ASSERT_TRUE( marie2->stat.number_of_LinphoneMessageReceived==0); - CU_ASSERT_TRUE( marie3->stat.number_of_LinphoneMessageReceived==0); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,18000)); + BC_ASSERT_TRUE( marie->stat.number_of_LinphoneMessageReceived==0); + BC_ASSERT_TRUE( marie2->stat.number_of_LinphoneMessageReceived==0); + BC_ASSERT_TRUE( marie3->stat.number_of_LinphoneMessageReceived==0); /*marie 1 goes online */ linphone_core_set_network_reachable(marie->lc,TRUE); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000)); /*marie 2 goes online */ linphone_core_set_network_reachable(marie2->lc,TRUE); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,3000)); /*wait a long time so that all transactions are expired*/ wait_for_list(lcs,NULL,0,32000); /*marie 3 goes online now*/ linphone_core_set_network_reachable(marie3->lc,TRUE); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneMessageReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneMessageReceived,1,3000)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(marie2); @@ -193,26 +192,26 @@ static void call_forking(void){ linphone_core_invite_address(pauline->lc,marie->identity); /*pauline should hear ringback*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000)); /*all devices from Marie should be ringing*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,3000)); /*marie accepts the call on its first device*/ linphone_core_accept_call(marie->lc,linphone_core_get_current_call(marie->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000)); /*other devices should stop ringing*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000)); linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); @@ -237,27 +236,27 @@ static void call_forking_with_urgent_reply(void){ linphone_core_set_user_agent(marie3->lc,"Natted Linphone",NULL); linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL); - CU_ASSERT_TRUE(linphone_core_media_encryption_supported(pauline->lc,LinphoneMediaEncryptionSRTP)); + BC_ASSERT_TRUE(linphone_core_media_encryption_supported(pauline->lc,LinphoneMediaEncryptionSRTP)); linphone_core_set_media_encryption(pauline->lc,LinphoneMediaEncryptionSRTP); linphone_core_set_network_reachable(marie2->lc,FALSE); linphone_core_set_network_reachable(marie3->lc,FALSE); linphone_core_invite_address(pauline->lc,marie->identity); /*pauline should hear ringback, after 5 seconds, when it will retry without SRTP*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,9000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,9000)); /*Marie should be ringing*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000)); /*marie accepts the call on its first device*/ linphone_core_accept_call(marie->lc,linphone_core_get_current_call(marie->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000)); linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); @@ -284,20 +283,20 @@ static void call_forking_cancelled(void){ linphone_core_invite_address(pauline->lc,marie->identity); /*pauline should hear ringback*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000)); /*all devices from Marie should be ringing*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,1000)); /*pauline finally cancels the call*/ linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); /*all devices should stop ringing*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000)); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); @@ -324,11 +323,11 @@ static void call_forking_declined(bool_t declined_globaly){ linphone_core_invite_address(pauline->lc,marie->identity); /*pauline should hear ringback*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000)); /*all devices from Marie should be ringing*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,1000)); /*marie1 finally declines the call*/ linphone_core_decline_call(marie->lc,linphone_core_get_current_call(marie->lc), @@ -336,22 +335,22 @@ static void call_forking_declined(bool_t declined_globaly){ ); if (declined_globaly){ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); /*all devices should stop ringing*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000)); }else{ /*pauline should continue ringing and be able to hear a call taken by marie2 */ linphone_core_accept_call(marie2->lc, linphone_core_get_current_call(marie2->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallStreamsRunning,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallStreamsRunning,1,2000)); liblinphone_tester_check_rtcp(pauline,marie2); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,3000)); linphone_core_terminate_call(marie2->lc,linphone_core_get_current_call(marie2->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,3000)); } linphone_core_manager_destroy(pauline); @@ -390,22 +389,22 @@ static void call_forking_with_push_notification_single(void){ linphone_core_set_network_reachable(marie->lc,TRUE); /*Marie shall receive the call immediately*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,5000)); /*pauline should hear ringback as well*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,1000)); /*marie accepts the call*/ linphone_core_accept_call(marie->lc,linphone_core_get_current_call(marie->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,5000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000)); liblinphone_tester_check_rtcp(pauline,marie); linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,5000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,5000)); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); @@ -432,32 +431,32 @@ static void call_forking_with_push_notification_multiple(void){ linphone_core_invite_address(pauline->lc,marie->identity); /*marie1 will ring*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,5000)); /*pauline should hear ringback as well*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,1000)); /*the server is expected to send a push notification to marie2, this will wake up linphone, that will reconnect:*/ linphone_core_set_network_reachable(marie2->lc,TRUE); /*Marie shall receive the call immediately*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,5000)); /*marie2 accepts the call*/ linphone_core_accept_call(marie2->lc,linphone_core_get_current_call(marie2->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallConnected,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallStreamsRunning,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallConnected,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallStreamsRunning,1,1000)); /*call to marie1 should be cancelled*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); liblinphone_tester_check_rtcp(pauline,marie2); linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000)); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); @@ -482,18 +481,18 @@ static void call_forking_not_responded(void){ linphone_core_invite_address(pauline->lc,marie->identity); /*pauline should hear ringback*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000)); /*all devices from Marie should be ringing*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,1000)); /*nobody answers, flexisip should close the call after XX seconds*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallError,1,22000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallError,1,22000)); /*all devices should stop ringing*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000)); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); @@ -541,10 +540,10 @@ static void early_media_call_forking(void) { linphone_core_invite_address_with_params(pauline->lc,marie1->identity,params); linphone_call_params_destroy(params); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,3000)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,3000)); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1, int, "%d"); pauline_call=linphone_core_get_current_call(pauline->lc); marie1_call=linphone_core_get_current_call(marie1->lc); @@ -552,30 +551,30 @@ static void early_media_call_forking(void) { /*wait a bit that streams are established*/ wait_for_list(lcs,&dummy,1,6000); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>60 + BC_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>60 && linphone_call_get_audio_stats(pauline_call)->download_bandwidth<99); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>60 + BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>60 && linphone_call_get_audio_stats(marie1_call)->download_bandwidth<99); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie2_call)->download_bandwidth>60 + BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie2_call)->download_bandwidth>60 && linphone_call_get_audio_stats(marie2_call)->download_bandwidth<99); linphone_core_accept_call(marie1->lc,linphone_core_get_current_call(marie1->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallStreamsRunning,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallStreamsRunning,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,3000)); /*marie2 should get her call terminated*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000)); /*wait a bit that streams are established*/ wait_for_list(lcs,&dummy,1,3000); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>60 + BC_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>60 && linphone_call_get_audio_stats(pauline_call)->download_bandwidth<99 ); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>60 + BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>60 && linphone_call_get_audio_stats(marie1_call)->download_bandwidth<99 ); linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,5000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallEnd,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallEnd,1,5000)); ms_list_free(lcs); linphone_core_manager_destroy(marie1); @@ -599,23 +598,23 @@ static void call_with_sips(void){ linphone_core_invite_address(marie->lc,pauline1->identity); /*marie should hear ringback*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingRinging,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingRinging,1,3000)); /*Only the sips registered device from pauline should ring*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallIncomingReceived,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallIncomingReceived,1,1000)); /*pauline accepts the call */ linphone_core_accept_call(pauline1->lc,linphone_core_get_current_call(pauline1->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallConnected,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallStreamsRunning,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallConnected,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallStreamsRunning,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000)); /*pauline2 should not have ring*/ - CU_ASSERT_TRUE(pauline2->stat.number_of_LinphoneCallIncomingReceived==0); + BC_ASSERT_TRUE(pauline2->stat.number_of_LinphoneCallIncomingReceived==0); linphone_core_terminate_call(pauline1->lc,linphone_core_get_current_call(pauline1->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallEnd,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallEnd,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,3000)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline1); @@ -643,11 +642,11 @@ static void call_with_sips_not_achievable(void){ linphone_address_unref(dest); /*Call should be rejected by server with 480*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallError,1,6000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallError,1,6000)); ei=linphone_call_get_error_info(call); - CU_ASSERT_PTR_NOT_NULL(ei); + BC_ASSERT_PTR_NOT_NULL(ei); if (ei){ - CU_ASSERT_EQUAL(linphone_error_info_get_reason(ei), LinphoneReasonTemporarilyUnavailable); + BC_ASSERT_EQUAL(linphone_error_info_get_reason(ei), LinphoneReasonTemporarilyUnavailable, int, "%d"); } linphone_core_manager_destroy(marie); @@ -680,20 +679,20 @@ static void call_with_ipv6(void) { linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL); linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL); - CU_ASSERT_TRUE(call(marie,pauline)); + BC_ASSERT_TRUE(call(marie,pauline)); pauline_call=linphone_core_get_current_call(pauline->lc); - CU_ASSERT_PTR_NOT_NULL(pauline_call); + BC_ASSERT_PTR_NOT_NULL(pauline_call); if (pauline_call){ /*check that the remote contact is IPv6*/ const char *contact=linphone_call_get_remote_contact(pauline_call); LinphoneAddress *ct_addr; - CU_ASSERT_PTR_NOT_NULL(contact); + BC_ASSERT_PTR_NOT_NULL(contact); if (contact){ ct_addr=linphone_address_new(contact); - CU_ASSERT_PTR_NOT_NULL(ct_addr); + BC_ASSERT_PTR_NOT_NULL(ct_addr); if (ct_addr){ - CU_ASSERT_TRUE(strchr(linphone_address_get_domain(ct_addr),':')!=NULL); + BC_ASSERT_TRUE(strchr(linphone_address_get_domain(ct_addr),':')!=NULL); } linphone_address_destroy(ct_addr); } @@ -707,7 +706,7 @@ static void call_with_ipv6(void) { liblinphone_tester_enable_ipv6(FALSE); leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } @@ -727,13 +726,13 @@ static void file_transfer_message_rcs_to_external_body_client(void) { LinphoneCoreManager* marie = linphone_core_manager_init( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_init( "pauline_rc"); - + linphone_proxy_config_set_custom_header(marie->lc->default_proxy, "Accept", "application/sdp"); linphone_core_manager_start(marie, "marie_rc", TRUE); - + linphone_proxy_config_set_custom_header(pauline->lc->default_proxy, "Accept", "application/sdp, text/plain, application/vnd.gsma.rcs-ft-http+xml"); linphone_core_manager_start(pauline, "pauline_rc", TRUE); - + reset_counters(&marie->stat); reset_counters(&pauline->stat); @@ -767,7 +766,7 @@ static void file_transfer_message_rcs_to_external_body_client(void) { linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed); linphone_chat_message_cbs_set_file_transfer_send(cbs, file_transfer_send); linphone_chat_room_send_chat_message(chat_room,message); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageExtBodyReceived,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageExtBodyReceived,1)); fclose(file_to_send); if (marie->stat.last_received_chat_message ) { cbs = linphone_chat_message_get_callbacks(marie->stat.last_received_chat_message); @@ -775,12 +774,12 @@ static void file_transfer_message_rcs_to_external_body_client(void) { linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received); linphone_chat_message_download_file(marie->stat.last_received_chat_message); } - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageFileTransferDone,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageFileTransferDone,1)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,1); - CU_ASSERT_TRUE(compare_files(send_filepath, receive_filepath)); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,1, int, "%d"); + BC_ASSERT_TRUE(compare_files(send_filepath, receive_filepath)); linphone_content_unref(content); linphone_core_manager_destroy(marie); @@ -807,29 +806,29 @@ static void send_file_transfer_message_using_external_body_url(LinphoneCoreManag linphone_chat_message_set_external_body_url(message, "https://www.linphone.org:444//tmp/54ec58280ace9_c30709218df8eaba61d1.jpg"); linphone_chat_room_send_chat_message(chat_room, message); - CU_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1)); + BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1)); if (marie->stat.last_received_chat_message) { linphone_chat_message_download_file(marie->stat.last_received_chat_message); } - CU_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageExtBodyReceived, 1)); + BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageExtBodyReceived, 1)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress, 1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived, 1); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress, 1, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived, 1, int, "%d"); } static void file_transfer_message_external_body_to_external_body_client(void) { LinphoneCoreManager* marie = linphone_core_manager_init( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_init( "pauline_rc"); - + linphone_proxy_config_set_custom_header(marie->lc->default_proxy, "Accept", "application/sdp"); linphone_core_manager_start(marie, "marie_rc", TRUE); - + linphone_proxy_config_set_custom_header(pauline->lc->default_proxy, "Accept", "application/sdp"); linphone_core_manager_start(pauline, "pauline_rc", TRUE); - + reset_counters(&marie->stat); reset_counters(&pauline->stat); - + linphone_core_refresh_registers(marie->lc); linphone_core_refresh_registers(pauline->lc); @@ -842,13 +841,13 @@ static void file_transfer_message_external_body_to_external_body_client(void) { static void file_transfer_message_external_body_to_rcs_client(void) { LinphoneCoreManager* marie = linphone_core_manager_init( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_init( "pauline_rc"); - + linphone_proxy_config_set_custom_header(marie->lc->default_proxy, "Accept", "application/sdp"); linphone_core_manager_start(marie, "marie_rc", TRUE); - + linphone_proxy_config_set_custom_header(pauline->lc->default_proxy, "Accept", "application/sdp, text/plain, application/vnd.gsma.rcs-ft-http+xml"); linphone_core_manager_start(pauline, "pauline_rc", TRUE); - + reset_counters(&marie->stat); reset_counters(&pauline->stat); @@ -865,13 +864,13 @@ static void dos_module_trigger(void) { int number_of_messge_to_send = 100; LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_rc"); - + reset_counters(&marie->stat); reset_counters(&pauline->stat); - + to = linphone_address_as_string(marie->identity); chat_room = linphone_core_create_chat_room(pauline->lc,to); - + do { char msg[128]; sprintf(msg, "Flood message number %i", i); @@ -880,15 +879,15 @@ static void dos_module_trigger(void) { i++; } while (i < number_of_messge_to_send); // At this point we should be banned for a minute - + ms_usleep(90000000); // Wait 90 seconds to ensure we are not banned anymore - CU_ASSERT_TRUE(marie->stat.number_of_LinphoneMessageReceived < number_of_messge_to_send); - + BC_ASSERT_TRUE(marie->stat.number_of_LinphoneMessageReceived < number_of_messge_to_send); + reset_counters(&marie->stat); reset_counters(&pauline->stat); - + linphone_chat_room_send_message(chat_room, "This one should pass through"); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived, 1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived, 1)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); diff --git a/tester/liblinphone_tester.c b/tester/liblinphone_tester.c index 0469b3675..d4f42190d 100644 --- a/tester/liblinphone_tester.c +++ b/tester/liblinphone_tester.c @@ -16,8 +16,7 @@ along with this program. If not, see . */ -#include -#include "CUnit/Basic.h" + #include "linphonecore.h" #include "private.h" #include "liblinphone_tester.h" @@ -28,7 +27,6 @@ #include #endif - static FILE * log_file = NULL; #ifdef ANDROID diff --git a/tester/log_collection_tester.c b/tester/log_collection_tester.c index 9a5d8b179..683e9ecd7 100644 --- a/tester/log_collection_tester.c +++ b/tester/log_collection_tester.c @@ -136,7 +136,7 @@ static FILE* gzuncompress(const char* filepath) { memset(buffer, 0, strlen(buffer)); } fclose(output); - CU_ASSERT_EQUAL(gzclose(file), Z_OK); + BC_ASSERT_EQUAL(gzclose(file), Z_OK, int, "%d"); ret=fopen(newname, "rb"); ms_free(newname); return ret; @@ -169,7 +169,7 @@ static time_t check_file(LinphoneCoreManager* mgr) { uint32_t timediff = 0; FILE *file = NULL; - CU_ASSERT_PTR_NOT_NULL(filepath); + BC_ASSERT_PTR_NOT_NULL(filepath); if (filepath != NULL) { int line_count = 0; @@ -186,10 +186,10 @@ static time_t check_file(LinphoneCoreManager* mgr) { #else file = fopen(filepath, "rb"); #endif - CU_ASSERT_PTR_NOT_NULL(file); + BC_ASSERT_PTR_NOT_NULL(file); if (!file) return 0; // 1) expect to find folder name in filename path - CU_ASSERT_PTR_NOT_NULL(strstr(filepath, bc_tester_writable_dir_prefix)); + BC_ASSERT_PTR_NOT_NULL(strstr(filepath, bc_tester_writable_dir_prefix)); // 2) check file contents while (getline(&line, &line_size, file) != -1) { @@ -205,13 +205,13 @@ static time_t check_file(LinphoneCoreManager* mgr) { if (strptime(date, "%Y-%m-%d %H:%M:%S", &tm_curr) != NULL) { tm_curr.tm_isdst = -1; // LOL log_time = mktime(&tm_curr); - CU_ASSERT_TRUE(log_time >= time_prev); + BC_ASSERT_TRUE(log_time >= time_prev); time_prev = log_time; } } #endif } - CU_ASSERT_TRUE(line_count > 25); + BC_ASSERT_TRUE(line_count > 25); free(line); fclose(file); ms_free(filepath); @@ -220,7 +220,7 @@ static time_t check_file(LinphoneCoreManager* mgr) { timediff = labs((long int)log_time - (long int)cur_time); (void)timediff; #ifndef WIN32 - CU_ASSERT_TRUE( timediff <= 1 ); + BC_ASSERT_TRUE( timediff <= 1 ); if( !(timediff <= 1) ){ char buffers[2][128] = {{0}}; strftime(buffers[0], sizeof(buffers[0]), "%Y-%m-%d %H:%M:%S", localtime(&log_time)); @@ -242,7 +242,7 @@ static time_t check_file(LinphoneCoreManager* mgr) { static void collect_files_disabled() { LinphoneCoreManager* marie = setup(FALSE); - CU_ASSERT_PTR_NULL(linphone_core_compress_log_collection(marie->lc)); + BC_ASSERT_PTR_NULL(linphone_core_compress_log_collection(marie->lc)); collect_cleanup(marie); } @@ -282,7 +282,7 @@ static void logCollectionUploadStateChangedCb(LinphoneCore *lc, LinphoneCoreLogC break; case LinphoneCoreLogCollectionUploadStateDelivered: counters->number_of_LinphoneCoreLogCollectionUploadStateDelivered++; - CU_ASSERT_TRUE(strlen(info)>0) + BC_ASSERT_GREATER(strlen(info), 0, int, "%d"); break; case LinphoneCoreLogCollectionUploadStateNotDelivered: counters->number_of_LinphoneCoreLogCollectionUploadStateNotDelivered++; @@ -302,7 +302,7 @@ static void upload_collected_traces() { while (--waiting) ms_error("(test error)Waiting %d...", waiting); linphone_core_compress_log_collection(marie->lc); linphone_core_upload_log_collection(marie->lc); - CU_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,1)); /*try 2 times*/ waiting=100; @@ -310,7 +310,7 @@ static void upload_collected_traces() { while (--waiting) ms_error("(test error)Waiting %d...", waiting); linphone_core_compress_log_collection(marie->lc); linphone_core_upload_log_collection(marie->lc); - CU_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,2)); + BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,2)); collect_cleanup(marie); } diff --git a/tester/message_tester.c b/tester/message_tester.c index 506d714d7..b78962885 100644 --- a/tester/message_tester.c +++ b/tester/message_tester.c @@ -17,8 +17,7 @@ */ -#include -#include "CUnit/Basic.h" + #include "linphonecore.h" #include "private.h" #include "liblinphone_tester.h" @@ -54,7 +53,7 @@ void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMess } else if (linphone_chat_message_get_external_body_url(message)) { counters->number_of_LinphoneMessageExtBodyReceived++; if (message_external_body_url) { - CU_ASSERT_STRING_EQUAL(linphone_chat_message_get_external_body_url(message),message_external_body_url); + BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_external_body_url(message),message_external_body_url); message_external_body_url=NULL; } } @@ -199,10 +198,10 @@ static void text_message(void) { reset_counters(&pauline->stat); } linphone_chat_room_send_message(chat_room,"Bla bla bla bla"); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1, int, "%d"); - CU_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -225,12 +224,12 @@ static void text_message_within_dialog(void) { reset_counters(&marie->stat); reset_counters(&pauline->stat); } - CU_ASSERT_TRUE(call(marie,pauline)); + BC_ASSERT_TRUE(call(marie,pauline)); linphone_chat_room_send_message(chat_room,"Bla bla bla bla"); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); - CU_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -268,10 +267,10 @@ static void text_message_with_credential_from_auth_cb(void) { reset_counters(&pauline->stat); } linphone_chat_room_send_message(chat_room,"Bla bla bla bla"); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1, int, "%d"); - CU_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -293,7 +292,7 @@ static void text_message_with_privacy(void) { linphone_core_get_default_proxy(pauline->lc,&pauline_proxy); linphone_proxy_config_set_privacy(pauline_proxy,LinphonePrivacyId); - CU_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity)); { int dummy=0; wait_for_until(marie->lc,pauline->lc,&dummy,1,100); /*just to have time to purge message stored in the server*/ @@ -301,8 +300,8 @@ static void text_message_with_privacy(void) { reset_counters(&pauline->stat); } linphone_chat_room_send_message(chat_room,"Bla bla bla bla"); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1, int, "%d"); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -320,7 +319,7 @@ static void text_message_compatibility_mode(void) { LinphoneChatRoom* chat_room; linphone_core_get_default_proxy(marie->lc,&proxy); - CU_ASSERT_PTR_NOT_NULL (proxy); + BC_ASSERT_PTR_NOT_NULL (proxy); proxy_address=linphone_address_new(linphone_proxy_config_get_addr(proxy)); linphone_address_clean(proxy_address); tmp=linphone_address_as_string_uri_only(proxy_address); @@ -337,7 +336,7 @@ static void text_message_compatibility_mode(void) { linphone_core_set_sip_transports(marie->lc,&transport); marie->stat.number_of_LinphoneRegistrationOk=0; - CU_ASSERT_TRUE (wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneRegistrationOk,1)); + BC_ASSERT_TRUE (wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneRegistrationOk,1)); chat_room = linphone_core_create_chat_room(marie->lc,to); { @@ -347,8 +346,8 @@ static void text_message_compatibility_mode(void) { reset_counters(&pauline->stat); } linphone_chat_room_send_message(chat_room,"Bla bla bla bla"); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageReceived,1)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageReceivedLegacy,1); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageReceived,1)); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageReceivedLegacy,1, int, "%d"); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } @@ -376,15 +375,15 @@ static void text_message_with_ack(void) { reset_counters(&pauline->stat); linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed); linphone_chat_room_send_chat_message(chat_room,message); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1)); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d"); ms_free(to); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } @@ -410,16 +409,16 @@ static void text_message_with_external_body(void) { linphone_chat_room_send_chat_message(chat_room,message); /* check transient message list: the message should be in it, and should be the only one */ - CU_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 1); - CU_ASSERT_EQUAL(ms_list_nth_data(chat_room->transient_messages,0), message); + BC_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 1, int, "%d"); + BC_ASSERT_PTR_EQUAL(ms_list_nth_data(chat_room->transient_messages,0), message); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,1); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,1, int, "%d"); - CU_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 0); + BC_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 0, int, "%d"); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -487,7 +486,7 @@ static void file_transfer_message(void) { linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed); linphone_chat_message_cbs_set_file_transfer_send(cbs, file_transfer_send); linphone_chat_room_send_chat_message(chat_room,message); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1)); fclose(file_to_send); if (marie->stat.last_received_chat_message ) { cbs = linphone_chat_message_get_callbacks(marie->stat.last_received_chat_message); @@ -495,12 +494,12 @@ static void file_transfer_message(void) { linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received); linphone_chat_message_download_file(marie->stat.last_received_chat_message); } - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1); - CU_ASSERT_TRUE(compare_files(send_filepath, receive_filepath)); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1, int, "%d"); + BC_ASSERT_TRUE(compare_files(send_filepath, receive_filepath)); linphone_content_unref(content); linphone_core_manager_destroy(marie); @@ -554,18 +553,18 @@ static void small_file_transfer_message(void) { linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed); linphone_chat_message_cbs_set_file_transfer_send(cbs, memory_file_transfer_send); linphone_chat_room_send_chat_message(chat_room,message); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1)); if (marie->stat.last_received_chat_message ) { cbs = linphone_chat_message_get_callbacks(marie->stat.last_received_chat_message); linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed); linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received); linphone_chat_message_download_file(marie->stat.last_received_chat_message); } - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1, int, "%d"); linphone_content_unref(content); linphone_core_manager_destroy(marie); @@ -641,18 +640,18 @@ static void lime_file_transfer_message(void) { linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed); linphone_chat_message_cbs_set_file_transfer_send(cbs, memory_file_transfer_send); linphone_chat_room_send_chat_message(chat_room,message); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1)); if (marie->stat.last_received_chat_message ) { cbs = linphone_chat_message_get_callbacks(marie->stat.last_received_chat_message); linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed); linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received); linphone_chat_message_download_file(marie->stat.last_received_chat_message); } - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1, int, "%d"); linphone_content_unref(content); linphone_core_manager_destroy(marie); @@ -842,10 +841,10 @@ static void lime_text_message(void) { ms_free(to); linphone_chat_room_send_message(chat_room,"Bla bla bla bla"); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1, int, "%d"); - CU_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity)); /* TODO : check the message arrived correctly deciphered */ linphone_core_manager_destroy(marie); @@ -901,18 +900,18 @@ static void file_transfer_message_io_error_upload(void) { linphone_chat_room_send_chat_message(chat_room,message); /*wait for file to be 25% uploaded and simultate a network error*/ - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.progress_of_LinphoneFileTransfer,25)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.progress_of_LinphoneFileTransfer,25)); sal_set_send_error(pauline->lc->sal, -1); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageNotDelivered,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageNotDelivered,1)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageNotDelivered,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageNotDelivered,1, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0, int, "%d"); sal_set_send_error(pauline->lc->sal, 0); linphone_core_refresh_registers(pauline->lc); /*to make sure registration is back in registered and so it can be later unregistered*/ - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneRegistrationOk,pauline->stat.number_of_LinphoneRegistrationOk+1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneRegistrationOk,pauline->stat.number_of_LinphoneRegistrationOk+1)); linphone_content_unref(content); linphone_core_manager_destroy(marie); @@ -965,21 +964,21 @@ static void file_transfer_message_io_error_download(void) { linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc); /* wait for marie to receive pauline's message */ - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1)); if (marie->stat.last_received_chat_message ) { /* get last message and use it to download file */ linphone_chat_message_start_file_download(marie->stat.last_received_chat_message, liblinphone_tester_chat_message_state_change, marie->lc); /* wait for file to be 50% downloaded */ - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.progress_of_LinphoneFileTransfer, 50)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.progress_of_LinphoneFileTransfer, 50)); /* and simulate network error */ sal_set_recv_error(marie->lc->sal, -1); } - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageNotDelivered,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageNotDelivered,1, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0, int, "%d"); sal_set_recv_error(marie->lc->sal, 0); linphone_core_manager_destroy(marie); @@ -1035,13 +1034,13 @@ static void file_transfer_message_upload_cancelled(void) { linphone_chat_room_send_chat_message(chat_room,message); /*wait for file to be 50% uploaded and cancel the transfer */ - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.progress_of_LinphoneFileTransfer, 50)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.progress_of_LinphoneFileTransfer, 50)); linphone_chat_message_cancel_file_transfer(message); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageNotDelivered,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageNotDelivered,1)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageNotDelivered,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageNotDelivered,1, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0, int, "%d"); linphone_content_unref(content); linphone_core_manager_destroy(marie); @@ -1092,21 +1091,21 @@ static void file_transfer_message_download_cancelled(void) { linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc); /* wait for marie to receive pauline's message */ - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1)); if (marie->stat.last_received_chat_message ) { /* get last message and use it to download file */ linphone_chat_message_start_file_download(marie->stat.last_received_chat_message, liblinphone_tester_chat_message_state_change, marie->lc); /* wait for file to be 50% downloaded */ - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.progress_of_LinphoneFileTransfer, 50)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.progress_of_LinphoneFileTransfer, 50)); /* and cancel the transfer */ linphone_chat_message_cancel_file_transfer(marie->stat.last_received_chat_message); } - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageNotDelivered,1); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageNotDelivered,1, int, "%d"); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -1140,12 +1139,12 @@ static void file_transfer_using_external_body_url(void) { linphone_chat_message_set_external_body_url(message, "https://www.linphone.org:444//tmp/54ec58280ace9_c30709218df8eaba61d1.jpg"); linphone_chat_room_send_chat_message(chat_room, message); - CU_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1)); + BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1)); if (marie->stat.last_received_chat_message) { linphone_chat_message_download_file(marie->stat.last_received_chat_message); } - CU_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageExtBodyReceived, 1)); - CU_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneMessageInProgress, 1)); + BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageExtBodyReceived, 1)); + BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneMessageInProgress, 1)); ms_free(to); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -1174,16 +1173,16 @@ static void text_message_with_send_error(void) { linphone_chat_room_send_chat_message(chat_room,message); /* check transient message list: the message should be in it, and should be the only one */ - CU_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 1); - CU_ASSERT_EQUAL(ms_list_nth_data(chat_room->transient_messages,0), message); + BC_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 1, int, "%d"); + BC_ASSERT_PTR_EQUAL(ms_list_nth_data(chat_room->transient_messages,0), message); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageNotDelivered,1)); - /*CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageInProgress,1);*/ - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageReceived,0); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageNotDelivered,1)); + /*BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageInProgress,1, int, "%d");*/ + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageReceived,0, int, "%d"); /* the message should have been discarded from transient list after an error */ - CU_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 0); + BC_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 0, int, "%d"); sal_set_send_error(marie->lc->sal, 0); ms_free(to); @@ -1211,8 +1210,8 @@ static void text_message_denied(void) { linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed); linphone_chat_room_send_chat_message(chat_room,message); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageNotDelivered,1)); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageReceived,0); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageNotDelivered,1)); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageReceived,0, int, "%d"); ms_free(to); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -1240,7 +1239,7 @@ static void info_message_with_args(bool_t with_content) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); - CU_ASSERT_TRUE(call(pauline,marie)); + BC_ASSERT_TRUE(call(pauline,marie)); info=linphone_core_create_info_message(marie->lc); linphone_info_message_add_header(info,"Weather","still bad"); @@ -1261,26 +1260,26 @@ static void info_message_with_args(bool_t with_content) { linphone_call_send_info_message(linphone_core_get_current_call(marie->lc),info); linphone_info_message_destroy(info); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_inforeceived,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_inforeceived,1)); - CU_ASSERT_PTR_NOT_NULL(pauline->stat.last_received_info_message); + BC_ASSERT_PTR_NOT_NULL(pauline->stat.last_received_info_message); hvalue=linphone_info_message_get_header(pauline->stat.last_received_info_message, "Weather"); content=linphone_info_message_get_content(pauline->stat.last_received_info_message); - CU_ASSERT_PTR_NOT_NULL(hvalue); + BC_ASSERT_PTR_NOT_NULL(hvalue); if (hvalue) - CU_ASSERT_TRUE(strcmp(hvalue,"still bad")==0); + BC_ASSERT_TRUE(strcmp(hvalue,"still bad")==0); if (with_content){ - CU_ASSERT_PTR_NOT_NULL(content); + BC_ASSERT_PTR_NOT_NULL(content); if (content) { - CU_ASSERT_PTR_NOT_NULL(linphone_content_get_buffer(content)); - CU_ASSERT_PTR_NOT_NULL(linphone_content_get_type(content)); - CU_ASSERT_PTR_NOT_NULL(linphone_content_get_subtype(content)); - if (linphone_content_get_type(content)) CU_ASSERT_TRUE(strcmp(linphone_content_get_type(content),"application")==0); - if (linphone_content_get_subtype(content)) CU_ASSERT_TRUE(strcmp(linphone_content_get_subtype(content),"somexml")==0); - if (linphone_content_get_buffer(content))CU_ASSERT_TRUE(strcmp((const char*)linphone_content_get_buffer(content),info_content)==0); - CU_ASSERT_EQUAL(linphone_content_get_size(content),strlen(info_content)); + BC_ASSERT_PTR_NOT_NULL(linphone_content_get_buffer(content)); + BC_ASSERT_PTR_NOT_NULL(linphone_content_get_type(content)); + BC_ASSERT_PTR_NOT_NULL(linphone_content_get_subtype(content)); + if (linphone_content_get_type(content)) BC_ASSERT_TRUE(strcmp(linphone_content_get_type(content),"application")==0); + if (linphone_content_get_subtype(content)) BC_ASSERT_TRUE(strcmp(linphone_content_get_subtype(content),"somexml")==0); + if (linphone_content_get_buffer(content))BC_ASSERT_TRUE(strcmp((const char*)linphone_content_get_buffer(content),info_content)==0); + BC_ASSERT_EQUAL(linphone_content_get_size(content),strlen(info_content), int, "%d"); } } linphone_core_manager_destroy(marie); @@ -1316,8 +1315,8 @@ static void is_composing_notification(void) { linphone_chat_room_compose(chat_room); wait_for_until(pauline->lc, marie->lc, &dummy, 1, 1500); /*just to sleep while iterating*/ linphone_chat_room_send_message(chat_room, "Composing a message"); - CU_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, 1)); - CU_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingIdleReceived, 2)); + BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, 1)); + BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingIdleReceived, 2)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } @@ -1372,9 +1371,9 @@ message_tester_copy_file(const char *from, const char *to) } static int check_no_strange_time(void* data,int argc, char** argv,char** cNames) { - CU_ASSERT_EQUAL(argc, 1); - CU_ASSERT_STRING_EQUAL(cNames[0], "COUNT(*)"); // count of non updated messages should be 0 - CU_ASSERT_STRING_EQUAL(argv[0], "0"); // count of non updated messages should be 0 + BC_ASSERT_EQUAL(argc, 1, int, "%d"); + BC_ASSERT_STRING_EQUAL(cNames[0], "COUNT(*)"); // count of non updated messages should be 0 + BC_ASSERT_STRING_EQUAL(argv[0], "0"); // count of non updated messages should be 0 return 0; } @@ -1386,7 +1385,7 @@ static void message_storage_migration() { snprintf(src_db,sizeof(src_db), "%s/messages.db", bc_tester_read_dir_prefix); snprintf(tmp_db,sizeof(tmp_db), "%s/tmp.db", bc_tester_writable_dir_prefix); - CU_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0); + BC_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d"); // enable to test the performances of the migration step //linphone_core_message_storage_set_debug(marie->lc, TRUE); @@ -1396,10 +1395,10 @@ static void message_storage_migration() { linphone_core_set_chat_database_path(marie->lc, tmp_db); chatrooms = linphone_core_get_chat_rooms(marie->lc); - CU_ASSERT(ms_list_size(chatrooms) > 0); + BC_ASSERT(ms_list_size(chatrooms) > 0); // check that all messages have been migrated to the UTC time storage - CU_ASSERT(sqlite3_exec(marie->lc->db, "SELECT COUNT(*) FROM history WHERE time != '-1';", check_no_strange_time, NULL, NULL) == SQLITE_OK ); + BC_ASSERT(sqlite3_exec(marie->lc->db, "SELECT COUNT(*) FROM history WHERE time != '-1';", check_no_strange_time, NULL, NULL) == SQLITE_OK ); linphone_core_manager_destroy(marie); remove(tmp_db); @@ -1411,7 +1410,7 @@ static void history_message_count_helper(LinphoneChatRoom* chatroom, int x, int if( expected != size ){ ms_warning("History retrieved from %d to %d returned %d records, but expected %d", x, y, size, expected); } - CU_ASSERT_EQUAL(size, expected); + BC_ASSERT_EQUAL(size, expected, int, "%d"); ms_list_free_with_data(messages, (void (*)(void *))linphone_chat_message_unref); @@ -1426,12 +1425,12 @@ static void history_range_full_test(){ snprintf(src_db,sizeof(src_db), "%s/messages.db", bc_tester_read_dir_prefix); snprintf(tmp_db,sizeof(tmp_db), "%s/tmp.db", bc_tester_writable_dir_prefix); - CU_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0); + BC_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d"); linphone_core_set_chat_database_path(marie->lc, tmp_db); chatroom = linphone_core_get_chat_room(marie->lc, jehan_addr); - CU_ASSERT_PTR_NOT_NULL(chatroom); + BC_ASSERT_PTR_NOT_NULL(chatroom); if (chatroom){ // We have 20 tests to perform to fully qualify the function, here they are: history_message_count_helper(chatroom, 0, 0, 1); @@ -1468,47 +1467,47 @@ static void history_messages_count() { snprintf(src_db,sizeof(src_db), "%s/messages.db", bc_tester_read_dir_prefix); snprintf(tmp_db,sizeof(tmp_db), "%s/tmp.db", bc_tester_writable_dir_prefix); - CU_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0); + BC_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d"); linphone_core_set_chat_database_path(marie->lc, tmp_db); chatroom = linphone_core_get_chat_room(marie->lc, jehan_addr); - CU_ASSERT_PTR_NOT_NULL(chatroom); + BC_ASSERT_PTR_NOT_NULL(chatroom); if (chatroom){ messages=linphone_chat_room_get_history(chatroom,10); - CU_ASSERT_EQUAL(ms_list_size(messages), 10); + BC_ASSERT_EQUAL(ms_list_size(messages), 10, int, "%d"); ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref); messages=linphone_chat_room_get_history(chatroom,1); - CU_ASSERT_EQUAL(ms_list_size(messages), 1); + BC_ASSERT_EQUAL(ms_list_size(messages), 1, int, "%d"); ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref); messages=linphone_chat_room_get_history(chatroom,0); - CU_ASSERT_EQUAL(linphone_chat_room_get_history_size(chatroom), 1270); - CU_ASSERT_EQUAL(ms_list_size(messages), 1270); + BC_ASSERT_EQUAL(linphone_chat_room_get_history_size(chatroom), 1270, int, "%d"); + BC_ASSERT_EQUAL(ms_list_size(messages), 1270, int, "%d"); /*check the second most recent message*/ - CU_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->next->data), "Fore and aft follow each other."); + BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->next->data), "Fore and aft follow each other."); ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref); /*test offset+limit: retrieve the 42th latest message only and check its content*/ messages=linphone_chat_room_get_history_range(chatroom, 42, 42); - CU_ASSERT_EQUAL(ms_list_size(messages), 1); - CU_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->data), "If you open yourself to the Tao is intangible and evasive, yet prefers to keep us at the mercy of the kingdom, then all of the streams of hundreds of valleys because of its limitless possibilities."); + BC_ASSERT_EQUAL(ms_list_size(messages), 1, int, "%d"); + BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->data), "If you open yourself to the Tao is intangible and evasive, yet prefers to keep us at the mercy of the kingdom, then all of the streams of hundreds of valleys because of its limitless possibilities."); ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref); /*test offset without limit*/ messages = linphone_chat_room_get_history_range(chatroom, 1265, -1); - CU_ASSERT_EQUAL(ms_list_size(messages), 1270-1265); + BC_ASSERT_EQUAL(ms_list_size(messages), 1270-1265, int, "%d"); ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref); /*test limit without offset*/ messages = linphone_chat_room_get_history_range(chatroom, 0, 5); - CU_ASSERT_EQUAL(ms_list_size(messages), 6); + BC_ASSERT_EQUAL(ms_list_size(messages), 6, int, "%d"); ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref); /*test invalid start*/ messages = linphone_chat_room_get_history_range(chatroom, 1265, 1260); - CU_ASSERT_EQUAL(ms_list_size(messages), 1270-1265); + BC_ASSERT_EQUAL(ms_list_size(messages), 1270-1265, int, "%d"); ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref); } linphone_core_manager_destroy(marie); diff --git a/tester/multi_call.c b/tester/multi_call.c index 5f580118c..2b564668d 100644 --- a/tester/multi_call.c +++ b/tester/multi_call.c @@ -51,23 +51,23 @@ static void call_waiting_indication_with_param(bool_t enable_caller_privacy) { lcs=ms_list_append(lcs,pauline->lc); lcs=ms_list_append(lcs,laure->lc); - CU_ASSERT_TRUE(call_with_caller_params(marie,pauline,marie_params)); + BC_ASSERT_TRUE(call_with_caller_params(marie,pauline,marie_params)); pauline_called_by_marie=linphone_core_get_current_call(pauline->lc); if (enable_caller_privacy) linphone_call_params_set_privacy(laure_params,LinphonePrivacyId); - CU_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(laure->lc,pauline->identity,laure_params)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(laure->lc,pauline->identity,laure_params)); - CU_ASSERT_TRUE(wait_for(laure->lc + BC_ASSERT_TRUE(wait_for(laure->lc ,pauline->lc ,&pauline->stat.number_of_LinphoneCallIncomingReceived ,2)); - CU_ASSERT_EQUAL(laure->stat.number_of_LinphoneCallOutgoingProgress,1); + BC_ASSERT_EQUAL(laure->stat.number_of_LinphoneCallOutgoingProgress,1, int, "%d"); - CU_ASSERT_TRUE(wait_for(laure->lc + BC_ASSERT_TRUE(wait_for(laure->lc ,pauline->lc ,&laure->stat.number_of_LinphoneCallOutgoingRinging ,1)); @@ -81,25 +81,25 @@ static void call_waiting_indication_with_param(bool_t enable_caller_privacy) { } } - CU_ASSERT_TRUE(wait_for(laure->lc + BC_ASSERT_TRUE(wait_for(laure->lc ,pauline->lc ,&laure->stat.number_of_LinphoneCallConnected ,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc + BC_ASSERT_TRUE(wait_for(pauline->lc ,marie->lc ,&marie->stat.number_of_LinphoneCallPausedByRemote ,1)); if (pauline_called_by_laure && enable_caller_privacy ) - CU_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(pauline_called_by_laure)),LinphonePrivacyId); + BC_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(pauline_called_by_laure)),LinphonePrivacyId, int, "%d"); /*wait a bit for ACK to be sent*/ wait_for_list(lcs,NULL,0,1000); linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,10000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,10000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,10000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,10000)); linphone_core_manager_destroy(marie); @@ -129,9 +129,9 @@ static void incoming_call_accepted_when_outgoing_call_in_state(LinphoneCallState if (state==LinphoneCallOutgoingRinging || state==LinphoneCallOutgoingEarlyMedia) { - CU_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(marie->lc,pauline->identity,marie_params)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(marie->lc,pauline->identity,marie_params)); - CU_ASSERT_TRUE(wait_for(marie->lc + BC_ASSERT_TRUE(wait_for(marie->lc ,pauline->lc ,&pauline->stat.number_of_LinphoneCallIncomingReceived ,1)); @@ -139,29 +139,29 @@ static void incoming_call_accepted_when_outgoing_call_in_state(LinphoneCallState if (state==LinphoneCallOutgoingEarlyMedia) linphone_core_accept_early_media(pauline->lc,linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallOutgoingProgress,1); - CU_ASSERT_TRUE(wait_for(marie->lc + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallOutgoingProgress,1, int, "%d"); + BC_ASSERT_TRUE(wait_for(marie->lc ,pauline->lc ,state==LinphoneCallOutgoingEarlyMedia?&marie->stat.number_of_LinphoneCallOutgoingEarlyMedia:&marie->stat.number_of_LinphoneCallOutgoingRinging ,1)); } else if (state==LinphoneCallOutgoingProgress) { - CU_ASSERT_PTR_NOT_NULL(linphone_core_invite_address(marie->lc,pauline->identity)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address(marie->lc,pauline->identity)); } else { ms_error("Unsupported state"); return; } - CU_ASSERT_TRUE(call_with_caller_params(laure,marie,laure_params)); + BC_ASSERT_TRUE(call_with_caller_params(laure,marie,laure_params)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000)); linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,10000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,10000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,10000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,10000)); linphone_core_manager_destroy(marie); @@ -193,32 +193,32 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag lcs=ms_list_append(lcs,pauline->lc); lcs=ms_list_append(lcs,laure->lc); - CU_ASSERT_TRUE(call(marie,pauline)); + BC_ASSERT_TRUE(call(marie,pauline)); marie_call_pauline=linphone_core_get_current_call(marie->lc); pauline_called_by_marie=linphone_core_get_current_call(pauline->lc); - CU_ASSERT_TRUE(pause_call_1(marie,marie_call_pauline,pauline,pauline_called_by_marie)); + BC_ASSERT_TRUE(pause_call_1(marie,marie_call_pauline,pauline,pauline_called_by_marie)); - CU_ASSERT_TRUE(call(marie,laure)); + BC_ASSERT_TRUE(call(marie,laure)); initial_marie_stat=marie->stat; initial_pauline_stat=pauline->stat; initial_laure_stat=laure->stat; marie_call_laure=linphone_core_get_current_call(marie->lc); - CU_ASSERT_PTR_NOT_NULL_FATAL(marie_call_laure); + BC_ASSERT_PTR_NOT_NULL_FATAL(marie_call_laure); linphone_core_add_to_conference(marie->lc,marie_call_laure); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallUpdating,initial_marie_stat.number_of_LinphoneCallUpdating+1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallUpdating,initial_marie_stat.number_of_LinphoneCallUpdating+1,5000)); linphone_core_add_to_conference(marie->lc,marie_call_pauline); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallResuming,initial_marie_stat.number_of_LinphoneCallResuming+1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallResuming,initial_marie_stat.number_of_LinphoneCallResuming+1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,initial_pauline_stat.number_of_LinphoneCallStreamsRunning+1,5000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,initial_laure_stat.number_of_LinphoneCallStreamsRunning+1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,initial_marie_stat.number_of_LinphoneCallStreamsRunning+2,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,initial_pauline_stat.number_of_LinphoneCallStreamsRunning+1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,initial_laure_stat.number_of_LinphoneCallStreamsRunning+1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,initial_marie_stat.number_of_LinphoneCallStreamsRunning+2,3000)); - CU_ASSERT_TRUE(linphone_core_is_in_conference(marie->lc)); - CU_ASSERT_EQUAL(linphone_core_get_conference_size(marie->lc),3); + BC_ASSERT_TRUE(linphone_core_is_in_conference(marie->lc)); + BC_ASSERT_EQUAL(linphone_core_get_conference_size(marie->lc),3, int, "%d"); /* * FIXME: check_ice cannot work as it is today because there is no current call for the party that hosts the conference @@ -234,9 +234,9 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag linphone_core_terminate_conference(marie->lc); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,10000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,10000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,10000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,10000)); @@ -285,7 +285,7 @@ static void simple_call_transfer(void) { lcs=ms_list_append(lcs,laure->lc); - CU_ASSERT_TRUE(call(marie,pauline)); + BC_ASSERT_TRUE(call(marie,pauline)); marie_calling_pauline=linphone_core_get_current_call(marie->lc); pauline_called_by_marie=linphone_core_get_current_call(pauline->lc); @@ -295,35 +295,35 @@ static void simple_call_transfer(void) { linphone_core_transfer_call(pauline->lc,pauline_called_by_marie,laure_identity); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallRefered,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallRefered,1,2000)); /*marie pausing pauline*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallPausing,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallPausedByRemote,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallPaused,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallPausing,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallPausedByRemote,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallPaused,1,2000)); /*marie calling laure*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingProgress,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingProgress,1,2000)); - CU_ASSERT_PTR_NOT_NULL(linphone_call_get_transfer_target_call(marie_calling_pauline)); + BC_ASSERT_PTR_NOT_NULL(linphone_call_get_transfer_target_call(marie_calling_pauline)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallOutgoingInit,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingRinging,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallOutgoingProgress,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallOutgoingInit,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingRinging,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallOutgoingProgress,1,2000)); linphone_core_accept_call(laure->lc,linphone_core_get_current_call(laure->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,2000)); marie_calling_laure=linphone_core_get_current_call(marie->lc); - CU_ASSERT_PTR_NOT_NULL_FATAL(marie_calling_laure); - CU_ASSERT_TRUE(linphone_call_get_transferer_call(marie_calling_laure)==marie_calling_pauline); + BC_ASSERT_PTR_NOT_NULL_FATAL(marie_calling_laure); + BC_ASSERT_TRUE(linphone_call_get_transferer_call(marie_calling_laure)==marie_calling_pauline); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallConnected,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallConnected,1,2000)); /*terminate marie to pauline call*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,2000)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -343,7 +343,7 @@ static void unattended_call_transfer(void) { lcs=ms_list_append(lcs,laure->lc); - CU_ASSERT_TRUE(call(marie,pauline)); + BC_ASSERT_TRUE(call(marie,pauline)); pauline_called_by_marie=linphone_core_get_current_call(marie->lc); reset_counters(&marie->stat); @@ -351,25 +351,25 @@ static void unattended_call_transfer(void) { reset_counters(&laure->stat); linphone_core_transfer_call(marie->lc,pauline_called_by_marie,laure_identity); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallRefered,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallRefered,1,2000)); /*marie ends the call */ linphone_core_terminate_call(marie->lc,pauline_called_by_marie); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000)); /*Pauline starts the transfer*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingInit,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingProgress,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingInit,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingProgress,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,2000)); linphone_core_accept_call(laure->lc,linphone_core_get_current_call(laure->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -383,10 +383,10 @@ static void unattended_call_transfer_with_error(void) { LinphoneCall* pauline_called_by_marie; bool_t call_ok=TRUE; MSList* lcs=ms_list_append(NULL,marie->lc); - + lcs=ms_list_append(lcs,pauline->lc); - CU_ASSERT_TRUE((call_ok=call(marie,pauline))); + BC_ASSERT_TRUE((call_ok=call(marie,pauline))); if (call_ok){ pauline_called_by_marie=linphone_core_get_current_call(marie->lc); @@ -394,21 +394,21 @@ static void unattended_call_transfer_with_error(void) { reset_counters(&pauline->stat); linphone_core_transfer_call(marie->lc,pauline_called_by_marie,"unknown_user"); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallRefered,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallRefered,1,2000)); /*Pauline starts the transfer*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingInit,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingInit,1,2000)); /* and immediately get an error*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallError,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallError,1,2000)); /*the error must be reported back to marie*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallError,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallError,1,2000)); /*and pauline should resume the call automatically*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallResuming,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallResuming,1,2000)); /*and call should be resumed*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,2000)); } linphone_core_manager_destroy(marie); @@ -429,24 +429,24 @@ static void call_transfer_existing_call_outgoing_call(void) { bool_t call_ok=TRUE; const MSList* calls; MSList* lcs=ms_list_append(NULL,marie->lc); - + lcs=ms_list_append(lcs,pauline->lc); lcs=ms_list_append(lcs,laure->lc); /*marie call pauline*/ - CU_ASSERT_TRUE((call_ok=call(marie,pauline))); + BC_ASSERT_TRUE((call_ok=call(marie,pauline))); if (call_ok){ marie_call_pauline=linphone_core_get_current_call(marie->lc); pauline_called_by_marie=linphone_core_get_current_call(pauline->lc); /*marie pause pauline*/ - CU_ASSERT_TRUE(pause_call_1(marie,marie_call_pauline,pauline,pauline_called_by_marie)); + BC_ASSERT_TRUE(pause_call_1(marie,marie_call_pauline,pauline,pauline_called_by_marie)); /*marie call laure*/ - CU_ASSERT_TRUE(call(marie,laure)); + BC_ASSERT_TRUE(call(marie,laure)); marie_call_laure=linphone_core_get_current_call(marie->lc); laure_called_by_marie=linphone_core_get_current_call(laure->lc); /*marie pause laure*/ - CU_ASSERT_TRUE(pause_call_1(marie,marie_call_laure,laure,laure_called_by_marie)); + BC_ASSERT_TRUE(pause_call_1(marie,marie_call_laure,laure,laure_called_by_marie)); reset_counters(&marie->stat); reset_counters(&pauline->stat); @@ -454,37 +454,37 @@ static void call_transfer_existing_call_outgoing_call(void) { linphone_core_transfer_call_to_another(marie->lc,marie_call_pauline,marie_call_laure); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallRefered,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallRefered,1,2000)); /*pauline pausing marie*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallPausing,1,4000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallPaused,1,4000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallPausing,1,4000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallPaused,1,4000)); /*pauline calling laure*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingProgress,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallOutgoingInit,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallOutgoingProgress,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingProgress,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallOutgoingInit,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallOutgoingProgress,1,2000)); /*laure accept call*/ for(calls=linphone_core_get_calls(laure->lc);calls!=NULL;calls=calls->next) { lcall = (LinphoneCall*)calls->data; if (linphone_call_get_state(lcall) == LinphoneCallIncomingReceived) { - CU_ASSERT_EQUAL(linphone_call_get_replaced_call(lcall),laure_called_by_marie); + BC_ASSERT_PTR_EQUAL(linphone_call_get_replaced_call(lcall),laure_called_by_marie); linphone_core_accept_call(laure->lc,lcall); break; } } - CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallConnected,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallConnected,1,2000)); /*terminate marie to pauline/laure call*/ - CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,2,2000)); - CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,2,2000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,2000)); } linphone_core_manager_destroy(marie); diff --git a/tester/multicast_call_tester.c b/tester/multicast_call_tester.c index 22c7fcd8b..692f4d995 100644 --- a/tester/multicast_call_tester.c +++ b/tester/multicast_call_tester.c @@ -52,15 +52,15 @@ static void call_multicast_base(bool_t video) { linphone_core_set_audio_multicast_addr(pauline->lc,"224.1.2.3"); linphone_core_enable_audio_multicast(pauline->lc,TRUE); - CU_ASSERT_TRUE(call(pauline,marie)); + BC_ASSERT_TRUE(call(pauline,marie)); wait_for_until(marie->lc, pauline->lc, NULL, 1, 3000); if (linphone_core_get_current_call(marie->lc)) { - CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(marie->lc))->download_bandwidth>70); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(marie->lc))->download_bandwidth>70); if (video) { /*check video path*/ linphone_call_set_next_video_frame_decoded_callback(linphone_core_get_current_call(marie->lc),linphone_call_cb,marie->lc); linphone_call_send_vfu_request(linphone_core_get_current_call(marie->lc)); - CU_ASSERT_TRUE( wait_for(marie->lc,pauline->lc,&marie->stat.number_of_IframeDecoded,1)); + BC_ASSERT_TRUE( wait_for(marie->lc,pauline->lc,&marie->stat.number_of_IframeDecoded,1)); } end_call(marie,pauline); @@ -69,7 +69,7 @@ static void call_multicast_base(bool_t video) { linphone_core_manager_destroy(pauline); leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } @@ -139,8 +139,8 @@ static void early_media_with_multicast_base(bool_t video) { linphone_core_invite_address(marie->lc, pauline->identity); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,3000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging,1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging,1,1000)); if (linphone_core_inc_invite_pending(pauline->lc)) { @@ -151,8 +151,8 @@ static void early_media_with_multicast_base(bool_t video) { } linphone_core_accept_early_media(pauline->lc, linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) ); - CU_ASSERT_TRUE( wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,2000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,2000) ); if (linphone_core_inc_invite_pending(pauline2->lc)) { /* send a 183 to initiate the early media */ @@ -162,40 +162,40 @@ static void early_media_with_multicast_base(bool_t video) { } linphone_core_accept_early_media(pauline2->lc, linphone_core_get_current_call(pauline2->lc)); - CU_ASSERT_TRUE( wait_for_list(lcs, &pauline2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) ); + BC_ASSERT_TRUE( wait_for_list(lcs, &pauline2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) ); } wait_for_list(lcs, &dummy, 1, 3000); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth>70); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth<90); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth>70); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth<90); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline2->lc))->download_bandwidth>70); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline2->lc))->download_bandwidth<90); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline2->lc))->download_bandwidth>70); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline2->lc))->download_bandwidth<90); - CU_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)))); - CU_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)))); + BC_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)))); + BC_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)))); if (video) { - CU_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)))); - CU_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)))); + BC_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)))); + BC_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)))); } if (video) { - CU_ASSERT_TRUE( wait_for_list(lcs,&pauline->stat.number_of_IframeDecoded,1,2000)); - CU_ASSERT_TRUE( wait_for_list(lcs,&pauline2->stat.number_of_IframeDecoded,1,2000)); + BC_ASSERT_TRUE( wait_for_list(lcs,&pauline->stat.number_of_IframeDecoded,1,2000)); + BC_ASSERT_TRUE( wait_for_list(lcs,&pauline2->stat.number_of_IframeDecoded,1,2000)); } linphone_core_accept_call(pauline->lc, linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline2->stat.number_of_LinphoneCallEnd, 1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline2->stat.number_of_LinphoneCallEnd, 1,1000)); - CU_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)))); - CU_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)))); + BC_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)))); + BC_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)))); if (video) { - CU_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)))); - CU_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)))); + BC_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)))); + BC_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)))); } params=linphone_call_params_copy(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))); @@ -211,10 +211,10 @@ static void early_media_with_multicast_base(bool_t video) { , params); linphone_call_params_destroy(params); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2,1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2,1000)); - CU_ASSERT_FALSE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)))); - CU_ASSERT_FALSE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)))); + BC_ASSERT_FALSE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)))); + BC_ASSERT_FALSE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)))); check_media_direction( pauline , linphone_core_get_current_call(pauline->lc) @@ -228,8 +228,8 @@ static void early_media_with_multicast_base(bool_t video) { , video?LinphoneMediaDirectionSendRecv:LinphoneMediaDirectionInactive); if (video) { - CU_ASSERT_FALSE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)))); - CU_ASSERT_FALSE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)))); + BC_ASSERT_FALSE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)))); + BC_ASSERT_FALSE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)))); } end_call(marie,pauline); } @@ -239,7 +239,7 @@ static void early_media_with_multicast_base(bool_t video) { linphone_core_manager_destroy(pauline2); leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_EQUAL(leaked_objects,0); + BC_ASSERT_EQUAL(leaked_objects,0, int, "%d"); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } diff --git a/tester/offeranswer_tester.c b/tester/offeranswer_tester.c index 8225faf9d..4302969c1 100644 --- a/tester/offeranswer_tester.c +++ b/tester/offeranswer_tester.c @@ -46,13 +46,13 @@ static void start_with_no_config(void){ int speex16_codec_pos=get_codec_position(codecs, "speex", 16000); PayloadType *pt; opus_codec_pos=get_codec_position(codecs, "opus", 48000); - if (opus_codec_pos!=-1) CU_ASSERT_TRUE(opus_codec_pos==0); - CU_ASSERT_TRUE(speex16_codec_poslc,"pcmu",-1); disable_all_audio_codecs_except_one(pauline->lc,"pcmu",-1); - + /*marie set a fantasy number to PCMU*/ linphone_core_set_payload_type_number(marie->lc, linphone_core_find_payload_type(marie->lc, "PCMU", 8000, -1), 104); - - CU_ASSERT_TRUE(call(marie,pauline)); + + BC_ASSERT_TRUE(call(marie,pauline)); pauline_call=linphone_core_get_current_call(pauline->lc); - CU_ASSERT_PTR_NOT_NULL(pauline_call); + BC_ASSERT_PTR_NOT_NULL(pauline_call); if (pauline_call){ LinphoneCallParams *params; check_payload_type_numbers(linphone_core_get_current_call(marie->lc), pauline_call, 104); /*make a reinvite in the other direction*/ - linphone_core_update_call(pauline->lc, pauline_call, + linphone_core_update_call(pauline->lc, pauline_call, params=linphone_core_create_call_params(pauline->lc, pauline_call)); linphone_call_params_unref(params); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallUpdating,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallUpdatedByRemote,1)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallUpdating,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallUpdatedByRemote,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); /*payload type numbers shall remain the same*/ check_payload_type_numbers(linphone_core_get_current_call(marie->lc), pauline_call, 104); } @@ -116,7 +116,7 @@ static void simple_call_with_different_codec_mappings(void) { linphone_core_manager_destroy(pauline); leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } @@ -137,20 +137,20 @@ static void call_failed_because_of_codecs(void) { disable_all_audio_codecs_except_one(pauline->lc,"pcma",-1); out_call = linphone_core_invite_address(pauline->lc,marie->identity); linphone_call_ref(out_call); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1)); /*flexisip will retain the 488 until the "urgent reply" timeout (I.E 5s) arrives.*/ - CU_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1,7000)); - CU_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonNotAcceptable); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallIncomingReceived,0); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallReleased,0); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1,7000)); + BC_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonNotAcceptable, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallIncomingReceived,0, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallReleased,0, int, "%d"); linphone_call_unref(out_call); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } leaked_objects=belle_sip_object_get_object_count()-begin; - CU_ASSERT_TRUE(leaked_objects==0); + BC_ASSERT_TRUE(leaked_objects==0); if (leaked_objects>0){ belle_sip_object_dump_active_objects(); } @@ -194,23 +194,23 @@ static void profile_call_base(bool_t avpf1, LinphoneMediaEncryption srtp1,bool_t } - CU_ASSERT_TRUE(call(marie, pauline)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1)); + BC_ASSERT_TRUE(call(marie, pauline)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1)); if (linphone_core_get_current_call(marie->lc)) { params = linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)); - CU_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile); + BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile); } if (linphone_core_get_current_call(pauline->lc)) { params = linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)); - CU_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile); + BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile); } linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1)); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallConnected, 1); - CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallConnected, 1); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1)); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallConnected, 1, int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallConnected, 1, int, "%d"); end: linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); diff --git a/tester/player_tester.c b/tester/player_tester.c index e72cac9cd..909fdffe9 100644 --- a/tester/player_tester.c +++ b/tester/player_tester.c @@ -39,11 +39,11 @@ static void play_file(const char *filename, bool_t unsupported_format, const cha bool_t eof = FALSE; lc_manager = linphone_core_manager_new("marie_rc"); - CU_ASSERT_PTR_NOT_NULL(lc_manager); + BC_ASSERT_PTR_NOT_NULL(lc_manager); if(lc_manager == NULL) return; player = linphone_core_create_local_player(lc_manager->lc, ms_snd_card_manager_get_default_card(ms_snd_card_manager_get()), video_stream_get_default_video_renderer(), 0); - CU_ASSERT_PTR_NOT_NULL(player); + BC_ASSERT_PTR_NOT_NULL(player); if(player == NULL) goto fail; res = linphone_player_open(player, filename, eof_callback, &eof); @@ -51,17 +51,17 @@ static void play_file(const char *filename, bool_t unsupported_format, const cha || (audio_mime == NULL && video_mime == NULL) || (video_mime == NULL && audio_mime && !ms_filter_codec_supported(audio_mime)) || (audio_mime == NULL && video_mime && !ms_filter_codec_supported(video_mime))) { - CU_ASSERT_EQUAL(res, -1); + BC_ASSERT_EQUAL(res, -1, int, "%d"); } else { - CU_ASSERT_EQUAL(res, 0); + BC_ASSERT_EQUAL(res, 0, int, "%d"); } if(res == -1) goto fail; res = linphone_player_start(player); - CU_ASSERT_EQUAL(res, 0); + BC_ASSERT_EQUAL(res, 0, int, "%d"); if(res == -1) goto fail; - CU_ASSERT_TRUE(wait_for_eof(&eof, &time, 100, 13000)); + BC_ASSERT_TRUE(wait_for_eof(&eof, &time, 100, 13000)); linphone_player_close(player); diff --git a/tester/presence_tester.c b/tester/presence_tester.c index 3b711e52e..ef16102a0 100644 --- a/tester/presence_tester.c +++ b/tester/presence_tester.c @@ -16,8 +16,7 @@ along with this program. If not, see . */ -#include -#include "CUnit/Basic.h" + #include "linphonecore.h" #include "private.h" #include "liblinphone_tester.h" @@ -169,11 +168,11 @@ static bool_t subscribe_to_callee_presence(LinphoneCoreManager* caller_mgr,Linph result&=wait_for(caller_mgr->lc,callee_mgr->lc,&callee_mgr->stat.number_of_LinphonePresenceActivityOnline,initial_callee.number_of_LinphonePresenceActivityOnline+1); */ - CU_ASSERT_EQUAL(callee_mgr->stat.number_of_NewSubscriptionRequest,initial_callee.number_of_NewSubscriptionRequest+1); + BC_ASSERT_EQUAL(callee_mgr->stat.number_of_NewSubscriptionRequest,initial_callee.number_of_NewSubscriptionRequest+1, int, "%d"); /*without proxy, callee cannot subscribe to caller - CU_ASSERT_EQUAL(callee_mgr->stat.number_of_NotifyReceived,initial_callee.number_of_NotifyReceived+1); + BC_ASSERT_EQUAL(callee_mgr->stat.number_of_NotifyReceived,initial_callee.number_of_NotifyReceived+1, int, "%d"); */ - CU_ASSERT_EQUAL(caller_mgr->stat.number_of_NotifyReceived,initial_caller.number_of_NotifyReceived+1); + BC_ASSERT_EQUAL(caller_mgr->stat.number_of_NotifyReceived,initial_caller.number_of_NotifyReceived+1, int, "%d"); ms_free(identity); return result; @@ -187,27 +186,27 @@ static void subscribe_failure_handle_by_app(void) { char* lf_identity=linphone_address_as_string_uri_only(pauline->identity); linphone_core_get_default_proxy(marie->lc,&config); - CU_ASSERT_TRUE(subscribe_to_callee_presence(marie,pauline)); + BC_ASSERT_TRUE(subscribe_to_callee_presence(marie,pauline)); wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,1); /*just to wait for unsubscription even if not notified*/ sal_set_recv_error(marie->lc->sal, 0); /*simulate an error*/ - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneRegistrationProgress,2)); - CU_ASSERT_EQUAL(linphone_proxy_config_get_error(config),LinphoneReasonIOError); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneRegistrationProgress,2)); + BC_ASSERT_EQUAL(linphone_proxy_config_get_error(config),LinphoneReasonIOError, int, "%d"); sal_set_recv_error(marie->lc->sal, 1); lf = linphone_core_get_friend_by_address(marie->lc,lf_identity); linphone_friend_edit(lf); linphone_friend_enable_subscribes(lf,FALSE); /*disable subscription*/ linphone_friend_done(lf); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneRegistrationOk,2)); /*wait for register ok*/ + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneRegistrationOk,2)); /*wait for register ok*/ linphone_friend_edit(lf); linphone_friend_enable_subscribes(lf,TRUE); linphone_friend_done(lf); - CU_ASSERT_FALSE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,2)); /*just to wait for unsubscription even if not notified*/ + BC_ASSERT_FALSE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,2)); /*just to wait for unsubscription even if not notified*/ linphone_core_manager_destroy(marie); - CU_ASSERT_FALSE(wait_for(NULL,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,3)); /*just to wait for unsubscription even if not notified*/ + BC_ASSERT_FALSE(wait_for(NULL,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,3)); /*just to wait for unsubscription even if not notified*/ linphone_core_manager_destroy(pauline); } @@ -216,12 +215,12 @@ static void simple_subscribe(void) { LinphoneCoreManager* marie = presence_linphone_core_manager_new("marie"); LinphoneCoreManager* pauline = presence_linphone_core_manager_new("pauline"); - CU_ASSERT_TRUE(subscribe_to_callee_presence(marie,pauline)); + BC_ASSERT_TRUE(subscribe_to_callee_presence(marie,pauline)); linphone_core_manager_destroy(marie); /*unsubscribe is not reported ?*/ - CU_ASSERT_FALSE(wait_for(NULL,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,2)); /*just to wait for unsubscription even if not notified*/ + BC_ASSERT_FALSE(wait_for(NULL,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,2)); /*just to wait for unsubscription even if not notified*/ linphone_core_manager_destroy(pauline); } @@ -244,18 +243,18 @@ static void call_with_presence(void) { LinphoneCoreManager* pauline = presence_linphone_core_manager_new("pauline"); LinphoneVideoPolicy pol={0}; linphone_core_set_video_policy(marie->lc,&pol); - CU_ASSERT_TRUE(subscribe_to_callee_presence(marie,pauline)); - CU_ASSERT_TRUE(subscribe_to_callee_presence(pauline,marie)); + BC_ASSERT_TRUE(subscribe_to_callee_presence(marie,pauline)); + BC_ASSERT_TRUE(subscribe_to_callee_presence(pauline,marie)); - CU_ASSERT_TRUE(call(marie,pauline)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityOnThePhone,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphonePresenceActivityOnThePhone,1)); + BC_ASSERT_TRUE(call(marie,pauline)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityOnThePhone,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphonePresenceActivityOnThePhone,1)); reset_counters(&marie->stat); reset_counters(&pauline->stat); linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphonePresenceActivityOnline,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityOnline,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphonePresenceActivityOnline,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityOnline,1)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } @@ -277,48 +276,48 @@ static void presence_information(void) { char *contact2; time_t current_timestamp, presence_timestamp; - CU_ASSERT_TRUE(subscribe_to_callee_presence(marie, pauline)); + BC_ASSERT_TRUE(subscribe_to_callee_presence(marie, pauline)); /* Presence activity without description. */ presence = linphone_presence_model_new_with_activity(LinphonePresenceActivityDinner, NULL); linphone_core_set_presence_model(pauline->lc, presence); wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityDinner,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityDinner, 1); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityDinner, 1, int, "%d"); activity = linphone_presence_model_get_activity(marie->stat.last_received_presence); - CU_ASSERT_PTR_NOT_NULL(activity); - CU_ASSERT_EQUAL(linphone_presence_activity_get_type(activity), LinphonePresenceActivityDinner); + BC_ASSERT_PTR_NOT_NULL(activity); + BC_ASSERT_EQUAL(linphone_presence_activity_get_type(activity), LinphonePresenceActivityDinner, int, "%d"); description = linphone_presence_activity_get_description(activity); - CU_ASSERT_PTR_NULL(description); + BC_ASSERT_PTR_NULL(description); /* Presence activity with description. */ presence = linphone_presence_model_new_with_activity(LinphonePresenceActivitySteering, bike_description); linphone_core_set_presence_model(pauline->lc, presence); wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivitySteering,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivitySteering, 1); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivitySteering, 1, int, "%d"); activity = linphone_presence_model_get_activity(marie->stat.last_received_presence); - CU_ASSERT_PTR_NOT_NULL(activity); - CU_ASSERT_EQUAL(linphone_presence_activity_get_type(activity), LinphonePresenceActivitySteering); + BC_ASSERT_PTR_NOT_NULL(activity); + BC_ASSERT_EQUAL(linphone_presence_activity_get_type(activity), LinphonePresenceActivitySteering, int, "%d"); description = linphone_presence_activity_get_description(activity); - CU_ASSERT_PTR_NOT_NULL(description); - if (description != NULL) CU_ASSERT_EQUAL(strcmp(description, bike_description), 0); + BC_ASSERT_PTR_NOT_NULL(description); + if (description != NULL) BC_ASSERT_EQUAL(strcmp(description, bike_description), 0, int, "%d"); /* Presence activity with description and note. */ presence = linphone_presence_model_new_with_activity_and_note(LinphonePresenceActivityVacation, NULL, vacation_note, vacation_lang); linphone_core_set_presence_model(pauline->lc, presence); wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityVacation,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityVacation, 1); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityVacation, 1, int, "%d"); activity = linphone_presence_model_get_activity(marie->stat.last_received_presence); - CU_ASSERT_PTR_NOT_NULL(activity); - CU_ASSERT_EQUAL(linphone_presence_activity_get_type(activity), LinphonePresenceActivityVacation); + BC_ASSERT_PTR_NOT_NULL(activity); + BC_ASSERT_EQUAL(linphone_presence_activity_get_type(activity), LinphonePresenceActivityVacation, int, "%d"); description = linphone_presence_activity_get_description(activity); - CU_ASSERT_PTR_NULL(description); + BC_ASSERT_PTR_NULL(description); note = linphone_presence_model_get_note(marie->stat.last_received_presence, NULL); - CU_ASSERT_PTR_NOT_NULL(note); + BC_ASSERT_PTR_NOT_NULL(note); if (note != NULL) { note_content = linphone_presence_note_get_content(note); - CU_ASSERT_PTR_NOT_NULL(note_content); + BC_ASSERT_PTR_NOT_NULL(note_content); if (note_content != NULL) { - CU_ASSERT_EQUAL(strcmp(note_content, vacation_note), 0); + BC_ASSERT_EQUAL(strcmp(note_content, vacation_note), 0, int, "%d"); } } @@ -327,11 +326,11 @@ static void presence_information(void) { linphone_presence_model_set_contact(presence, contact); linphone_core_set_presence_model(pauline->lc, presence); wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityOnThePhone,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityOnThePhone, 1); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityOnThePhone, 1, int, "%d"); contact2 = linphone_presence_model_get_contact(presence); - CU_ASSERT_PTR_NOT_NULL(contact2); + BC_ASSERT_PTR_NOT_NULL(contact2); if (contact2 != NULL) { - CU_ASSERT_EQUAL(strcmp(contact, contact2), 0); + BC_ASSERT_EQUAL(strcmp(contact, contact2), 0, int, "%d"); ms_free(contact2); } @@ -340,9 +339,9 @@ static void presence_information(void) { presence = linphone_presence_model_new_with_activity(LinphonePresenceActivityShopping, NULL); linphone_core_set_presence_model(pauline->lc, presence); wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityShopping,1); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityShopping, 1); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityShopping, 1, int, "%d"); presence_timestamp = linphone_presence_model_get_timestamp(presence); - CU_ASSERT_TRUE(presence_timestamp >= current_timestamp); + BC_ASSERT_TRUE(presence_timestamp >= current_timestamp); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -367,7 +366,7 @@ static void test_subscribe_notify_publish(void) { /*wait for subscribe acknowledgment*/ wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyReceived,1,2000); - CU_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf)); + BC_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf), int, "%d"); /*enable publish*/ @@ -380,23 +379,23 @@ static void test_subscribe_notify_publish(void) { /*wait for marie status*/ wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyReceived,2,2000); - CU_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf)); + BC_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf), int, "%d"); presence =linphone_presence_model_new_with_activity(LinphonePresenceActivityBusy,NULL); linphone_core_set_presence_model(marie->lc,presence); /*wait for new status*/ wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyReceived,3,2000); - CU_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf)); + BC_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf), int, "%d"); /*wait for refresh*/ wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyReceived,4,5000); - CU_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf)); + BC_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf), int, "%d"); /*linphone_core_remove_friend(pauline->lc,lf);*/ /*wait for final notify*/ /*wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyReceived,4,5000); - CU_ASSERT_EQUAL(LinphonePresenceActivityOffline,linphone_friend_get_status(lf)); + BC_ASSERT_EQUAL(LinphonePresenceActivityOffline,linphone_friend_get_status(lf), int, "%d"); */ linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -426,7 +425,7 @@ static void test_forked_subscribe_notify_publish(void) { /*wait for subscribe acknowledgment*/ wait_for_list(lcs,&pauline->stat.number_of_NotifyReceived,1,2000); - CU_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf)); + BC_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf), int, "%d"); /*enable publish*/ @@ -445,21 +444,21 @@ static void test_forked_subscribe_notify_publish(void) { /*wait for marie status*/ wait_for_list(lcs,&pauline->stat.number_of_NotifyReceived,3,2000); - CU_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf)); + BC_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf), int, "%d"); presence =linphone_presence_model_new_with_activity(LinphonePresenceActivityBusy,NULL); linphone_core_set_presence_model(marie->lc,presence); /*wait for new status*/ wait_for_list(lcs,&pauline->stat.number_of_NotifyReceived,4,2000); - CU_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf)); + BC_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf), int, "%d"); presence =linphone_presence_model_new_with_activity( LinphonePresenceActivityMeeting,NULL); linphone_core_set_presence_model(marie2->lc,presence); /*wait for new status*/ wait_for_list(lcs,&pauline->stat.number_of_NotifyReceived,5,2000); - CU_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf)); /*because liblinphone compositor is very simple for now (I.E only take first occurence)*/ + BC_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf), int, "%d"); /*because liblinphone compositor is very simple for now (I.E only take first occurence)*/ linphone_core_manager_destroy(marie); linphone_core_manager_destroy(marie2); diff --git a/tester/quality_reporting_tester.c b/tester/quality_reporting_tester.c index ca8f563e1..e5c97b8ee 100644 --- a/tester/quality_reporting_tester.c +++ b/tester/quality_reporting_tester.c @@ -34,59 +34,59 @@ void on_report_send_mandatory(const LinphoneCall *call, int stream_type, const L }else{ ms = (MediaStream*)call->videostream; } - CU_ASSERT_TRUE( + BC_ASSERT_TRUE( __strstr(body, "VQIntervalReport\r\n") == body || __strstr(body, "VQSessionReport\r\n") == body || __strstr(body, "VQSessionReport: CallTerm\r\n") == body ); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "CallID:")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalID:")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteID:")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "OrigID:")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalGroup:")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteGroup:")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalAddr:")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "IP=")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PORT=")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SSRC=")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteAddr:")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "IP=")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PORT=")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SSRC=")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalMetrics:")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Timestamps:")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "START=")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "STOP=")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "CallID:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalID:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteID:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "OrigID:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalGroup:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteGroup:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalAddr:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "IP=")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PORT=")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SSRC=")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteAddr:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "IP=")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PORT=")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SSRC=")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalMetrics:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Timestamps:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "START=")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "STOP=")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SessionDesc:")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PT=")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PD=")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SR=")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SessionDesc:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PT=")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PD=")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SR=")); /* We should have not reached RemoteMetrics section yet */ - CU_ASSERT_TRUE(!remote_metrics_start || body < remote_metrics_start); + BC_ASSERT_TRUE(!remote_metrics_start || body < remote_metrics_start); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "DialogID:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "DialogID:")); if (report->remote_metrics.rtcp_sr_count&&ms!=NULL&&ms->rc!=NULL){ /* Hack: reset rtcp_sr_count to 0 because in case of interval reports, we need one RTCP SR by interval */ report->remote_metrics.rtcp_sr_count=0; - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "AdaptiveAlg:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "AdaptiveAlg:")); } } char * on_report_send_verify_metrics(const reporting_content_metrics_t *metrics, char * body){ if (metrics->rtcp_xr_count){ - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SessionDesc:")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "JitterBuffer:")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PacketLoss:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SessionDesc:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "JitterBuffer:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PacketLoss:")); } if (metrics->rtcp_sr_count+metrics->rtcp_xr_count>0){ - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Delay:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Delay:")); } if (metrics->rtcp_xr_count){ - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "QualityEst:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "QualityEst:")); } return body; @@ -97,8 +97,8 @@ void on_report_send_with_rtcp_xr_local(const LinphoneCall *call, int stream_type char * remote_metrics_start = __strstr(body, "RemoteMetrics:"); reporting_session_report_t * report = call->log->reporting.reports[stream_type]; on_report_send_mandatory(call,stream_type,content); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalMetrics:")); - CU_ASSERT_TRUE(!remote_metrics_start || on_report_send_verify_metrics(&report->local_metrics,body) < remote_metrics_start); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalMetrics:")); + BC_ASSERT_TRUE(!remote_metrics_start || on_report_send_verify_metrics(&report->local_metrics,body) < remote_metrics_start); } void on_report_send_with_rtcp_xr_remote(const LinphoneCall *call, int stream_type, const LinphoneContent *content){ char * body = (char*)linphone_content_get_buffer(content); @@ -106,8 +106,8 @@ void on_report_send_with_rtcp_xr_remote(const LinphoneCall *call, int stream_typ on_report_send_mandatory(call,stream_type,content); if (report->remote_metrics.rtcp_sr_count+report->remote_metrics.rtcp_xr_count>0){ - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteMetrics:")); - CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Timestamps:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteMetrics:")); + BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Timestamps:")); on_report_send_verify_metrics(&report->remote_metrics,body); } } @@ -127,15 +127,15 @@ bool_t create_call_for_quality_reporting_tests( bool_t call_succeeded = call_with_params(marie,pauline,params_marie,params_pauline); - CU_ASSERT_TRUE(call_succeeded); + BC_ASSERT_TRUE(call_succeeded); if (call_succeeded) { if (call_marie) { *call_marie = linphone_core_get_current_call(marie->lc); - CU_ASSERT_PTR_NOT_NULL(*call_marie); + BC_ASSERT_PTR_NOT_NULL(*call_marie); } if (call_pauline) { *call_pauline = linphone_core_get_current_call(pauline->lc); - CU_ASSERT_PTR_NOT_NULL(*call_pauline); + BC_ASSERT_PTR_NOT_NULL(*call_pauline); } } return call_succeeded; @@ -149,17 +149,17 @@ static void quality_reporting_not_used_without_config() { if (create_call_for_quality_reporting_tests(marie, pauline, &call_marie, &call_pauline, NULL, NULL)) { // marie has stats collection enabled but pauline has not - CU_ASSERT_TRUE(linphone_proxy_config_quality_reporting_enabled(call_marie->dest_proxy)); - CU_ASSERT_FALSE(linphone_proxy_config_quality_reporting_enabled(call_pauline->dest_proxy)); + BC_ASSERT_TRUE(linphone_proxy_config_quality_reporting_enabled(call_marie->dest_proxy)); + BC_ASSERT_FALSE(linphone_proxy_config_quality_reporting_enabled(call_pauline->dest_proxy)); - CU_ASSERT_EQUAL(strcmp("sip:collector@sip.example.org", - linphone_proxy_config_get_quality_reporting_collector(call_marie->dest_proxy)), 0); + BC_ASSERT_STRING_EQUAL(linphone_proxy_config_get_quality_reporting_collector(call_marie->dest_proxy), + "sip:collector@sip.example.org"); // this field should be already filled - CU_ASSERT_PTR_NOT_NULL(call_marie->log->reporting.reports[0]->info.local_addr.ip); + BC_ASSERT_PTR_NOT_NULL(call_marie->log->reporting.reports[0]->info.local_addr.ip); // but not this one since it is updated at the end of call - CU_ASSERT_PTR_NULL(call_marie->log->reporting.reports[0]->dialog_id); + BC_ASSERT_PTR_NULL(call_marie->log->reporting.reports[0]->dialog_id); } linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -175,13 +175,13 @@ static void quality_reporting_not_sent_if_call_not_started() { out_call = linphone_core_invite(marie->lc,"pauline"); linphone_call_ref(out_call); - CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallError,1, 10000)); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallError,1); + BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallError,1, 10000)); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallError,1, int, "%d"); if (ms_list_size(linphone_core_get_call_logs(marie->lc))>0) { out_call_log=(LinphoneCallLog*)(linphone_core_get_call_logs(marie->lc)->data); - CU_ASSERT_PTR_NOT_NULL(out_call_log); - CU_ASSERT_EQUAL(linphone_call_log_get_status(out_call_log),LinphoneCallAborted); + BC_ASSERT_PTR_NOT_NULL(out_call_log); + BC_ASSERT_EQUAL(linphone_call_log_get_status(out_call_log),LinphoneCallAborted, int, "%d"); } linphone_call_unref(out_call); @@ -189,8 +189,8 @@ static void quality_reporting_not_sent_if_call_not_started() { wait_for_until(marie->lc,NULL,NULL,0,1000); // since the callee was busy, there should be no publish to do - CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0, int, "%d"); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -207,8 +207,8 @@ static void quality_reporting_not_sent_if_low_bandwidth() { if (create_call_for_quality_reporting_tests(marie, pauline, NULL, NULL, marie_params, NULL)) { linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0, int, "%d"); } linphone_call_params_destroy(marie_params); linphone_core_manager_destroy(marie); @@ -232,9 +232,9 @@ static void quality_reporting_invalid_report() { linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,1)); - CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishError,1,3000)); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,1)); + BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishError,1,3000)); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0, int, "%d"); } linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -252,17 +252,17 @@ static void quality_reporting_at_call_termination() { linphone_core_terminate_all_calls(marie->lc); // now dialog id should be filled - CU_ASSERT_PTR_NOT_NULL(call_marie->log->reporting.reports[0]->dialog_id); + BC_ASSERT_PTR_NOT_NULL(call_marie->log->reporting.reports[0]->dialog_id); - CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallReleased,1, 10000)); - CU_ASSERT_TRUE(wait_for_until(pauline->lc,NULL,&pauline->stat.number_of_LinphoneCallReleased,1, 10000)); + BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallReleased,1, 10000)); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,NULL,&pauline->stat.number_of_LinphoneCallReleased,1, 10000)); - CU_ASSERT_PTR_NULL(linphone_core_get_current_call(marie->lc)); - CU_ASSERT_PTR_NULL(linphone_core_get_current_call(pauline->lc)); + BC_ASSERT_PTR_NULL(linphone_core_get_current_call(marie->lc)); + BC_ASSERT_PTR_NULL(linphone_core_get_current_call(pauline->lc)); // PUBLISH submission to the collector should be ok - CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphonePublishProgress,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphonePublishOk,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphonePublishProgress,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphonePublishOk,1)); } linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -278,12 +278,12 @@ static void quality_reporting_interval_report() { linphone_reporting_set_on_report_send(call_marie, on_report_send_mandatory); linphone_proxy_config_set_quality_reporting_interval(call_marie->dest_proxy, 10); - CU_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(marie->lc)); - CU_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(pauline->lc)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(marie->lc)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(pauline->lc)); // PUBLISH submission to the collector should be ok - CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,3,60000)); - CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,3,60000)); + BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,3,60000)); + BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,3,60000)); } linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -309,25 +309,25 @@ static void quality_reporting_session_report_if_video_stopped() { if (create_call_for_quality_reporting_tests(marie, pauline, &call_marie, &call_pauline, marie_params, pauline_params)) { linphone_reporting_set_on_report_send(call_marie, on_report_send_with_rtcp_xr_local); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0); - CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0, int, "%d"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0, int, "%d"); - CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,NULL,0,3000)); - CU_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(call_pauline))); + BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,NULL,0,3000)); + BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(call_pauline))); /*remove video*/ linphone_call_params_enable_video(pauline_params,FALSE); linphone_core_update_call(pauline->lc,call_pauline,pauline_params); - CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,1,5000)); - CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,1,5000)); + BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,1,5000)); + BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,1,5000)); - CU_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(call_pauline))); + BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(call_pauline))); linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,2,5000)); - CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,2,5000)); + BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,2,5000)); + BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,2,5000)); } linphone_call_params_destroy(marie_params); linphone_call_params_destroy(pauline_params); diff --git a/tester/register_tester.c b/tester/register_tester.c index ee945f0da..5f13243cc 100644 --- a/tester/register_tester.c +++ b/tester/register_tester.c @@ -16,8 +16,7 @@ along with this program. If not, see . */ -#include -#include "CUnit/Basic.h" + #include "linphonecore.h" #include "private.h" #include "liblinphone_tester.h" @@ -64,7 +63,7 @@ void registration_state_changed(struct _LinphoneCore *lc, LinphoneProxyConfig *c case LinphoneRegistrationCleared:counters->number_of_LinphoneRegistrationCleared++;break; case LinphoneRegistrationFailed:counters->number_of_LinphoneRegistrationFailed++;break; default: - CU_FAIL("unexpected event");break; + BC_FAIL("unexpected event");break; } } @@ -84,7 +83,7 @@ static void register_with_refresh_base_3(LinphoneCore* lc const char* server_addr; LinphoneAuthInfo *info; - CU_ASSERT_PTR_NOT_NULL(lc); + BC_ASSERT_PTR_NOT_NULL(lc); if (!lc) return; counters = get_stats(lc); reset_counters(counters); @@ -116,7 +115,7 @@ static void register_with_refresh_base_3(LinphoneCore* lc linphone_core_iterate(lc); if (counters->number_of_auth_info_requested>0 && linphone_proxy_config_get_state(proxy_cfg) == LinphoneRegistrationFailed && late_auth_info) { if (!linphone_core_get_auth_info_list(lc)) { - CU_ASSERT_EQUAL(linphone_proxy_config_get_error(proxy_cfg),LinphoneReasonUnauthorized); + BC_ASSERT_EQUAL(linphone_proxy_config_get_error(proxy_cfg),LinphoneReasonUnauthorized, int, "%d"); info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain,NULL); /*create authentication structure from identity*/ linphone_core_add_auth_info(lc,info); /*add authentication info to LinphoneCore*/ } @@ -126,15 +125,15 @@ static void register_with_refresh_base_3(LinphoneCore* lc break; /*no need to continue*/ ms_usleep(100000); } - CU_ASSERT_EQUAL(linphone_proxy_config_is_registered(proxy_cfg),(expected_final_state == LinphoneRegistrationOk)); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationNone,0); - CU_ASSERT_TRUE(counters->number_of_LinphoneRegistrationProgress>=1); + BC_ASSERT_EQUAL(linphone_proxy_config_is_registered(proxy_cfg),(expected_final_state == LinphoneRegistrationOk), int, "%d"); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationNone,0, int, "%d"); + BC_ASSERT_TRUE(counters->number_of_LinphoneRegistrationProgress>=1); if (expected_final_state == LinphoneRegistrationOk) { - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,1+(refresh!=0)); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,late_auth_info?1:0); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,1+(refresh!=0), int, "%d"); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,late_auth_info?1:0, int, "%d"); } else /*checking to be done outside this functions*/ - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0, int, "%d"); } @@ -155,7 +154,7 @@ static void register_with_refresh(LinphoneCoreManager* lcm, bool_t refresh,const stats* counters = &lcm->stat; register_with_refresh_base(lcm->lc,refresh,domain,route); linphone_core_manager_stop(lcm); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,1); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,1, int, "%d"); } static void register_with_refresh_with_send_error() { @@ -174,10 +173,10 @@ static void register_with_refresh_with_send_error() { linphone_core_iterate(lcm->lc); ms_usleep(100000); } - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,2); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0, int, "%d"); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,2, int, "%d"); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0, int, "%d"); linphone_core_manager_destroy(lcm); } @@ -186,7 +185,7 @@ static void simple_register(){ LinphoneCoreManager* lcm = create_lcm(); stats* counters = &lcm->stat; register_with_refresh(lcm,FALSE,NULL,NULL); - CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,0); + BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,0, int, "%d"); linphone_core_manager_destroy(lcm); } @@ -204,8 +203,8 @@ static void register_with_custom_headers(void){ linphone_core_set_network_reachable(marie->lc, TRUE); wait_for(marie->lc, NULL, &marie->stat.number_of_LinphoneRegistrationOk,initial_register_ok+1); value=linphone_proxy_config_get_custom_header(cfg, "Server"); - CU_ASSERT_PTR_NOT_NULL(value); - if (value) CU_ASSERT_TRUE(strstr(value, "Flexisip")!=NULL); + BC_ASSERT_PTR_NOT_NULL(value); + if (value) BC_ASSERT_TRUE(strstr(value, "Flexisip")!=NULL); linphone_core_manager_destroy(marie); } @@ -221,10 +220,10 @@ static void simple_unregister(){ reset_counters(counters); /*clear stats*/ /*nothing is supposed to arrive until done*/ - CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000)); + BC_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000)); linphone_proxy_config_enable_register(proxy_config,FALSE); linphone_proxy_config_done(proxy_config); - CU_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1)); + BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1)); linphone_core_manager_destroy(lcm); } @@ -240,16 +239,16 @@ static void change_expires(){ reset_counters(counters); /*clear stats*/ /*nothing is supposed to arrive until done*/ - CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000)); + BC_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000)); linphone_proxy_config_set_expires(proxy_config,3); linphone_proxy_config_done(proxy_config); - CU_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1)); + BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1)); /*wait 2s without receive refresh*/ - CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,2,2000)); + BC_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,2,2000)); /* now, it should be ok*/ - CU_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,2)); + BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,2)); linphone_core_manager_destroy(lcm); @@ -260,7 +259,7 @@ static void simple_register_with_refresh() { LinphoneCoreManager* lcm = create_lcm(); stats* counters = &lcm->stat; register_with_refresh(lcm,TRUE,NULL,NULL); - CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,0); + BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,0, int, "%d"); linphone_core_manager_destroy(lcm); } @@ -270,7 +269,7 @@ static void simple_auth_register_with_refresh() { char route[256]; sprintf(route,"sip:%s",test_route); register_with_refresh(lcm,TRUE,auth_domain,route); - CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,1); + BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,1, int, "%d"); linphone_core_manager_destroy(lcm); } @@ -313,7 +312,7 @@ static void simple_authenticated_register(){ linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/ counters = &lcm->stat; register_with_refresh(lcm,FALSE,auth_domain,route); - CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,0); + BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,0, int, "%d"); } static void ha1_authenticated_register(){ @@ -328,7 +327,7 @@ static void ha1_authenticated_register(){ linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/ counters = &lcm->stat; register_with_refresh(lcm,FALSE,auth_domain,route); - CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,0); + BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,0, int, "%d"); } static void authenticated_register_with_no_initial_credentials(){ @@ -347,7 +346,7 @@ static void authenticated_register_with_no_initial_credentials(){ counters= get_stats(mgr->lc); counters->number_of_auth_info_requested=0; register_with_refresh(mgr,FALSE,auth_domain,route); - CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,1); + BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,1, int, "%d"); linphone_core_manager_destroy(mgr); } @@ -364,7 +363,7 @@ static void authenticated_register_with_late_credentials(){ counters = get_stats(mgr->lc); register_with_refresh_base_2(mgr->lc,FALSE,auth_domain,route,TRUE,transport); - CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,1); + BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,1, int, "%d"); linphone_core_manager_destroy(mgr); } @@ -384,9 +383,9 @@ static void authenticated_register_with_wrong_late_credentials(){ counters = get_stats(mgr->lc); register_with_refresh_base_3(mgr->lc,FALSE,auth_domain,route,TRUE,transport,LinphoneRegistrationFailed); - CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,2); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,2); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,2); + BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,2, int, "%d"); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,2, int, "%d"); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,2, int, "%d"); test_password=saved_test_passwd; linphone_core_manager_destroy(mgr); @@ -407,23 +406,23 @@ static void authenticated_register_with_wrong_credentials_with_params_base(const linphone_core_add_auth_info(mgr->lc,info); /*add wrong authentication info to LinphoneCore*/ counters = get_stats(mgr->lc); register_with_refresh_base_3(mgr->lc,TRUE,auth_domain,route,FALSE,transport,LinphoneRegistrationFailed); - //CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,3); register_with_refresh_base_3 does not alow to precisely check number of number_of_auth_info_requested + //BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,3, int, "%d"); register_with_refresh_base_3 does not alow to precisely check number of number_of_auth_info_requested /*wait for retry*/ - CU_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_auth_info_requested,4)); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,1); + BC_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_auth_info_requested,4)); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,1, int, "%d"); /*check the detailed error info */ if (!user_agent || strcmp(user_agent,"tester-no-403")!=0){ LinphoneProxyConfig *cfg=NULL; linphone_core_get_default_proxy(mgr->lc,&cfg); - CU_ASSERT_PTR_NOT_NULL(cfg); + BC_ASSERT_PTR_NOT_NULL(cfg); if (cfg){ const LinphoneErrorInfo *ei=linphone_proxy_config_get_error_info(cfg); const char *phrase=linphone_error_info_get_phrase(ei); - CU_ASSERT_PTR_NOT_NULL(phrase); - if (phrase) CU_ASSERT_TRUE(strcmp(phrase,"Forbidden")==0); - CU_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),403); - CU_ASSERT_PTR_NULL(linphone_error_info_get_details(ei)); + BC_ASSERT_PTR_NOT_NULL(phrase); + if (phrase) BC_ASSERT_TRUE(strcmp(phrase,"Forbidden")==0); + BC_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),403, int, "%d"); + BC_ASSERT_PTR_NULL(linphone_error_info_get_details(ei)); } } @@ -450,7 +449,7 @@ static void authenticated_register_with_wrong_credentials_2() { linphone_proxy_config_enable_register(proxy,FALSE); linphone_proxy_config_done(proxy); current_in_progress=counters->number_of_LinphoneRegistrationProgress; - CU_ASSERT_FALSE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationProgress,current_in_progress+1)); + BC_ASSERT_FALSE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationProgress,current_in_progress+1)); linphone_core_manager_destroy(mgr); } @@ -460,8 +459,8 @@ static void authenticated_register_with_wrong_credentials_without_403() { static LinphoneCoreManager* configure_lcm(void) { LinphoneCoreManager *mgr=linphone_core_manager_new( "multi_account_rc"); stats *counters=&mgr->stat; - CU_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationOk,ms_list_size(linphone_core_get_proxy_config_list(mgr->lc)))); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0); + BC_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationOk,ms_list_size(linphone_core_get_proxy_config_list(mgr->lc)))); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0, int, "%d"); return mgr; } @@ -479,10 +478,10 @@ static void network_state_change(){ counters = get_stats(lc); register_ok=counters->number_of_LinphoneRegistrationOk; linphone_core_set_network_reachable(lc,FALSE); - CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_NetworkReachableFalse,1)); - CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationNone,register_ok)); + BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_NetworkReachableFalse,1)); + BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationNone,register_ok)); linphone_core_set_network_reachable(lc,TRUE); - CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_NetworkReachableTrue,1)); + BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_NetworkReachableTrue,1)); wait_for(lc,lc,&counters->number_of_LinphoneRegistrationOk,2*register_ok); linphone_core_manager_destroy(mgr); @@ -522,9 +521,9 @@ static void transport_change(){ /*keep only udp*/ linphone_core_set_sip_transports(lc,&sip_tr); - CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationOk,register_ok+number_of_udp_proxy)); + BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationOk,register_ok+number_of_udp_proxy)); - CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationFailed,total_number_of_proxies-number_of_udp_proxy)); + BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationFailed,total_number_of_proxies-number_of_udp_proxy)); linphone_core_manager_destroy(mgr); } @@ -544,7 +543,7 @@ static void proxy_transport_change(){ reset_counters(counters); /*clear stats*/ linphone_proxy_config_edit(proxy_config); - CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000)); + BC_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000)); addr = linphone_address_new(linphone_proxy_config_get_addr(proxy_config)); if (LinphoneTransportTcp == linphone_address_get_transport(addr)) { @@ -556,9 +555,9 @@ static void proxy_transport_change(){ linphone_proxy_config_done(proxy_config); - CU_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1)); + BC_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1)); /*as we change p[roxy server destination, we should'nt be notified about the clear*/ - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0, int, "%d"); ms_free(addr_as_string); linphone_address_destroy(addr); linphone_core_manager_destroy(lcm); @@ -580,16 +579,16 @@ static void proxy_transport_change_with_wrong_port() { linphone_core_get_default_proxy(lcm->lc,&proxy_config); linphone_proxy_config_edit(proxy_config); - CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000)); + BC_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000)); linphone_proxy_config_set_server_addr(proxy_config,route); linphone_proxy_config_done(proxy_config); - CU_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1)); + BC_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1)); /*as we change proxy server destination, we should'nt be notified about the clear*/ - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,1); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,1); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0, int, "%d"); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,1, int, "%d"); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,1, int, "%d"); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0, int, "%d"); linphone_core_manager_destroy(lcm); @@ -611,14 +610,14 @@ static void proxy_transport_change_with_wrong_port_givin_up() { linphone_core_get_default_proxy(lcm->lc,&proxy_config); linphone_proxy_config_edit(proxy_config); - CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000)); + BC_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000)); linphone_proxy_config_enableregister(proxy_config,FALSE); linphone_proxy_config_done(proxy_config); - CU_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1)); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,0); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,1); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0); + BC_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1)); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,0, int, "%d"); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,1, int, "%d"); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0, int, "%d"); linphone_core_manager_destroy(lcm); @@ -639,8 +638,8 @@ static void io_recv_error(){ number_of_udp_proxy=get_number_of_udp_proxy(lc); sal_set_recv_error(lc->sal, 0); - CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationProgress,2*(register_ok-number_of_udp_proxy) /*because 1 udp*/)); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0) + BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationProgress,2*(register_ok-number_of_udp_proxy) /*because 1 udp*/)); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0,int,"%d"); sal_set_recv_error(lc->sal, 1); /*reset*/ @@ -662,11 +661,11 @@ static void io_recv_error_retry_immediatly(){ number_of_udp_proxy=get_number_of_udp_proxy(lc); sal_set_recv_error(lc->sal, 0); - CU_ASSERT_TRUE(wait_for(lc,NULL,&counters->number_of_LinphoneRegistrationProgress,(register_ok-number_of_udp_proxy)+register_ok /*because 1 udp*/)); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0) + BC_ASSERT_TRUE(wait_for(lc,NULL,&counters->number_of_LinphoneRegistrationProgress,(register_ok-number_of_udp_proxy)+register_ok /*because 1 udp*/)); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0,int,"%d"); sal_set_recv_error(lc->sal, 1); /*reset*/ - CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationOk,register_ok-number_of_udp_proxy+register_ok)); + BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationOk,register_ok-number_of_udp_proxy+register_ok)); linphone_core_manager_destroy(mgr); } @@ -683,7 +682,7 @@ static void io_recv_error_late_recovery(){ lc=mgr->lc; sal_set_refresher_retry_after(lc->sal,1000); counters=&mgr->stat; - CU_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationOk,ms_list_size(linphone_core_get_proxy_config_list(mgr->lc)))); + BC_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationOk,ms_list_size(linphone_core_get_proxy_config_list(mgr->lc)))); counters = get_stats(lc); @@ -693,15 +692,15 @@ static void io_recv_error_late_recovery(){ sal_set_recv_error(lc->sal, 0); sal_set_send_error(lc->sal, -1); - CU_ASSERT_TRUE(wait_for(lc,NULL,&counters->number_of_LinphoneRegistrationProgress,(register_ok-number_of_udp_proxy)+register_ok /*because 1 udp*/)); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0) + BC_ASSERT_TRUE(wait_for(lc,NULL,&counters->number_of_LinphoneRegistrationProgress,(register_ok-number_of_udp_proxy)+register_ok /*because 1 udp*/)); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0,int,"%d"); - CU_ASSERT_TRUE(wait_for_list(lcs=ms_list_append(NULL,lc),&counters->number_of_LinphoneRegistrationFailed,(register_ok-number_of_udp_proxy),sal_get_refresher_retry_after(lc->sal)+3000)); + BC_ASSERT_TRUE(wait_for_list(lcs=ms_list_append(NULL,lc),&counters->number_of_LinphoneRegistrationFailed,(register_ok-number_of_udp_proxy),sal_get_refresher_retry_after(lc->sal)+3000)); sal_set_recv_error(lc->sal, 1); /*reset*/ sal_set_send_error(lc->sal, 0); - CU_ASSERT_TRUE(wait_for_list(lcs=ms_list_append(NULL,lc),&counters->number_of_LinphoneRegistrationOk,register_ok-number_of_udp_proxy +register_ok,sal_get_refresher_retry_after(lc->sal)+3000)); + BC_ASSERT_TRUE(wait_for_list(lcs=ms_list_append(NULL,lc),&counters->number_of_LinphoneRegistrationOk,register_ok-number_of_udp_proxy +register_ok,sal_get_refresher_retry_after(lc->sal)+3000)); linphone_core_manager_destroy(mgr); } @@ -728,15 +727,15 @@ static void io_recv_error_without_active_register(){ } ms_list_free(proxys); /*wait for unregistrations*/ - CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationCleared,register_ok /*because 1 udp*/)); + BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationCleared,register_ok /*because 1 udp*/)); sal_set_recv_error(lc->sal, 0); /*nothing should happen because no active registration*/ wait_for_until(lc,lc, &dummy, 1, 3000); - CU_ASSERT_TRUE(counters->number_of_LinphoneRegistrationProgress == ms_list_size(linphone_core_get_proxy_config_list(lc))); + BC_ASSERT_TRUE(counters->number_of_LinphoneRegistrationProgress == ms_list_size(linphone_core_get_proxy_config_list(lc))); - CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0) + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0,int,"%d"); sal_set_recv_error(lc->sal, 1); /*reset*/ @@ -754,15 +753,15 @@ static void tls_certificate_failure(){ snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/agent.pem", bc_tester_read_dir_prefix); /*bad root ca*/ linphone_core_set_root_ca(mgr->lc,rootcapath); linphone_core_set_network_reachable(lc,TRUE); - CU_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&mgr->stat.number_of_LinphoneRegistrationFailed,1)); + BC_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&mgr->stat.number_of_LinphoneRegistrationFailed,1)); linphone_core_set_root_ca(mgr->lc,NULL); /*no root ca*/ linphone_core_refresh_registers(mgr->lc); - CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationFailed,2)); + BC_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationFailed,2)); snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/cafile.pem", bc_tester_read_dir_prefix); /*goot root ca*/ linphone_core_set_root_ca(mgr->lc,rootcapath); linphone_core_refresh_registers(mgr->lc); - CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,1)); - CU_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationFailed,2); + BC_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,1)); + BC_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationFailed,2, int, "%d"); linphone_core_destroy(mgr->lc); } @@ -785,7 +784,7 @@ static void tls_with_non_tls_server(){ linphone_proxy_config_set_server_addr(proxy_cfg,tmp); linphone_proxy_config_done(proxy_cfg); linphone_address_destroy(addr); - CU_ASSERT_TRUE(wait_for_until(lc,lc,&mgr->stat.number_of_LinphoneRegistrationFailed,1,5000)); + BC_ASSERT_TRUE(wait_for_until(lc,lc,&mgr->stat.number_of_LinphoneRegistrationFailed,1,5000)); linphone_core_manager_destroy(mgr); } @@ -799,8 +798,8 @@ static void tls_alt_name_register(){ snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/cafile.pem", bc_tester_read_dir_prefix); linphone_core_set_root_ca(mgr->lc,rootcapath); linphone_core_refresh_registers(mgr->lc); - CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,1)); - CU_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationFailed,0); + BC_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,1)); + BC_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationFailed,0, int, "%d"); linphone_core_manager_destroy(mgr); } @@ -814,8 +813,8 @@ static void tls_wildcard_register(){ snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/cafile.pem", bc_tester_read_dir_prefix); linphone_core_set_root_ca(mgr->lc,rootcapath); linphone_core_refresh_registers(mgr->lc); - CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,2)); - CU_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationFailed,0); + BC_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,2)); + BC_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationFailed,0, int, "%d"); linphone_core_destroy(mgr->lc); } diff --git a/tester/remote_provisioning_tester.c b/tester/remote_provisioning_tester.c index 12c194a67..ad3c5ebb1 100644 --- a/tester/remote_provisioning_tester.c +++ b/tester/remote_provisioning_tester.c @@ -16,8 +16,7 @@ along with this program. If not, see . */ -#include -#include "CUnit/Basic.h" + #include "linphonecore.h" #include "private.h" #include "liblinphone_tester.h" @@ -38,64 +37,64 @@ void linphone_configuration_status(LinphoneCore *lc, LinphoneConfiguringState st static void remote_provisioning_skipped(void) { LinphoneCoreManager* marie = linphone_core_manager_new2("marie_rc", FALSE); - CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSkipped,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSkipped,1)); linphone_core_manager_destroy(marie); } static void remote_provisioning_http(void) { LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_rc", FALSE); - CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1)); linphone_core_manager_destroy(marie); } static void remote_provisioning_transient(void) { LinphoneCoreManager* marie = linphone_core_manager_new2("marie_transient_remote_rc", FALSE); - CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1)); - CU_ASSERT_TRUE(linphone_core_is_provisioning_transient(marie->lc) == TRUE); - CU_ASSERT_TRUE(linphone_core_get_provisioning_uri(marie->lc) == NULL); + BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1)); + BC_ASSERT_TRUE(linphone_core_is_provisioning_transient(marie->lc) == TRUE); + BC_ASSERT_TRUE(linphone_core_get_provisioning_uri(marie->lc) == NULL); linphone_core_manager_destroy(marie); } static void remote_provisioning_https(void) { LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_https_rc", FALSE); - CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1)); - CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1)); linphone_core_manager_destroy(marie); } static void remote_provisioning_not_found(void) { LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_404_rc", FALSE); - CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1)); linphone_core_manager_destroy(marie); } static void remote_provisioning_invalid(void) { LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_invalid_rc", FALSE); - CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1)); linphone_core_manager_destroy(marie); } static void remote_provisioning_invalid_uri(void) { LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_invalid_uri_rc", FALSE); - CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1)); linphone_core_manager_destroy(marie); } static void remote_provisioning_default_values(void) { LinphoneProxyConfig *lpc; LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_default_values_rc", FALSE); - CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1)); lpc = linphone_core_create_proxy_config(marie->lc); - CU_ASSERT_TRUE(lpc->reg_sendregister == TRUE); - CU_ASSERT_TRUE(lpc->expires == 604800); - CU_ASSERT_STRING_EQUAL(lpc->reg_proxy, ""); - CU_ASSERT_STRING_EQUAL(lpc->reg_route, ""); - CU_ASSERT_STRING_EQUAL(lpc->reg_identity, "sip:?@sip.linphone.org"); + BC_ASSERT_TRUE(lpc->reg_sendregister == TRUE); + BC_ASSERT_TRUE(lpc->expires == 604800); + BC_ASSERT_STRING_EQUAL(lpc->reg_proxy, ""); + BC_ASSERT_STRING_EQUAL(lpc->reg_route, ""); + BC_ASSERT_STRING_EQUAL(lpc->reg_identity, "sip:?@sip.linphone.org"); { LpConfig* lp = linphone_core_get_config(marie->lc); - CU_ASSERT_STRING_EQUAL(lp_config_get_string(lp,"app","toto","empty"),"titi"); + BC_ASSERT_STRING_EQUAL(lp_config_get_string(lp,"app","toto","empty"),"titi"); } linphone_core_manager_destroy(marie); @@ -112,10 +111,10 @@ static void remote_provisioning_file(void) { #else marie = linphone_core_manager_new2("marie_remote_localfile_rc", FALSE); #endif - CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1)); conf = linphone_core_get_config( marie->lc ); - CU_ASSERT_EQUAL( lp_config_get_int(conf,"misc","tester_file_ok", 0), 1 ); + BC_ASSERT_EQUAL( lp_config_get_int(conf,"misc","tester_file_ok", 0), 1 , int, "%d"); linphone_core_manager_destroy(marie); } diff --git a/tester/setup_tester.c b/tester/setup_tester.c index 217f257e6..cb1bcb883 100644 --- a/tester/setup_tester.c +++ b/tester/setup_tester.c @@ -16,8 +16,7 @@ along with this program. If not, see . */ -#include -#include "CUnit/Basic.h" + #include "linphonecore.h" #include "liblinphone_tester.h" #include "lpconfig.h" @@ -26,7 +25,7 @@ static void linphone_version_test(void){ const char *version=linphone_core_get_version(); /*make sure the git version is always included in the version number*/ - CU_ASSERT_TRUE(strstr(version,"unknown")==NULL); + BC_ASSERT_TRUE(strstr(version,"unknown")==NULL); } static void core_init_test(void) { @@ -36,7 +35,7 @@ static void core_init_test(void) { lc = linphone_core_new(&v_table,NULL,NULL,NULL); /* until we have good certificates on our test server... */ linphone_core_verify_server_certificates(lc,FALSE); - CU_ASSERT_PTR_NOT_NULL_FATAL(lc); + BC_ASSERT_PTR_NOT_NULL_FATAL(lc); linphone_core_destroy(lc); } @@ -50,10 +49,10 @@ static void core_sip_transport_test(void) { LCSipTransports tr; memset (&v_table,0,sizeof(v_table)); lc = linphone_core_new(&v_table,NULL,NULL,NULL); - CU_ASSERT_PTR_NOT_NULL_FATAL(lc); + BC_ASSERT_PTR_NOT_NULL_FATAL(lc); linphone_core_get_sip_transports(lc,&tr); - CU_ASSERT_EQUAL(tr.udp_port,5060); /*default config*/ - CU_ASSERT_EQUAL(tr.tcp_port,5060); /*default config*/ + BC_ASSERT_EQUAL(tr.udp_port,5060, int, "%d"); /*default config*/ + BC_ASSERT_EQUAL(tr.tcp_port,5060, int, "%d"); /*default config*/ tr.udp_port=LC_SIP_TRANSPORT_RANDOM; tr.tcp_port=LC_SIP_TRANSPORT_RANDOM; @@ -62,12 +61,12 @@ static void core_sip_transport_test(void) { linphone_core_set_sip_transports(lc,&tr); linphone_core_get_sip_transports(lc,&tr); - CU_ASSERT_NOT_EQUAL(tr.udp_port,5060); /*default config*/ - CU_ASSERT_NOT_EQUAL(tr.tcp_port,5060); /*default config*/ + BC_ASSERT_NOT_EQUAL(tr.udp_port,5060,int,"%d"); /*default config*/ + BC_ASSERT_NOT_EQUAL(tr.tcp_port,5060,int,"%d"); /*default config*/ - CU_ASSERT_EQUAL(lp_config_get_int(linphone_core_get_config(lc),"sip","sip_port",-2),LC_SIP_TRANSPORT_RANDOM); - CU_ASSERT_EQUAL(lp_config_get_int(linphone_core_get_config(lc),"sip","sip_tcp_port",-2),LC_SIP_TRANSPORT_RANDOM); - CU_ASSERT_EQUAL(lp_config_get_int(linphone_core_get_config(lc),"sip","sip_tls_port",-2),LC_SIP_TRANSPORT_RANDOM); + BC_ASSERT_EQUAL(lp_config_get_int(linphone_core_get_config(lc),"sip","sip_port",-2),LC_SIP_TRANSPORT_RANDOM, int, "%d"); + BC_ASSERT_EQUAL(lp_config_get_int(linphone_core_get_config(lc),"sip","sip_tcp_port",-2),LC_SIP_TRANSPORT_RANDOM, int, "%d"); + BC_ASSERT_EQUAL(lp_config_get_int(linphone_core_get_config(lc),"sip","sip_tls_port",-2),LC_SIP_TRANSPORT_RANDOM, int, "%d"); linphone_core_destroy(lc); } @@ -81,14 +80,14 @@ static void linphone_interpret_url_test() memset ( &v_table,0,sizeof ( v_table ) ); lc = linphone_core_new ( &v_table,NULL,NULL,NULL ); - CU_ASSERT_PTR_NOT_NULL_FATAL ( lc ); + BC_ASSERT_PTR_NOT_NULL_FATAL ( lc ); address = linphone_core_interpret_url(lc, sips_address); - CU_ASSERT_PTR_NOT_NULL_FATAL(address); - CU_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_scheme(address), "sips"); - CU_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_username(address), "margaux"); - CU_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_domain(address), "sip.linphone.org"); + BC_ASSERT_PTR_NOT_NULL_FATAL(address); + BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_scheme(address), "sips"); + BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_username(address), "margaux"); + BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_domain(address), "sip.linphone.org"); linphone_address_destroy(address); @@ -101,11 +100,11 @@ static void linphone_lpconfig_from_buffer(){ LpConfig* conf; conf = lp_config_new_from_buffer(buffer); - CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"buffer","test",""),"ok"); + BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"buffer","test",""),"ok"); lp_config_destroy(conf); conf = lp_config_new_from_buffer(buffer_linebreaks); - CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"buffer_linebreaks","test",""),"ok"); + BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"buffer_linebreaks","test",""),"ok"); lp_config_destroy(conf); } @@ -116,11 +115,11 @@ static void linphone_lpconfig_from_buffer_zerolen_value(){ conf = lp_config_new_from_buffer(zerolen); - CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL"); - CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test"); + BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL"); + BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test"); lp_config_set_string(conf, "test", "non_zero_len", ""); /* should remove "non_zero_len" */ - CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL"); + BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL"); lp_config_destroy(conf); } @@ -135,13 +134,13 @@ static void linphone_lpconfig_from_file_zerolen_value(){ stores the app bundle in read-only */ conf = lp_config_new_with_factory(NULL, rc_path); - CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL"); + BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL"); // non_zero_len=test -> should return test - CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test"); + BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test"); lp_config_set_string(conf, "test", "non_zero_len", ""); /* should remove "non_zero_len" */ - CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL"); + BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL"); ms_free(rc_path); lp_config_destroy(conf); @@ -154,15 +153,15 @@ static void linphone_lpconfig_from_xml_zerolen_value(){ LinphoneCoreManager* mgr = linphone_core_manager_new2("empty_rc",FALSE); - CU_ASSERT_EQUAL(linphone_remote_provisioning_load_file(mgr->lc, xml_path), 0); + BC_ASSERT_EQUAL(linphone_remote_provisioning_load_file(mgr->lc, xml_path), 0, int, "%d"); conf = mgr->lc->config; - CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL"); - CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test"); + BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL"); + BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test"); lp_config_set_string(conf, "test", "non_zero_len", ""); /* should remove "non_zero_len" */ - CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL"); + BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL"); linphone_core_manager_destroy(mgr); ms_free(xml_path); @@ -176,15 +175,15 @@ void linphone_proxy_config_address_equal_test() { LinphoneAddress *e = linphone_address_new("sip:toto@titi;transport=udp"); LinphoneAddress *f = linphone_address_new("sip:toto@titi?X-Create-Account=yes"); - CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,NULL), LinphoneProxyConfigAddressDifferent); - CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,b), LinphoneProxyConfigAddressDifferent); - CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,c), LinphoneProxyConfigAddressDifferent); - CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,d), LinphoneProxyConfigAddressDifferent); - CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,e), LinphoneProxyConfigAddressWeakEqual); - CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(NULL,NULL), LinphoneProxyConfigAddressEqual); - CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,f), LinphoneProxyConfigAddressWeakEqual); - CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(c,f), LinphoneProxyConfigAddressDifferent); - CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(e,f), LinphoneProxyConfigAddressWeakEqual); + BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,NULL), LinphoneProxyConfigAddressDifferent, int, "%d"); + BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,b), LinphoneProxyConfigAddressDifferent, int, "%d"); + BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,c), LinphoneProxyConfigAddressDifferent, int, "%d"); + BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,d), LinphoneProxyConfigAddressDifferent, int, "%d"); + BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,e), LinphoneProxyConfigAddressWeakEqual, int, "%d"); + BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(NULL,NULL), LinphoneProxyConfigAddressEqual, int, "%d"); + BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,f), LinphoneProxyConfigAddressWeakEqual, int, "%d"); + BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(c,f), LinphoneProxyConfigAddressDifferent, int, "%d"); + BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(e,f), LinphoneProxyConfigAddressWeakEqual, int, "%d"); linphone_address_destroy(a); linphone_address_destroy(b); @@ -200,36 +199,36 @@ void linphone_proxy_config_is_server_config_changed_test() { linphone_proxy_config_set_identity(proxy_config,"sip:toto@titi"); linphone_proxy_config_edit(proxy_config); linphone_proxy_config_set_identity(proxy_config,"sips:toto@titi"); - CU_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent); + BC_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent, int, "%d"); linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org"); linphone_proxy_config_edit(proxy_config); linphone_proxy_config_set_server_addr(proxy_config,"sip:toto.com"); - CU_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent); + BC_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent, int, "%d"); linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org"); linphone_proxy_config_edit(proxy_config); linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org:4444"); - CU_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent); + BC_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent, int, "%d"); linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org"); linphone_proxy_config_edit(proxy_config); linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org;transport=tcp"); - CU_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent); + BC_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent, int, "%d"); linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org"); linphone_proxy_config_edit(proxy_config); linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org;param=blue"); - CU_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressWeakEqual); + BC_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressWeakEqual, int, "%d"); linphone_proxy_config_edit(proxy_config); linphone_proxy_config_set_contact_parameters(proxy_config,"blabla=blue"); - CU_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressEqual); + BC_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressEqual, int, "%d"); linphone_proxy_config_edit(proxy_config); linphone_proxy_config_enable_register(proxy_config,TRUE); - CU_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressEqual); + BC_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressEqual, int, "%d"); linphone_proxy_config_destroy(proxy_config); } @@ -239,7 +238,7 @@ static void chat_root_test(void) { LinphoneCore* lc; memset (&v_table,0,sizeof(v_table)); lc = linphone_core_new(&v_table,NULL,NULL,NULL); - CU_ASSERT_PTR_NOT_NULL_FATAL(lc); + BC_ASSERT_PTR_NOT_NULL_FATAL(lc); linphone_core_create_chat_room(lc,"sip:toto@titi.com"); linphone_core_destroy(lc); } @@ -252,14 +251,14 @@ static void devices_reload_test(void) { devid1 = ms_strdup(linphone_core_get_capture_device(mgr->lc)); linphone_core_reload_sound_devices(mgr->lc); devid2 = ms_strdup(linphone_core_get_capture_device(mgr->lc)); - CU_ASSERT_STRING_EQUAL(devid1, devid2); + BC_ASSERT_STRING_EQUAL(devid1, devid2); ms_free(devid1); ms_free(devid2); devid1 = ms_strdup(linphone_core_get_video_device(mgr->lc)); linphone_core_reload_video_devices(mgr->lc); devid2 = ms_strdup(linphone_core_get_video_device(mgr->lc)); - CU_ASSERT_STRING_EQUAL(devid1, devid2); + BC_ASSERT_STRING_EQUAL(devid1, devid2); ms_free(devid1); ms_free(devid2); diff --git a/tester/stun_tester.c b/tester/stun_tester.c index 58a069f3d..03aa1ac13 100644 --- a/tester/stun_tester.c +++ b/tester/stun_tester.c @@ -16,8 +16,7 @@ along with this program. If not, see . */ -#include -#include "CUnit/Basic.h" + #include "linphonecore.h" #include "private.h" #include "liblinphone_tester.h" @@ -57,10 +56,10 @@ static void linphone_stun_test_encode() size_t bigLen = STUN_MAX_MESSAGE_SIZE; size_t len = test_stun_encode(smallBuff, smallLen, TRUE); - CU_ASSERT(len == -1); + BC_ASSERT(len == -1); len = test_stun_encode(bigBuff, bigLen, TRUE); - CU_ASSERT(len > 0); + BC_ASSERT(len > 0); ms_message("STUN message encoded in %i bytes", (int)len); } @@ -77,20 +76,20 @@ static void linphone_stun_test_grab_ip() dummy_call.media_ports[1].rtp_port = 9078; linphone_core_set_stun_server(lc_stun->lc, stun_address); - CU_ASSERT_STRING_EQUAL(stun_address, linphone_core_get_stun_server(lc_stun->lc)); + BC_ASSERT_STRING_EQUAL(stun_address, linphone_core_get_stun_server(lc_stun->lc)); wait_for(lc_stun->lc,lc_stun->lc,&tmp,1); ping_time = linphone_core_run_stun_tests(lc_stun->lc, &dummy_call); - CU_ASSERT(ping_time != -1); + BC_ASSERT(ping_time != -1); ms_message("Round trip to STUN: %d ms", ping_time); - CU_ASSERT( dummy_call.ac.addr[0] != '\0'); - CU_ASSERT( dummy_call.ac.port != 0); + BC_ASSERT( dummy_call.ac.addr[0] != '\0'); + BC_ASSERT( dummy_call.ac.port != 0); #ifdef VIDEO_ENABLED - CU_ASSERT( dummy_call.vc.addr[0] != '\0'); - CU_ASSERT( dummy_call.vc.port != 0); + BC_ASSERT( dummy_call.vc.addr[0] != '\0'); + BC_ASSERT( dummy_call.vc.port != 0); #endif ms_message("STUN test result: local audio port maps to %s:%i", diff --git a/tester/tester.c b/tester/tester.c index fe3054c0b..5c2f16f8f 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -67,15 +67,15 @@ void liblinphone_tester_enable_ipv6(bool_t enabled){ LinphoneAddress * create_linphone_address(const char * domain) { LinphoneAddress *addr = linphone_address_new(NULL); - CU_ASSERT_PTR_NOT_NULL_FATAL(addr); + BC_ASSERT_PTR_NOT_NULL_FATAL(addr); linphone_address_set_username(addr,test_username); - CU_ASSERT_STRING_EQUAL(test_username,linphone_address_get_username(addr)); + BC_ASSERT_STRING_EQUAL(test_username,linphone_address_get_username(addr)); if (!domain) domain= test_route; linphone_address_set_domain(addr,domain); - CU_ASSERT_STRING_EQUAL(domain,linphone_address_get_domain(addr)); + BC_ASSERT_STRING_EQUAL(domain,linphone_address_get_domain(addr)); linphone_address_set_display_name(addr, NULL); linphone_address_set_display_name(addr, "Mr Tester"); - CU_ASSERT_STRING_EQUAL("Mr Tester",linphone_address_get_display_name(addr)); + BC_ASSERT_STRING_EQUAL("Mr Tester",linphone_address_get_display_name(addr)); return addr; } @@ -107,7 +107,7 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c if (file){ filepath = ms_strdup_printf("%s/%s", path, file); - CU_ASSERT_TRUE_FATAL(ortp_file_exist(filepath)==0); + BC_ASSERT_TRUE_FATAL(ortp_file_exist(filepath)==0); config = lp_config_new_with_factory(NULL,filepath); } @@ -297,7 +297,7 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, const char* rc_file, LinphoneProxyConfig* proxy; int proxy_count; - /*CU_ASSERT_EQUAL(ms_list_size(linphone_core_get_proxy_config_list(lc)),proxy_count);*/ + /*BC_ASSERT_EQUAL(ms_list_size(linphone_core_get_proxy_config_list(lc)),proxy_count, int, "%d");*/ if (check_for_proxies && rc_file) /**/ proxy_count=ms_list_size(linphone_core_get_proxy_config_list(mgr->lc)); else @@ -311,7 +311,7 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, const char* rc_file, ms_error("Did not register after %d seconds for %d proxies", REGISTER_TIMEOUT, proxy_count); } } - CU_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationOk,proxy_count); + BC_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationOk,proxy_count, int, "%d"); enable_codec(mgr->lc,"PCMU",8000); linphone_core_get_default_proxy(mgr->lc,&proxy); diff --git a/tester/transport_tester.c b/tester/transport_tester.c index 7cd8c5ac2..4bfae42a2 100644 --- a/tester/transport_tester.c +++ b/tester/transport_tester.c @@ -52,7 +52,7 @@ static char* get_public_contact_ip(LinphoneCore* lc) { long contact_host_ip_len; char contact_host_ip[255]; char * contact = linphone_proxy_config_get_contact(linphone_core_get_default_proxy_config(lc)); - CU_ASSERT_PTR_NOT_NULL(contact); + BC_ASSERT_PTR_NOT_NULL(contact); contact_host_ip_len = strchr(contact, ':')-contact; strncpy(contact_host_ip, contact, contact_host_ip_len); contact_host_ip[contact_host_ip_len]='\0'; @@ -72,30 +72,30 @@ static void call_with_transport_base(LinphoneTunnelMode tunnel_mode, bool_t with const char * tunnel_ip = get_ip_from_hostname("tunnel.linphone.org"); char *public_ip, *public_ip2=NULL; - CU_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_LinphoneRegistrationOk,1)); + BC_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_LinphoneRegistrationOk,1)); public_ip = get_public_contact_ip(pauline->lc); - CU_ASSERT_STRING_NOT_EQUAL(public_ip, tunnel_ip); + BC_ASSERT_STRING_NOT_EQUAL(public_ip, tunnel_ip); linphone_core_set_media_encryption(pauline->lc, encryption); - + if (with_video_and_ice){ /*we want to test that tunnel is able to work with long SIP message, above mtu. * Enable ICE and many codec to make the SIP message bigger*/ linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce); linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce); - linphone_core_enable_payload_type(pauline->lc, + linphone_core_enable_payload_type(pauline->lc, linphone_core_find_payload_type(pauline->lc, "speex", 32000, 1), TRUE); - linphone_core_enable_payload_type(pauline->lc, + linphone_core_enable_payload_type(pauline->lc, linphone_core_find_payload_type(pauline->lc, "speex", 16000, 1), TRUE); - linphone_core_enable_payload_type(pauline->lc, + linphone_core_enable_payload_type(pauline->lc, linphone_core_find_payload_type(pauline->lc, "G722", 8000, 1), TRUE); - linphone_core_enable_payload_type(marie->lc, + linphone_core_enable_payload_type(marie->lc, linphone_core_find_payload_type(marie->lc, "speex", 32000, 1), TRUE); - linphone_core_enable_payload_type(marie->lc, + linphone_core_enable_payload_type(marie->lc, linphone_core_find_payload_type(marie->lc, "speex", 16000, 1), TRUE); - linphone_core_enable_payload_type(marie->lc, + linphone_core_enable_payload_type(marie->lc, linphone_core_find_payload_type(marie->lc, "G722", 8000, 1), TRUE); - + } if (tunnel_mode != LinphoneTunnelModeDisable){ @@ -111,14 +111,14 @@ static void call_with_transport_base(LinphoneTunnelMode tunnel_mode, bool_t with /* * Enabling the tunnel with sip cause another REGISTER to be made. - * In automatic mode, the udp test should conclude (assuming we have a normal network), that no + * In automatic mode, the udp test should conclude (assuming we have a normal network), that no * tunnel is needed. Thus the number of registrations should stay to 1. - * The library is missing a notification of "tunnel connectivity test finished" to enable the + * The library is missing a notification of "tunnel connectivity test finished" to enable the * full testing of the automatic mode. */ if (tunnel_mode == LinphoneTunnelModeEnable && with_sip) { - CU_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_LinphoneRegistrationOk,2)); + BC_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_LinphoneRegistrationOk,2)); /* Ensure that we did use the tunnel. If so, we should see contact changed from: Contact: ;.[...] To: @@ -126,32 +126,32 @@ static void call_with_transport_base(LinphoneTunnelMode tunnel_mode, bool_t with */ ms_free(public_ip); public_ip = get_public_contact_ip(pauline->lc); - CU_ASSERT_STRING_EQUAL(public_ip, tunnel_ip); + BC_ASSERT_STRING_EQUAL(public_ip, tunnel_ip); } else { public_ip2 = get_public_contact_ip(pauline->lc); - CU_ASSERT_STRING_EQUAL(public_ip, public_ip2); + BC_ASSERT_STRING_EQUAL(public_ip, public_ip2); } } - CU_ASSERT_TRUE(call(pauline,marie)); + BC_ASSERT_TRUE(call(pauline,marie)); pauline_call=linphone_core_get_current_call(pauline->lc); - CU_ASSERT_PTR_NOT_NULL(pauline_call); + BC_ASSERT_PTR_NOT_NULL(pauline_call); if (pauline_call!=NULL){ - CU_ASSERT_EQUAL(linphone_call_params_get_media_encryption(linphone_call_get_current_params(pauline_call)), + BC_ASSERT_PTR_EQUAL(linphone_call_params_get_media_encryption(linphone_call_get_current_params(pauline_call)), encryption); } if (tunnel_mode == LinphoneTunnelModeEnable && with_sip){ /* make sure the call from pauline arrived from the tunnel by checking the contact address*/ marie_call = linphone_core_get_current_call(marie->lc); - CU_ASSERT_PTR_NOT_NULL(marie_call); + BC_ASSERT_PTR_NOT_NULL(marie_call); if (marie_call){ const char *remote_contact = linphone_call_get_remote_contact(marie_call); - CU_ASSERT_PTR_NOT_NULL(remote_contact); + BC_ASSERT_PTR_NOT_NULL(remote_contact); if (remote_contact){ LinphoneAddress *tmp = linphone_address_new(remote_contact); - CU_ASSERT_PTR_NOT_NULL(tmp); + BC_ASSERT_PTR_NOT_NULL(tmp); if (tmp){ - CU_ASSERT_STRING_EQUAL(linphone_address_get_domain(tmp), tunnel_ip); + BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(tmp), tunnel_ip); linphone_address_destroy(tmp); } } @@ -159,7 +159,7 @@ static void call_with_transport_base(LinphoneTunnelMode tunnel_mode, bool_t with } #ifdef VIDEO_ENABLED if (with_video_and_ice){ - CU_ASSERT_TRUE(add_video(pauline, marie, TRUE)); + BC_ASSERT_TRUE(add_video(pauline, marie, TRUE)); } #endif end_call(pauline,marie); diff --git a/tester/upnp_tester.c b/tester/upnp_tester.c index 656c9c3eb..3f39b0c9c 100644 --- a/tester/upnp_tester.c +++ b/tester/upnp_tester.c @@ -16,8 +16,7 @@ along with this program. If not, see . */ -#include -#include "CUnit/Basic.h" + #include "linphonecore.h" #include "lpconfig.h" #include "private.h" @@ -28,7 +27,7 @@ static void upnp_start_n_stop(void) { LinphoneCoreManager* lc_upnp = linphone_core_manager_new2( "upnp_rc", FALSE); wait_for(lc_upnp->lc,lc_upnp->lc,&tmp,1); #ifdef BUILD_UPNP - CU_ASSERT_TRUE(lc_upnp->lc->upnp != NULL); + BC_ASSERT_TRUE(lc_upnp->lc->upnp != NULL); #endif linphone_core_manager_destroy(lc_upnp); } @@ -37,7 +36,7 @@ static void upnp_check_state(void) { int tmp = 0; LinphoneCoreManager* lc_upnp = linphone_core_manager_new2( "upnp_rc", FALSE); wait_for(lc_upnp->lc,lc_upnp->lc,&tmp,1); - CU_ASSERT_TRUE(linphone_core_get_upnp_state(lc_upnp->lc) == LinphoneUpnpStateOk); + BC_ASSERT_TRUE(linphone_core_get_upnp_state(lc_upnp->lc) == LinphoneUpnpStateOk); linphone_core_manager_destroy(lc_upnp); } @@ -47,7 +46,7 @@ static void upnp_check_ipaddress(void) { LinphoneCoreManager* lc_upnp = linphone_core_manager_new2( "upnp_rc", FALSE); wait_for(lc_upnp->lc,lc_upnp->lc,&tmp,1); addr = linphone_core_get_upnp_external_ipaddress(lc_upnp->lc); - CU_ASSERT_TRUE(addr != NULL && strlen(addr)>=7); + BC_ASSERT_TRUE(addr != NULL && strlen(addr)>=7); linphone_core_manager_destroy(lc_upnp); } diff --git a/tester/video_tester.c b/tester/video_tester.c index e61450f02..163d2f3f0 100644 --- a/tester/video_tester.c +++ b/tester/video_tester.c @@ -19,8 +19,7 @@ #if defined(VIDEO_ENABLED) && defined(HAVE_GTK) -#include -#include "CUnit/Basic.h" + #include "linphonecore.h" #include "liblinphone_tester.h" #include "lpconfig.h" @@ -168,11 +167,11 @@ static bool_t video_call_with_params(LinphoneCoreManager* caller_mgr, LinphoneCo bool_t result = TRUE; bool_t did_received_call; - CU_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(caller_mgr->lc, callee_mgr->identity, caller_params)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(caller_mgr->lc, callee_mgr->identity, caller_params)); did_received_call = wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallIncomingReceived, initial_callee.number_of_LinphoneCallIncomingReceived + 1); if (!did_received_call) return 0; - CU_ASSERT_EQUAL(caller_mgr->stat.number_of_LinphoneCallOutgoingProgress, initial_caller.number_of_LinphoneCallOutgoingProgress + 1); + BC_ASSERT_EQUAL(caller_mgr->stat.number_of_LinphoneCallOutgoingProgress, initial_caller.number_of_LinphoneCallOutgoingProgress + 1, int, "%d"); while (caller_mgr->stat.number_of_LinphoneCallOutgoingRinging != (initial_caller.number_of_LinphoneCallOutgoingRinging + 1) && caller_mgr->stat.number_of_LinphoneCallOutgoingEarlyMedia != (initial_caller.number_of_LinphoneCallOutgoingEarlyMedia + 1) @@ -182,10 +181,10 @@ static bool_t video_call_with_params(LinphoneCoreManager* caller_mgr, LinphoneCo ms_usleep(100000); } - CU_ASSERT_TRUE((caller_mgr->stat.number_of_LinphoneCallOutgoingRinging == initial_caller.number_of_LinphoneCallOutgoingRinging + 1) + BC_ASSERT_TRUE((caller_mgr->stat.number_of_LinphoneCallOutgoingRinging == initial_caller.number_of_LinphoneCallOutgoingRinging + 1) || (caller_mgr->stat.number_of_LinphoneCallOutgoingEarlyMedia == initial_caller.number_of_LinphoneCallOutgoingEarlyMedia + 1)); - CU_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call_remote_address(callee_mgr->lc)); + BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call_remote_address(callee_mgr->lc)); if(!linphone_core_get_current_call(caller_mgr->lc) || !linphone_core_get_current_call(callee_mgr->lc) || !linphone_core_get_current_call_remote_address(callee_mgr->lc)) { return 0; } @@ -193,8 +192,8 @@ static bool_t video_call_with_params(LinphoneCoreManager* caller_mgr, LinphoneCo if (automatically_accept == TRUE) { linphone_core_accept_call_with_params(callee_mgr->lc, linphone_core_get_current_call(callee_mgr->lc), callee_params); - CU_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallConnected, initial_callee.number_of_LinphoneCallConnected + 1)); - CU_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallConnected, initial_callee.number_of_LinphoneCallConnected + 1)); + BC_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallConnected, initial_callee.number_of_LinphoneCallConnected + 1)); + BC_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallConnected, initial_callee.number_of_LinphoneCallConnected + 1)); result = wait_for(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallStreamsRunning, initial_caller.number_of_LinphoneCallStreamsRunning + 1) && wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallStreamsRunning, initial_callee.number_of_LinphoneCallStreamsRunning + 1); } @@ -255,28 +254,28 @@ static void early_media_video_during_video_call_test(void) { laure_params = configure_for_early_media_video_sending(laure); /* Normal automatically accepted video call from marie to pauline. */ - CU_ASSERT_TRUE(video_call_with_params(marie, pauline, marie_params, pauline_params, TRUE)); + BC_ASSERT_TRUE(video_call_with_params(marie, pauline, marie_params, pauline_params, TRUE)); /* Wait for 2s. */ wait_for_three_cores(marie->lc, pauline->lc, NULL, 2000); /* Early media video call from laure to marie. */ - CU_ASSERT_TRUE(video_call_with_params(laure, marie, laure_params, NULL, FALSE)); + BC_ASSERT_TRUE(video_call_with_params(laure, marie, laure_params, NULL, FALSE)); /* Wait for 2s. */ wait_for_three_cores(marie->lc, pauline->lc, laure->lc, 2000); linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallReleased, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &laure->stat.number_of_LinphoneCallEnd, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallReleased, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &laure->stat.number_of_LinphoneCallEnd, 1)); - CU_ASSERT_EQUAL(marie->stat.number_of_video_windows_created, 2); - CU_ASSERT_EQUAL(pauline->stat.number_of_video_windows_created, 1); - CU_ASSERT_EQUAL(laure->stat.number_of_video_windows_created, 1); + BC_ASSERT_EQUAL(marie->stat.number_of_video_windows_created, 2, int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_video_windows_created, 1, int, "%d"); + BC_ASSERT_EQUAL(laure->stat.number_of_video_windows_created, 1, int, "%d"); linphone_call_params_unref(marie_params); linphone_call_params_unref(pauline_params); @@ -311,22 +310,22 @@ static void two_incoming_early_media_video_calls_test(void) { ms_free(ringback_path); /* Early media video call from pauline to marie. */ - CU_ASSERT_TRUE(video_call_with_params(pauline, marie, pauline_params, NULL, FALSE)); + BC_ASSERT_TRUE(video_call_with_params(pauline, marie, pauline_params, NULL, FALSE)); /* Wait for 2s. */ wait_for_three_cores(marie->lc, pauline->lc, NULL, 2000); /* Early media video call from laure to marie. */ - CU_ASSERT_TRUE(video_call_with_params(laure, marie, laure_params, NULL, FALSE)); + BC_ASSERT_TRUE(video_call_with_params(laure, marie, laure_params, NULL, FALSE)); /* Wait for 2s. */ wait_for_three_cores(marie->lc, pauline->lc, laure->lc, 2000); - CU_ASSERT_EQUAL(linphone_core_get_calls_nb(marie->lc), 2); + BC_ASSERT_EQUAL(linphone_core_get_calls_nb(marie->lc), 2, int, "%d"); if (linphone_core_get_calls_nb(marie->lc) == 2) { calls_list = linphone_core_get_calls(marie->lc); call = (LinphoneCall *)ms_list_nth_data(calls_list, 0); - CU_ASSERT_PTR_NOT_NULL(call); + BC_ASSERT_PTR_NOT_NULL(call); if (call != NULL) { LinphoneCallParams *params = linphone_call_params_copy(linphone_call_get_current_params(call)); linphone_call_params_set_audio_direction(params, LinphoneMediaDirectionSendRecv); @@ -339,16 +338,16 @@ static void two_incoming_early_media_video_calls_test(void) { } linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallReleased, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &laure->stat.number_of_LinphoneCallEnd, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallReleased, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &laure->stat.number_of_LinphoneCallEnd, 1)); - CU_ASSERT_EQUAL(marie->stat.number_of_video_windows_created, 2); - CU_ASSERT_EQUAL(pauline->stat.number_of_video_windows_created, 1); - CU_ASSERT_EQUAL(laure->stat.number_of_video_windows_created, 1); + BC_ASSERT_EQUAL(marie->stat.number_of_video_windows_created, 2, int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_video_windows_created, 1, int, "%d"); + BC_ASSERT_EQUAL(laure->stat.number_of_video_windows_created, 1, int, "%d"); linphone_call_params_unref(marie_params); linphone_call_params_unref(pauline_params); @@ -370,23 +369,23 @@ static void early_media_video_with_inactive_audio(void) { pauline_params = configure_for_early_media_video_sending(pauline); /* Early media video call from pauline to marie. */ - CU_ASSERT_TRUE(video_call_with_params(pauline, marie, pauline_params, NULL, FALSE)); + BC_ASSERT_TRUE(video_call_with_params(pauline, marie, pauline_params, NULL, FALSE)); /* Wait for 2s. */ wait_for_three_cores(marie->lc, pauline->lc, NULL, 2000); /* Check that we are in LinphoneCallOutgoingEarlyMedia state and that the ringstream is present meaning we are playing the ringback tone. */ - CU_ASSERT_EQUAL(linphone_call_get_state(linphone_core_get_current_call(pauline->lc)), LinphoneCallOutgoingEarlyMedia); - CU_ASSERT_PTR_NOT_NULL(pauline->lc->ringstream); + BC_ASSERT_EQUAL(linphone_call_get_state(linphone_core_get_current_call(pauline->lc)), LinphoneCallOutgoingEarlyMedia, int, "%d"); + BC_ASSERT_PTR_NOT_NULL(pauline->lc->ringstream); linphone_core_terminate_all_calls(marie->lc); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1)); - CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallReleased, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallReleased, 1)); - CU_ASSERT_EQUAL(marie->stat.number_of_video_windows_created, 1); - CU_ASSERT_EQUAL(pauline->stat.number_of_video_windows_created, 1); + BC_ASSERT_EQUAL(marie->stat.number_of_video_windows_created, 1, int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_video_windows_created, 1, int, "%d"); linphone_call_params_unref(marie_params); linphone_call_params_unref(pauline_params); @@ -432,52 +431,52 @@ static void forked_outgoing_early_media_video_call_with_inactive_audio_test(void linphone_core_invite_address_with_params(pauline->lc, marie1->identity, pauline_params); linphone_call_params_destroy(pauline_params); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallIncomingEarlyMedia, 1, 3000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallIncomingEarlyMedia, 1, 3000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia, 1, 3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallIncomingEarlyMedia, 1, 3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallIncomingEarlyMedia, 1, 3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia, 1, 3000)); pauline_call = linphone_core_get_current_call(pauline->lc); marie1_call = linphone_core_get_current_call(marie1->lc); marie2_call = linphone_core_get_current_call(marie2->lc); - CU_ASSERT_PTR_NOT_NULL(pauline_call); - CU_ASSERT_PTR_NOT_NULL(marie1_call); - CU_ASSERT_PTR_NOT_NULL(marie2_call); + BC_ASSERT_PTR_NOT_NULL(pauline_call); + BC_ASSERT_PTR_NOT_NULL(marie1_call); + BC_ASSERT_PTR_NOT_NULL(marie2_call); if (pauline_call && marie1_call && marie2_call) { /* wait a bit that streams are established */ wait_for_list(lcs, &dummy, 1, 6000); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth == 0); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth == 0); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie2_call)->download_bandwidth == 0); - CU_ASSERT_TRUE(linphone_call_get_video_stats(pauline_call)->download_bandwidth == 0); - CU_ASSERT_TRUE(linphone_call_get_video_stats(marie1_call)->download_bandwidth > 0); - CU_ASSERT_TRUE(linphone_call_get_video_stats(marie2_call)->download_bandwidth > 0); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth == 0); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth == 0); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie2_call)->download_bandwidth == 0); + BC_ASSERT_TRUE(linphone_call_get_video_stats(pauline_call)->download_bandwidth == 0); + BC_ASSERT_TRUE(linphone_call_get_video_stats(marie1_call)->download_bandwidth > 0); + BC_ASSERT_TRUE(linphone_call_get_video_stats(marie2_call)->download_bandwidth > 0); linphone_call_params_set_audio_direction(marie1_params, LinphoneMediaDirectionSendRecv); linphone_core_accept_call_with_params(marie1->lc, linphone_core_get_current_call(marie1->lc), marie1_params); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallStreamsRunning, 1, 3000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1, 3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallStreamsRunning, 1, 3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1, 3000)); /* marie2 should get her call terminated */ - CU_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallEnd, 1, 1000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallEnd, 1, 1000)); /*wait a bit that streams are established*/ wait_for_list(lcs, &dummy, 1, 3000); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth > 71); - CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth > 71); - CU_ASSERT_TRUE(linphone_call_get_video_stats(pauline_call)->download_bandwidth > 0); - CU_ASSERT_TRUE(linphone_call_get_video_stats(marie1_call)->download_bandwidth > 0); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth > 71); + BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth > 71); + BC_ASSERT_TRUE(linphone_call_get_video_stats(pauline_call)->download_bandwidth > 0); + BC_ASSERT_TRUE(linphone_call_get_video_stats(marie1_call)->download_bandwidth > 0); /* send an INFO in reverse side to check that dialogs are properly established */ info = linphone_core_create_info_message(marie1->lc); linphone_call_send_info_message(marie1_call, info); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_inforeceived, 1, 3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_inforeceived, 1, 3000)); } linphone_core_terminate_all_calls(pauline->lc); - CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallEnd, 1, 3000)); - CU_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallEnd, 1, 3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallEnd, 1, 3000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallEnd, 1, 3000)); linphone_call_params_destroy(marie1_params); linphone_call_params_destroy(marie2_params);