check: Fix datetime unit test for builds without assert

If built with assertions disabled, we need to ensure the variable is properly
reset before testing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/530>
This commit is contained in:
Edward Hervey 2020-05-27 15:35:41 +02:00 committed by Edward Hervey
parent 87504fe877
commit 33557f8db1

View file

@ -256,6 +256,7 @@ GST_START_TEST (test_GstDateTime_new_local_time)
gst_date_time_unref (dt); gst_date_time_unref (dt);
/* Month */ /* Month */
dt = NULL;
ASSERT_CRITICAL (dt = gst_date_time_new_local_time (2020, 0, 28, 12, 0, 0)); ASSERT_CRITICAL (dt = gst_date_time_new_local_time (2020, 0, 28, 12, 0, 0));
fail_unless (dt == NULL); fail_unless (dt == NULL);
@ -275,6 +276,7 @@ GST_START_TEST (test_GstDateTime_new_local_time)
gst_date_time_unref (dt); gst_date_time_unref (dt);
/* Day */ /* Day */
dt = NULL;
ASSERT_CRITICAL (dt = gst_date_time_new_local_time (2020, 2, 0, 12, 0, 0)); ASSERT_CRITICAL (dt = gst_date_time_new_local_time (2020, 2, 0, 12, 0, 0));
fail_unless (dt == NULL); fail_unless (dt == NULL);
@ -294,6 +296,7 @@ GST_START_TEST (test_GstDateTime_new_local_time)
gst_date_time_unref (dt); gst_date_time_unref (dt);
/* Hour */ /* Hour */
dt = NULL;
ASSERT_CRITICAL (dt = gst_date_time_new_local_time (2020, 2, 28, -10, 0, 0)); // -1 has special meaning! ASSERT_CRITICAL (dt = gst_date_time_new_local_time (2020, 2, 28, -10, 0, 0)); // -1 has special meaning!
fail_unless (dt == NULL); fail_unless (dt == NULL);
@ -309,6 +312,7 @@ GST_START_TEST (test_GstDateTime_new_local_time)
gst_date_time_unref (dt); gst_date_time_unref (dt);
/* Min */ /* Min */
dt = NULL;
ASSERT_CRITICAL (dt = gst_date_time_new_local_time (2020, 2, 28, 12, -10, 0)); // -1 has special meaning! ASSERT_CRITICAL (dt = gst_date_time_new_local_time (2020, 2, 28, 12, -10, 0)); // -1 has special meaning!
fail_unless (dt == NULL); fail_unless (dt == NULL);
@ -324,6 +328,7 @@ GST_START_TEST (test_GstDateTime_new_local_time)
gst_date_time_unref (dt); gst_date_time_unref (dt);
/* Sec */ /* Sec */
dt = NULL;
ASSERT_CRITICAL (dt = gst_date_time_new_local_time (2020, 2, 28, 12, 0, -10)); // -1 has special meaning! ASSERT_CRITICAL (dt = gst_date_time_new_local_time (2020, 2, 28, 12, 0, -10)); // -1 has special meaning!
fail_unless (dt == NULL); fail_unless (dt == NULL);