tester: replace some BC_ASSERT_TRUE with better BC_ASSERT_LOWER/GREATER/EQUAL ones

parent cc382640
This diff is collapsed.
......@@ -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);
......
......@@ -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));
......
......@@ -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");
}
}
......
......@@ -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));
......
......@@ -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_pos<speex_codec_pos);
if (opus_codec_pos!=-1) BC_ASSERT_EQUAL(opus_codec_pos,0,int, "%d");
BC_ASSERT_LOWER(speex16_codec_pos,speex_codec_pos,int,"%d");
pt=linphone_core_find_payload_type(lc, "speex", 16000, 1);
BC_ASSERT_PTR_NOT_NULL(pt);
if (pt) {
BC_ASSERT_TRUE(linphone_core_payload_type_enabled(lc, pt)==TRUE);
BC_ASSERT_TRUE(linphone_core_payload_type_enabled(lc, pt));
}
linphone_core_destroy(lc);
}
......@@ -59,13 +59,13 @@ static void check_payload_type_numbers(LinphoneCall *call1, LinphoneCall *call2,
const PayloadType *pt=linphone_call_params_get_used_audio_codec(params);
BC_ASSERT_PTR_NOT_NULL(pt);
if (pt){
BC_ASSERT_TRUE(linphone_core_get_payload_type_number(linphone_call_get_core(call1),pt)==expected_number);
BC_ASSERT_EQUAL(linphone_core_get_payload_type_number(linphone_call_get_core(call1),pt),expected_number, int, "%d");
}
params=linphone_call_get_current_params(call2);
pt=linphone_call_params_get_used_audio_codec(params);
BC_ASSERT_PTR_NOT_NULL(pt);
if (pt){
BC_ASSERT_TRUE(linphone_core_get_payload_type_number(linphone_call_get_core(call1),pt)==expected_number);
BC_ASSERT_EQUAL(linphone_core_get_payload_type_number(linphone_call_get_core(call1),pt),expected_number, int, "%d");
}
}
......
......@@ -299,7 +299,7 @@ static void presence_information(void) {
BC_ASSERT_EQUAL(linphone_presence_activity_get_type(activity), LinphonePresenceActivitySteering, int, "%d");
description = linphone_presence_activity_get_description(activity);
BC_ASSERT_PTR_NOT_NULL(description);
if (description != NULL) BC_ASSERT_EQUAL(strcmp(description, bike_description), 0, int, "%d");
if (description != NULL) BC_ASSERT_STRING_EQUAL(description, bike_description);
/* Presence activity with description and note. */
presence = linphone_presence_model_new_with_activity_and_note(LinphonePresenceActivityVacation, NULL, vacation_note, vacation_lang);
......@@ -317,7 +317,7 @@ static void presence_information(void) {
note_content = linphone_presence_note_get_content(note);
BC_ASSERT_PTR_NOT_NULL(note_content);
if (note_content != NULL) {
BC_ASSERT_EQUAL(strcmp(note_content, vacation_note), 0, int, "%d");
BC_ASSERT_STRING_EQUAL(note_content, vacation_note);
}
}
......@@ -330,7 +330,7 @@ static void presence_information(void) {
contact2 = linphone_presence_model_get_contact(presence);
BC_ASSERT_PTR_NOT_NULL(contact2);
if (contact2 != NULL) {
BC_ASSERT_EQUAL(strcmp(contact, contact2), 0, int, "%d");
BC_ASSERT_STRING_EQUAL(contact, contact2);
ms_free(contact2);
}
......@@ -341,7 +341,7 @@ static void presence_information(void) {
wait_for(marie->lc,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);
......
......@@ -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");
......
......@@ -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, "<sip:sip.linphone.org:5223;transport=tls>");
BC_ASSERT_STRING_EQUAL(lpc->reg_route, "<sip:sip.linphone.org:5223;transport=tls>");
BC_ASSERT_STRING_EQUAL(lpc->reg_identity, "sip:?@sip.linphone.org");
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment