From f7f83128128772762e48146afda5c4fe37850bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 14 Oct 2015 11:03:22 +0300 Subject: [PATCH] segment: Convert function to macro in unit test to get proper line numbers on failures https://bugzilla.gnome.org/show_bug.cgi?id=748316 --- tests/check/gst/gstsegment.c | 43 +++++++++++++++++------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/tests/check/gst/gstsegment.c b/tests/check/gst/gstsegment.c index 4445693b82..8b0535195b 100644 --- a/tests/check/gst/gstsegment.c +++ b/tests/check/gst/gstsegment.c @@ -22,29 +22,26 @@ #include -static void -check_times (GstSegment * segment, guint64 position, guint64 stream_time, - guint64 running_time) -{ - guint64 st, rt, pos; - - st = gst_segment_to_stream_time (segment, segment->format, position); - rt = gst_segment_to_running_time (segment, segment->format, position); - GST_DEBUG ("position %" G_GUINT64_FORMAT ", st %" G_GUINT64_FORMAT ", rt %" - G_GUINT64_FORMAT, position, stream_time, running_time); - - fail_unless_equals_int64 (st, stream_time); - fail_unless_equals_int64 (rt, running_time); - if (stream_time != -1) { - pos = gst_segment_position_from_stream_time (segment, segment->format, st); - fail_unless_equals_int64 (pos, position); - } - - if (running_time != -1) { - pos = gst_segment_position_from_running_time (segment, segment->format, rt); - fail_unless_equals_int64 (pos, position); - } -} +#define check_times(segment, position, stream_time, running_time) G_STMT_START { \ + guint64 st, rt, pos; \ + \ + st = gst_segment_to_stream_time ((segment), (segment)->format, (position)); \ + rt = gst_segment_to_running_time ((segment), (segment)->format, (position)); \ + GST_DEBUG ("position %" G_GUINT64_FORMAT ", st %" G_GUINT64_FORMAT ", rt %" \ + G_GUINT64_FORMAT, (guint64) (position), (guint64) (stream_time), (guint64) (running_time)); \ + \ + fail_unless_equals_int64 (st, (stream_time)); \ + fail_unless_equals_int64 (rt, (running_time)); \ + if ((stream_time) != -1) { \ + pos = gst_segment_position_from_stream_time ((segment), (segment)->format, st); \ + fail_unless_equals_int64 (pos, (position)); \ + } \ + \ + if ((running_time) != -1) { \ + pos = gst_segment_position_from_running_time ((segment), (segment)->format, rt); \ + fail_unless_equals_int64 (pos, (position)); \ + } \ +} G_STMT_END; /* mess with the segment structure in the bytes format */ GST_START_TEST (segment_seek_nosize)