diff --git a/tester/call_tester.c b/tester/call_tester.c index 5c89e59e7..4866dda26 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -181,13 +181,13 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana } wait_for_until(caller->lc,callee->lc,NULL,0,20); /*just to sleep while iterating*/ }while (!liblinphone_tester_clock_elapsed(&ts,15000)); - 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); + BC_ASSERT_GREATER(linphone_call_get_audio_stats(c1)->round_trip_delay,0.0,float,"%f"); + BC_ASSERT_GREATER(linphone_call_get_audio_stats(c2)->round_trip_delay,0.0,float,"%f"); if (linphone_call_log_video_enabled(linphone_call_get_call_log(c1))) { - BC_ASSERT_TRUE(linphone_call_get_video_stats(c1)->round_trip_delay>0.0); + BC_ASSERT_GREATER(linphone_call_get_video_stats(c1)->round_trip_delay,0.0,float,"%f"); } if (linphone_call_log_video_enabled(linphone_call_get_call_log(c2))) { - BC_ASSERT_TRUE(linphone_call_get_video_stats(c2)->round_trip_delay>0.0); + BC_ASSERT_GREATER(linphone_call_get_video_stats(c2)->round_trip_delay,0.0,float,"%f"); } linphone_call_unref(c1); linphone_call_unref(c2); @@ -287,7 +287,7 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr 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); @@ -654,7 +654,7 @@ static void call_with_specified_codec_bitrate(void) { #endif /*Force marie to play from file: if soundcard is used and it is silient, then vbr mode will drop down the bitrate Note that a play file is already set by linphone_core_manager_new() (but not used)*/ - linphone_core_set_use_files(marie->lc, TRUE); + linphone_core_set_use_files(marie->lc, TRUE); if (linphone_core_find_payload_type(marie->lc,codec,rate,-1)==NULL){ BC_PASS("opus codec not supported, test skipped."); @@ -743,7 +743,7 @@ static void simple_call_compatibility_mode(void) { 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)); - + wait_for(lc_pauline,lc_marie,&stat_marie->number_of_LinphoneCallStreamsRunning,3); linphone_core_terminate_all_calls(lc_pauline); BC_ASSERT_TRUE(wait_for(lc_pauline,lc_marie,&stat_pauline->number_of_LinphoneCallEnd,1)); @@ -938,7 +938,7 @@ static void call_terminated_by_caller(void) { LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); BC_ASSERT_TRUE(call(pauline,marie)); - + linphone_core_terminate_all_calls(pauline->lc); 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)); @@ -954,7 +954,7 @@ static void call_with_no_sdp(void) { linphone_core_enable_sdp_200_ack(marie->lc,TRUE); BC_ASSERT_TRUE(call(marie,pauline)); - + linphone_core_terminate_all_calls(pauline->lc); 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)); @@ -1246,8 +1246,8 @@ static void call_paused_resumed(void) { 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); \ - BC_ASSERT_TRUE(.75 * params.loss_rate < loss_percentage); \ - BC_ASSERT_TRUE(loss_percentage < 1.25 * params.loss_rate) + BC_ASSERT_LOWER(.75 * params.loss_rate , loss_percentage, float, "%f"); \ + BC_ASSERT_LOWER(loss_percentage , 1.25 * params.loss_rate, float, "%f") static void call_paused_resumed_with_loss(void) { LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); @@ -1343,7 +1343,7 @@ void concurrent_paused_resumed_base() { stats = rtp_session_get_stats(call_pauline->sessions->rtp_session); BC_ASSERT_EQUAL(stats->cum_packet_loss, 0, int, "%d"); - + linphone_core_terminate_all_calls(pauline->lc); 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)); @@ -1991,8 +1991,8 @@ static void video_call_with_early_media_no_matching_audio_codecs(void) { /*audio stream shall not have been requested to start*/ BC_ASSERT_PTR_NULL(pauline_call->audiostream->soundread); - 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); + BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(out_call))); + BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(pauline_call))); linphone_core_accept_call(pauline->lc, pauline_call); @@ -2017,7 +2017,7 @@ static void video_call_limited_bandwidth(void) { linphone_core_set_download_bandwidth(pauline->lc, 100); video_call_base(marie,pauline,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE); - + linphone_core_terminate_all_calls(pauline->lc); 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)); @@ -2051,7 +2051,7 @@ static void _call_with_media_relay(bool_t random_ports) { BC_ASSERT_TRUE(add_video(pauline,marie, TRUE)); liblinphone_tester_check_rtcp(pauline,marie); #endif - + linphone_core_terminate_all_calls(pauline->lc); 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)); @@ -2095,7 +2095,7 @@ static void call_with_privacy(void) { BC_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId, int, "%d"); } - + linphone_core_terminate_all_calls(pauline->lc); 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)); @@ -2118,7 +2118,7 @@ static void call_with_privacy(void) { BC_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId, int, "%d"); } - + linphone_core_terminate_all_calls(pauline->lc); 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)); @@ -2160,7 +2160,7 @@ static void call_with_privacy2(void) { BC_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId, int, "%d"); } - + linphone_core_terminate_all_calls(pauline->lc); 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)); @@ -2285,9 +2285,9 @@ 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)); - BC_ASSERT_TRUE(linphone_call_params_get_media_encryption(params) == LinphoneMediaEncryptionSRTP); + BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(params) , LinphoneMediaEncryptionSRTP, int, "%d"); params = linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)); - BC_ASSERT_TRUE(linphone_call_params_get_media_encryption(params) == LinphoneMediaEncryptionSRTP); + BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(params) , LinphoneMediaEncryptionSRTP, int, "%d"); linphone_core_terminate_all_calls(marie->lc); BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); @@ -2334,8 +2334,8 @@ static void call_with_file_player(void) { player=linphone_call_get_player(linphone_core_get_current_call(marie->lc)); BC_ASSERT_PTR_NOT_NULL(player); if (player){ - BC_ASSERT_TRUE(linphone_player_open(player,hellopath,on_eof,marie)==0); - BC_ASSERT_TRUE(linphone_player_start(player)==0); + BC_ASSERT_EQUAL(linphone_player_open(player,hellopath,on_eof,marie),0, int, "%d"); + BC_ASSERT_EQUAL(linphone_player_start(player),0, int, "%d"); } /* This assert should be modified to be at least as long as the WAV file */ BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&marie->stat.number_of_player_eof,1,10000)); @@ -2418,7 +2418,7 @@ static void call_with_mkv_file_player(void) { goto end; } BC_ASSERT_EQUAL(res, 0, int, "%d"); - BC_ASSERT_TRUE(linphone_player_start(player)==0); + BC_ASSERT_EQUAL(linphone_player_start(player),0,int,"%d"); BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&marie->stat.number_of_player_eof,1,12000)); linphone_player_close(player); /*wait for one second more so that last RTP packets can arrive*/ @@ -2426,9 +2426,9 @@ static void call_with_mkv_file_player(void) { } end_call(marie, pauline); #ifdef DO_AUDIO_CMP - BC_ASSERT_TRUE(ms_audio_diff(hellowav,recordpath,&similar,audio_cmp_max_shift,NULL,NULL)==0); - BC_ASSERT_TRUE(similar>threshold); - BC_ASSERT_TRUE(similar<=1.0); + BC_ASSERT_EQUAL(ms_audio_diff(hellowav,recordpath,&similar,audio_cmp_max_shift,NULL,NULL),0,int,"%d"); + BC_ASSERT_GREATER(similar,threshold,double,"%f"); + BC_ASSERT_LOWER(similar,1.0,double,"%f"); if(similar>threshold && similar<=1.0) { remove(recordpath); } @@ -2529,7 +2529,7 @@ void call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enable_video #endif - + linphone_core_terminate_all_calls(marie->lc); 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)); @@ -2583,7 +2583,7 @@ static void early_media_call(void) { /*added because a bug related to early-media caused the Connected state to be reached two times*/ BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallConnected,1, int, "%d"); - + linphone_core_terminate_all_calls(marie->lc); 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)); @@ -2762,7 +2762,7 @@ static void call_established_with_rejected_info(void) { check_call_state(pauline,LinphoneCallStreamsRunning); check_call_state(marie,LinphoneCallStreamsRunning); - + linphone_core_terminate_all_calls(pauline->lc); 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)); @@ -2843,7 +2843,7 @@ static void call_established_with_complex_rejected_operation(void) { BC_ASSERT_EQUAL(linphone_call_get_reason(linphone_core_get_current_call(pauline->lc)),LinphoneReasonTemporarilyUnavailable, int, "%d"); - + linphone_core_terminate_all_calls(pauline->lc); 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)); @@ -2895,7 +2895,7 @@ static void call_established_with_rejected_info_during_reinvite(void) { BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); - + linphone_core_terminate_all_calls(pauline->lc); 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)); @@ -2930,7 +2930,7 @@ static void call_established_with_rejected_reinvite(void) { check_call_state(pauline,LinphoneCallStreamsRunning); check_call_state(marie,LinphoneCallStreamsRunning); - + linphone_core_terminate_all_calls(pauline->lc); 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)); @@ -2969,7 +2969,7 @@ static void call_established_with_rejected_incoming_reinvite(void) { check_call_state(pauline,LinphoneCallStreamsRunning); check_call_state(marie,LinphoneCallStreamsRunning); - + linphone_core_terminate_all_calls(pauline->lc); 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)); @@ -3071,7 +3071,7 @@ static void call_established_with_rejected_reinvite_with_error_base(bool_t trans if (!trans_pending) sal_enable_unconditional_answer(marie->lc->sal,FALSE); - + linphone_core_terminate_all_calls(pauline->lc); 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)); @@ -3628,7 +3628,7 @@ static void call_with_custom_supported_tags(void) { recv_supported=linphone_call_params_get_custom_header(remote_params,"supported"); BC_ASSERT_PTR_NOT_NULL(recv_supported); if (recv_supported){ - BC_ASSERT_TRUE(strstr(recv_supported,"pouet-tag")!=NULL); + BC_ASSERT_PTR_NOT_NULL(strstr(recv_supported,"pouet-tag")); } end_call(marie,pauline); end: @@ -3675,7 +3675,7 @@ static void call_log_from_taken_from_p_asserted_id(void) { BC_ASSERT_TRUE(linphone_address_weak_equal(linphone_call_get_remote_address(c2),paulie_asserted_id_addr)); - + linphone_core_terminate_all_calls(pauline->lc); 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)); @@ -3991,7 +3991,7 @@ static void call_with_generic_cn(void) { err=stat(recorded_file,&stbuf); BC_ASSERT_EQUAL(err, 0, int, "%d"); if (err==0){ - BC_ASSERT_TRUE(stbuf.st_size>120000); + BC_ASSERT_GREATER(stbuf.st_size,120000,int, "%d"); } } @@ -4146,9 +4146,9 @@ static void video_call_with_re_invite_inactive_followed_by_re_invite_base(Linpho /*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)); - BC_ASSERT_TRUE(linphone_call_params_get_media_encryption(current_params) == mode); + BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(current_params) , mode, int, "%d"); current_params = linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)); - BC_ASSERT_TRUE(linphone_call_params_get_media_encryption(current_params) == mode); + BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(current_params) , mode, int, "%d"); } end_call(marie,pauline); @@ -4297,7 +4297,7 @@ static void call_with_fqdn_in_sdp(void) { LinphoneCoreManager* pauline = linphone_core_manager_new(tls_supported ? "pauline_rc" : "pauline_tcp_rc"); LpConfig *lp; bool_t call_ok; - + lp = linphone_core_get_config(marie->lc); lp_config_set_string(lp,"rtp","bind_address","localhost"); lp = linphone_core_get_config(pauline->lc); @@ -4336,7 +4336,7 @@ static void call_with_rtp_io_mode(void) { unlink(recordpath); reset_counters(&marie->stat); reset_counters(&pauline->stat); - + /* The caller uses files instead of soundcard in order to avoid mixing soundcard input with file played using call's player. */ linphone_core_use_files(marie->lc, TRUE); linphone_core_set_play_file(marie->lc, NULL); @@ -4357,8 +4357,8 @@ static void call_with_rtp_io_mode(void) { player = linphone_call_get_player(linphone_core_get_current_call(marie->lc)); BC_ASSERT_PTR_NOT_NULL(player); if (player) { - BC_ASSERT_TRUE(linphone_player_open(player, hellopath, on_eof, marie) == 0); - BC_ASSERT_TRUE(linphone_player_start(player) == 0); + BC_ASSERT_EQUAL(linphone_player_open(player, hellopath, on_eof, marie) , 0, int, "%d"); + BC_ASSERT_EQUAL(linphone_player_start(player) , 0, int, "%d"); } /* This assert should be modified to be at least as long as the WAV file */ diff --git a/tester/eventapi_tester.c b/tester/eventapi_tester.c index e45cfea31..b196652db 100644 --- a/tester/eventapi_tester.c +++ b/tester/eventapi_tester.c @@ -39,7 +39,7 @@ const char *liblinphone_tester_get_notify_content(void){ void linphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *eventname, const LinphoneContent *content){ LinphoneCoreManager *mgr; BC_ASSERT_PTR_NOT_NULL_FATAL(content); - BC_ASSERT_TRUE(strcmp(notify_content,(const char*)linphone_content_get_buffer(content))==0); + BC_ASSERT_STRING_EQUAL(notify_content,(const char*)linphone_content_get_buffer(content)); mgr=get_manager(lc); mgr->stat.number_of_NotifyReceived++; } @@ -193,7 +193,7 @@ static void subscribe_test_with_args(bool_t terminated_by_subscriber, RefreshTes if (refresh_type==AutoRefresh){ wait_for_list(lcs,NULL,0,6000); - BC_ASSERT_TRUE(linphone_event_get_subscription_state(pauline->lev)==LinphoneSubscriptionActive); + BC_ASSERT_EQUAL(linphone_event_get_subscription_state(pauline->lev), LinphoneSubscriptionActive, int, "%d"); }else if (refresh_type==ManualRefresh){ BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionExpiring,1,4000)); linphone_event_update_subscribe(lev,NULL); @@ -255,7 +255,7 @@ static void subscribe_test_with_args2(bool_t terminated_by_subscriber, RefreshTe if (refresh_type==AutoRefresh){ wait_for_list(lcs,NULL,0,6000); - BC_ASSERT_TRUE(linphone_event_get_subscription_state(pauline->lev)==LinphoneSubscriptionActive); + BC_ASSERT_EQUAL(linphone_event_get_subscription_state(pauline->lev), LinphoneSubscriptionActive, int, "%d"); }else if (refresh_type==ManualRefresh){ BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionExpiring,1,4000)); linphone_event_update_subscribe(lev,NULL); diff --git a/tester/log_collection_tester.c b/tester/log_collection_tester.c index b2a7fa1d9..4beabef73 100644 --- a/tester/log_collection_tester.c +++ b/tester/log_collection_tester.c @@ -202,13 +202,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); - BC_ASSERT_TRUE(log_time >= time_prev); + BC_ASSERT_GREATER(log_time , time_prev, long int, "%ld"); time_prev = log_time; } } #endif } - BC_ASSERT_TRUE(line_count > 25); + BC_ASSERT_GREATER(line_count , 25, int, "%d"); free(line); fclose(file); ms_free(filepath); @@ -217,7 +217,7 @@ static time_t check_file(LinphoneCoreManager* mgr) { timediff = labs((long int)log_time - (long int)cur_time); (void)timediff; #ifndef _WIN32 - BC_ASSERT_TRUE( timediff <= 1 ); + BC_ASSERT_LOWER(timediff, 1, unsigned, "%u"); if( !(timediff <= 1) ){ char buffers[2][128] = {{0}}; strftime(buffers[0], sizeof(buffers[0]), "%Y-%m-%d %H:%M:%S", localtime(&log_time)); diff --git a/tester/message_tester.c b/tester/message_tester.c index ca623e0b3..6ffaab17d 100644 --- a/tester/message_tester.c +++ b/tester/message_tester.c @@ -1444,7 +1444,7 @@ static void info_message_with_args(bool_t with_content) { BC_ASSERT_PTR_NOT_NULL(hvalue); if (hvalue) - BC_ASSERT_TRUE(strcmp(hvalue,"still bad")==0); + BC_ASSERT_STRING_EQUAL(hvalue, "still bad"); if (with_content){ BC_ASSERT_PTR_NOT_NULL(content); @@ -1452,9 +1452,9 @@ static void info_message_with_args(bool_t with_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); + if (linphone_content_get_type(content)) BC_ASSERT_STRING_EQUAL(linphone_content_get_type(content),"application"); + if (linphone_content_get_subtype(content)) BC_ASSERT_STRING_EQUAL(linphone_content_get_subtype(content),"somexml"); + if (linphone_content_get_buffer(content))BC_ASSERT_STRING_EQUAL((const char*)linphone_content_get_buffer(content),info_content); BC_ASSERT_EQUAL(linphone_content_get_size(content),strlen(info_content), int, "%d"); } } diff --git a/tester/multi_call_tester.c b/tester/multi_call_tester.c index 22db4b446..45f7bfcbc 100644 --- a/tester/multi_call_tester.c +++ b/tester/multi_call_tester.c @@ -362,7 +362,7 @@ static void simple_call_transfer(void) { marie_calling_laure=linphone_core_get_current_call(marie->lc); BC_ASSERT_PTR_NOT_NULL_FATAL(marie_calling_laure); - BC_ASSERT_TRUE(linphone_call_get_transferer_call(marie_calling_laure)==marie_calling_pauline); + BC_ASSERT_PTR_EQUAL(linphone_call_get_transferer_call(marie_calling_laure),marie_calling_pauline); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallConnected,1,2000)); diff --git a/tester/offeranswer_tester.c b/tester/offeranswer_tester.c index 2b25f9252..923635108 100644 --- a/tester/offeranswer_tester.c +++ b/tester/offeranswer_tester.c @@ -43,13 +43,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) BC_ASSERT_TRUE(opus_codec_pos==0); - BC_ASSERT_TRUE(speex16_codec_poslc,pauline->lc,&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); - BC_ASSERT_TRUE(presence_timestamp >= current_timestamp); + BC_ASSERT_GREATER(presence_timestamp , current_timestamp, unsigned, "%u"); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); diff --git a/tester/register_tester.c b/tester/register_tester.c index c2f883bd9..ab159ea2a 100644 --- a/tester/register_tester.c +++ b/tester/register_tester.c @@ -206,7 +206,7 @@ static void register_with_custom_headers(void){ wait_for(marie->lc, NULL, &marie->stat.number_of_LinphoneRegistrationOk,initial_register_ok+1); value=linphone_proxy_config_get_custom_header(cfg, "Server"); BC_ASSERT_PTR_NOT_NULL(value); - if (value) BC_ASSERT_TRUE(strstr(value, "Flexisip")!=NULL); + if (value) BC_ASSERT_PTR_NOT_NULL(strstr(value, "Flexisip")); linphone_core_manager_destroy(marie); } @@ -424,7 +424,7 @@ static void authenticated_register_with_wrong_credentials_with_params_base(const const LinphoneErrorInfo *ei=linphone_proxy_config_get_error_info(cfg); const char *phrase=linphone_error_info_get_phrase(ei); BC_ASSERT_PTR_NOT_NULL(phrase); - if (phrase) BC_ASSERT_TRUE(strcmp(phrase,"Forbidden")==0); + if (phrase) BC_ASSERT_STRING_EQUAL(phrase,"Forbidden"); BC_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),403, int, "%d"); BC_ASSERT_PTR_NULL(linphone_error_info_get_details(ei)); } @@ -750,7 +750,7 @@ static void io_recv_error_without_active_register(){ /*nothing should happen because no active registration*/ wait_for_until(lc,lc, &dummy, 1, 3000); - BC_ASSERT_TRUE(counters->number_of_LinphoneRegistrationProgress == ms_list_size(linphone_core_get_proxy_config_list(lc))); + BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress, ms_list_size(linphone_core_get_proxy_config_list(lc)), int, "%d"); BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0,int,"%d"); diff --git a/tester/remote_provisioning_tester.c b/tester/remote_provisioning_tester.c index 7a5de0876..ac6e5602f 100644 --- a/tester/remote_provisioning_tester.c +++ b/tester/remote_provisioning_tester.c @@ -52,8 +52,8 @@ static void remote_provisioning_transient(void) { LinphoneCoreManager* marie = linphone_core_manager_new2("marie_transient_remote_rc", FALSE); 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); + BC_ASSERT_TRUE(linphone_core_is_provisioning_transient(marie->lc)); + BC_ASSERT_PTR_NULL(linphone_core_get_provisioning_uri(marie->lc)); linphone_core_manager_destroy(marie); } @@ -89,8 +89,8 @@ static void remote_provisioning_default_values(void) { LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_default_values_rc", FALSE); BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1)); lpc = linphone_core_create_proxy_config(marie->lc); - BC_ASSERT_TRUE(lpc->reg_sendregister == TRUE); - BC_ASSERT_TRUE(lpc->expires == 604800); + BC_ASSERT_TRUE(lpc->reg_sendregister); + BC_ASSERT_EQUAL(lpc->expires, 604800, int, "%d"); 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"); diff --git a/tester/setup_tester.c b/tester/setup_tester.c index 58a0dc817..2f7002bd2 100644 --- a/tester/setup_tester.c +++ b/tester/setup_tester.c @@ -25,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*/ - BC_ASSERT_TRUE(strstr(version,"unknown")==NULL); + BC_ASSERT_PTR_NULL(strstr(version,"unknown")); } static void core_init_test(void) { @@ -269,7 +269,7 @@ static void codec_usability_test(void) { LinphoneCoreManager *mgr = linphone_core_manager_new2("empty_rc", FALSE); PayloadType *pt = linphone_core_find_payload_type(mgr->lc, "PCMU", 8000, -1); - BC_ASSERT_TRUE(pt!=NULL); + BC_ASSERT_PTR_NOT_NULL(pt); if (!pt) goto end; /*no limit*/ linphone_core_set_upload_bandwidth(mgr->lc, 0); diff --git a/tester/tester.c b/tester/tester.c index a41d634d8..e51f5a720 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -111,7 +111,7 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c if (file){ filepath = ms_strdup_printf("%s/%s", path, file); - BC_ASSERT_TRUE_FATAL(ortp_file_exist(filepath)==0); + BC_ASSERT_EQUAL_FATAL(ortp_file_exist(filepath),0,int,"%d"); config = lp_config_new_with_factory(NULL,filepath); } diff --git a/tester/upnp_tester.c b/tester/upnp_tester.c index a081f91c1..fc487b75e 100644 --- a/tester/upnp_tester.c +++ b/tester/upnp_tester.c @@ -27,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 - BC_ASSERT_TRUE(lc_upnp->lc->upnp != NULL); + BC_ASSERT_PTR_NOT_NULL(lc_upnp->lc->upnp); #endif linphone_core_manager_destroy(lc_upnp); } @@ -36,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); - BC_ASSERT_TRUE(linphone_core_get_upnp_state(lc_upnp->lc) == LinphoneUpnpStateOk); + BC_ASSERT_EQUAL(linphone_core_get_upnp_state(lc_upnp->lc), LinphoneUpnpStateOk, int, "%d"); linphone_core_manager_destroy(lc_upnp); } @@ -46,7 +46,10 @@ 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); - BC_ASSERT_TRUE(addr != NULL && strlen(addr)>=7); + BC_ASSERT_PTR_NOT_NULL(addr); + if (addr!=NULL) { + BC_ASSERT_GREATER(strlen(addr),7,int,"%d"); + } linphone_core_manager_destroy(lc_upnp); } diff --git a/tester/video_tester.c b/tester/video_tester.c index 2fee24c59..1b21488c5 100644 --- a/tester/video_tester.c +++ b/tester/video_tester.c @@ -446,12 +446,12 @@ static void forked_outgoing_early_media_video_call_with_inactive_audio_test(void if (pauline_call && marie1_call && marie2_call) { /* wait a bit that streams are established */ wait_for_list(lcs, &dummy, 1, 6000); - 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); + BC_ASSERT_EQUAL(linphone_call_get_audio_stats(pauline_call)->download_bandwidth, 0, float, "%f"); + BC_ASSERT_EQUAL(linphone_call_get_audio_stats(marie1_call)->download_bandwidth, 0, float, "%f"); + BC_ASSERT_EQUAL(linphone_call_get_audio_stats(marie2_call)->download_bandwidth, 0, float, "%f"); + BC_ASSERT_EQUAL(linphone_call_get_video_stats(pauline_call)->download_bandwidth, 0, float, "%f"); + BC_ASSERT_GREATER(linphone_call_get_video_stats(marie1_call)->download_bandwidth, 0, float, "%f"); + BC_ASSERT_GREATER(linphone_call_get_video_stats(marie2_call)->download_bandwidth, 0, float, "%f"); 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); @@ -463,10 +463,10 @@ static void forked_outgoing_early_media_video_call_with_inactive_audio_test(void /*wait a bit that streams are established*/ wait_for_list(lcs, &dummy, 1, 3000); - 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); + BC_ASSERT_GREATER(linphone_call_get_audio_stats(pauline_call)->download_bandwidth, 71, float, "%f"); + BC_ASSERT_GREATER(linphone_call_get_audio_stats(marie1_call)->download_bandwidth, 71, float, "%f"); + BC_ASSERT_GREATER(linphone_call_get_video_stats(pauline_call)->download_bandwidth, 0, float, "%f"); + BC_ASSERT_GREATER(linphone_call_get_video_stats(marie1_call)->download_bandwidth, 0, float, "%f"); /* send an INFO in reverse side to check that dialogs are properly established */ info = linphone_core_create_info_message(marie1->lc);