From 8f76257ac03ffaf281352067b8b1b7547f94b641 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Sun, 8 Jul 2018 20:52:08 -0400 Subject: [PATCH] check: Add a fail_unless_equals_clocktime macro for convenience --- libs/gst/check/gstcheck.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libs/gst/check/gstcheck.h b/libs/gst/check/gstcheck.h index 306c0d6..cc6d5f3 100644 --- a/libs/gst/check/gstcheck.h +++ b/libs/gst/check/gstcheck.h @@ -500,6 +500,24 @@ G_STMT_START { \ */ #define assert_equals_pointer(a, b) fail_unless_equals_pointer(a, b) +/** + * fail_unless_equals_clocktime: + * @a: a #GstClockTime value or expression + * @b: a #GstClockTime value or expression + * + * This macro checks that @a and @b are equal and aborts if this is not the + * case, printing both expressions and the values they evaluated to. This + * macro is for use in unit tests. + */ +#define fail_unless_equals_clocktime(a, b) \ +G_STMT_START { \ + GstClockTime first = a; \ + GstClockTime second = b; \ + fail_unless(first == second, \ + "'" #a "' (%" GST_TIME_FORMAT") is not equal to '" #b"' (%" GST_TIME_FORMAT")", \ + GST_TIME_ARGS (first), GST_TIME_ARGS (second)); \ +} G_STMT_END; + /*** * thread test macros and variables */ -- 2.7.4