tester: reworks BC_macro usage

parent 90571c09
......@@ -339,8 +339,8 @@ static void event_queue_cb(MediaStream *ms, void *user_pointer) {
if (rb&&ortp_loss_rate_estimator_process_report_block(ctx->estimator,ms->sessions.rtp_session,rb)){
float diff = fabs(ortp_loss_rate_estimator_get_value(ctx->estimator) - ctx->loss_rate);
BC_ASSERT_TRUE(diff >= 0);
BC_ASSERT_TRUE(diff <= 10);
BC_ASSERT_GREATER(diff, 0, float, "%f");
BC_ASSERT_LOWER(diff, 10, float, "%f");
}
} while (rtcp_next_packet(evd->packet));
}
......@@ -364,7 +364,7 @@ static void packet_duplication(void) {
/*in theory, cumulative loss should be the invert of duplicated count, but
since cumulative loss is computed only on received RTCP report and duplicated
count is updated on each RTP packet received, we cannot accurately compare these values*/
BC_ASSERT_TRUE(stats->cum_packet_loss <= -.5*stats->packet_dup_recv);
BC_ASSERT_LOWER(stats->cum_packet_loss, -.5*stats->packet_dup_recv, int64_t, "%lld");
stop_adaptive_stream(marielle,margaux);
dup_ratio = 1;
......@@ -373,7 +373,7 @@ static void packet_duplication(void) {
iterate_adaptive_stream(marielle, margaux, 10000, NULL, 0);
stats=rtp_session_get_stats(margaux->video_stream->ms.sessions.rtp_session);
BC_ASSERT_EQUAL(stats->packet_dup_recv, dup_ratio ? stats->packet_recv / (dup_ratio+1) : 0, int, "%d");
BC_ASSERT_TRUE(stats->cum_packet_loss <= -.5*stats->packet_dup_recv);
BC_ASSERT_LOWER(stats->cum_packet_loss, -.5*stats->packet_dup_recv, int64_t, "%lld");
stop_adaptive_stream(marielle,margaux);
}
......@@ -393,7 +393,7 @@ static void upload_bandwidth_computation(void) {
rtp_session_set_duplication_ratio(marielle->audio_stream->ms.sessions.rtp_session, i);
iterate_adaptive_stream(marielle, margaux, 5000, NULL, 0);
/*since PCMA uses 80kbit/s, upload bandwidth should just be 80+80*duplication_ratio kbit/s */
BC_ASSERT_TRUE(fabs(rtp_session_get_send_bandwidth(marielle->audio_stream->ms.sessions.rtp_session)/1000. - 80.*(i+1)) < 5.f);
BC_ASSERT_LOWER(fabs(rtp_session_get_send_bandwidth(marielle->audio_stream->ms.sessions.rtp_session)/1000. - 80.*(i+1)), 5.f, float, "%f");
}
stop_adaptive_stream(marielle,margaux);
}
......@@ -439,7 +439,7 @@ static void loss_rate_estimation_bv16(void){
size_no_plc = fsize(bc_tester_file(RECORDED_16K_1S_NO_PLC_FILE));
result = (size_with_plc*loss_rate/100 + size_no_plc) ;
BC_ASSERT_TRUE(result >= size_with_plc);
BC_ASSERT_GREATER(result, size_with_plc, int, "%d");
ms_message("%d %d %d ", size_no_plc, size_with_plc, result);
}
......@@ -485,8 +485,8 @@ void upload_bitrate(const char* codec, int payload, int target_bw, int expect_bw
media_stream_enable_adaptive_bitrate_control(&marielle->audio_stream->ms,FALSE);
iterate_adaptive_stream(marielle, margaux, 15000, NULL, 0);
upload_bw=media_stream_get_up_bw(&marielle->audio_stream->ms) / 1000;
BC_ASSERT_TRUE(upload_bw >= expect_bw-2);
BC_ASSERT_TRUE(upload_bw <= expect_bw+2);
BC_ASSERT_GREATER(upload_bw, expect_bw-2, float, "%f");
BC_ASSERT_LOWER(upload_bw, expect_bw+2, float, "%f");
stop_adaptive_stream(marielle,margaux);
}
}
......@@ -531,10 +531,10 @@ void adaptive_video(int max_bw, int exp_min_bw, int exp_max_bw, int loss_rate, i
stream_manager_t * marielle, * margaux;
start_adaptive_stream(MSVideo, &marielle, &margaux, VP8_PAYLOAD_TYPE, 300*1000, max_bw*1000, loss_rate, 50,0);
iterate_adaptive_stream(marielle, margaux, 100000, &marielle->rtcp_count, 7);
BC_ASSERT_TRUE(marielle->adaptive_stats.loss_estim >= exp_min_loss);
BC_ASSERT_TRUE(marielle->adaptive_stats.loss_estim <= exp_max_loss);
BC_ASSERT_TRUE(marielle->adaptive_stats.congestion_bw_estim >= exp_min_bw);
BC_ASSERT_TRUE(marielle->adaptive_stats.congestion_bw_estim <= exp_max_bw);
BC_ASSERT_GREATER(marielle->adaptive_stats.loss_estim, exp_min_loss, int, "%d");
BC_ASSERT_LOWER(marielle->adaptive_stats.loss_estim, exp_max_loss, int, "%d");
BC_ASSERT_GREATER(marielle->adaptive_stats.congestion_bw_estim, exp_min_bw, int, "%d");
BC_ASSERT_LOWER(marielle->adaptive_stats.congestion_bw_estim, exp_max_bw, int, "%d");
stop_adaptive_stream(marielle,margaux);
}
}
......
......@@ -196,8 +196,8 @@ static void basic_audio_stream_base_2( const char* marielle_local_ip
if (rtp_session_rtcp_enabled(marielle->ms.sessions.rtp_session) && rtp_session_rtcp_enabled(margaux->ms.sessions.rtp_session)) {
BC_ASSERT_TRUE(rtp_session_get_round_trip_propagation(marielle->ms.sessions.rtp_session)>0);
BC_ASSERT_TRUE(rtp_session_get_stats(marielle->ms.sessions.rtp_session)->recv_rtcp_packets >0);
BC_ASSERT_GREATER_STRICT(rtp_session_get_round_trip_propagation(marielle->ms.sessions.rtp_session),0,float,"%f");
BC_ASSERT_GREATER_STRICT(rtp_session_get_stats(marielle->ms.sessions.rtp_session)->recv_rtcp_packets,0,uint64_t,"%llu");
}
audio_stream_stop(marielle);
......
......@@ -214,7 +214,7 @@ static void copy_paste_text_longer_than_rtt_buffer(void) {
BC_ASSERT_FALSE(wait_for_until(&marielle->ts->ms, &margaux->ts->ms, &marielle->stats.number_of_received_char, strlen(helloworld), 5000));
ms_message("Received message is: %s", marielle->stats.received_chars);
strcmpresult = strcmp(marielle->stats.received_chars, helloworld);
BC_ASSERT_TRUE(strcmpresult < 0);
BC_ASSERT_LOWER(strcmpresult, 0, int, "%d");
uninit_text_streams(marielle, margaux);
text_stream_tester_destroy(marielle);
......@@ -234,10 +234,10 @@ static void srtp_protected_text_stream(void) {
BC_ASSERT_TRUE(ms_srtp_supported());
BC_ASSERT_TRUE(ms_media_stream_sessions_set_srtp_send_key_b64(&(marielle->ts->ms.sessions), MS_AES_128_SHA1_32, "d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj") == 0);
BC_ASSERT_TRUE(ms_media_stream_sessions_set_srtp_send_key_b64(&(margaux->ts->ms.sessions), MS_AES_128_SHA1_32, "6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F") == 0);
BC_ASSERT_TRUE(ms_media_stream_sessions_set_srtp_recv_key_b64(&(margaux->ts->ms.sessions), MS_AES_128_SHA1_32, "d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj") == 0);
BC_ASSERT_TRUE(ms_media_stream_sessions_set_srtp_recv_key_b64(&(marielle->ts->ms.sessions), MS_AES_128_SHA1_32, "6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F") == 0);
BC_ASSERT_EQUAL(ms_media_stream_sessions_set_srtp_send_key_b64(&(marielle->ts->ms.sessions), MS_AES_128_SHA1_32, "d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj"),0,int,"%d");
BC_ASSERT_EQUAL(ms_media_stream_sessions_set_srtp_send_key_b64(&(margaux->ts->ms.sessions), MS_AES_128_SHA1_32, "6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F"),0,int,"%d");
BC_ASSERT_EQUAL(ms_media_stream_sessions_set_srtp_recv_key_b64(&(margaux->ts->ms.sessions), MS_AES_128_SHA1_32, "d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj"),0,int,"%d");
BC_ASSERT_EQUAL(ms_media_stream_sessions_set_srtp_recv_key_b64(&(marielle->ts->ms.sessions), MS_AES_128_SHA1_32, "6jCLmtRkVW9E/BUuJtYj/R2z6+4iEe06/DWohQ9F"),0,int,"%d");
BC_ASSERT_TRUE(media_stream_secured(&marielle->ts->ms));
BC_ASSERT_TRUE(media_stream_secured(&margaux->ts->ms));
......
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