segment: Convert function to macro in unit test to get proper line numbers on failures

https://bugzilla.gnome.org/show_bug.cgi?id=748316
This commit is contained in:
Sebastian Dröge 2015-10-14 11:03:22 +03:00
parent 55f6582159
commit f7f8312812

View file

@ -22,29 +22,26 @@
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
static void #define check_times(segment, position, stream_time, running_time) G_STMT_START { \
check_times (GstSegment * segment, guint64 position, guint64 stream_time, guint64 st, rt, pos; \
guint64 running_time) \
{ st = gst_segment_to_stream_time ((segment), (segment)->format, (position)); \
guint64 st, rt, pos; rt = gst_segment_to_running_time ((segment), (segment)->format, (position)); \
GST_DEBUG ("position %" G_GUINT64_FORMAT ", st %" G_GUINT64_FORMAT ", rt %" \
st = gst_segment_to_stream_time (segment, segment->format, position); G_GUINT64_FORMAT, (guint64) (position), (guint64) (stream_time), (guint64) (running_time)); \
rt = gst_segment_to_running_time (segment, segment->format, position); \
GST_DEBUG ("position %" G_GUINT64_FORMAT ", st %" G_GUINT64_FORMAT ", rt %" fail_unless_equals_int64 (st, (stream_time)); \
G_GUINT64_FORMAT, position, stream_time, running_time); fail_unless_equals_int64 (rt, (running_time)); \
if ((stream_time) != -1) { \
fail_unless_equals_int64 (st, stream_time); pos = gst_segment_position_from_stream_time ((segment), (segment)->format, st); \
fail_unless_equals_int64 (rt, running_time); fail_unless_equals_int64 (pos, (position)); \
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)); \
if (running_time != -1) { } \
pos = gst_segment_position_from_running_time (segment, segment->format, rt); } G_STMT_END;
fail_unless_equals_int64 (pos, position);
}
}
/* mess with the segment structure in the bytes format */ /* mess with the segment structure in the bytes format */
GST_START_TEST (segment_seek_nosize) GST_START_TEST (segment_seek_nosize)