summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Ashley <bugzilla@ashley-family.net>2015-08-20 15:00:02 +0100
committerSebastian Dröge <sebastian@centricular.com>2015-08-20 17:13:48 +0300
commit48fefd8c841c6b22a620d3b6d6af5d062886627f (patch)
tree87618d84322ba92cc71ecf08681eb8ff9fc68815 /tests
parent40d2693d074038fd2a7648f371bd7c9d39ce1b5b (diff)
downloadgstreamer-plugins-bad-48fefd8c841c6b22a620d3b6d6af5d062886627f.tar.gz
check: hlsdemux: make duration unit test robust to floating point rounding
The test_playlist_with_doubles_duration() test fails on some platforms due to rounding errors that occur when m3u8.c converts from the floating point value in the HLS manifest to a GstClockTime. Using assert_equals_float() fixes this because this function handles the rounding error issues by accepting almost equal. https://bugzilla.gnome.org/show_bug.cgi?id=753881
Diffstat (limited to 'tests')
-rw-r--r--tests/check/elements/hlsdemux_m3u8.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/check/elements/hlsdemux_m3u8.c b/tests/check/elements/hlsdemux_m3u8.c
index 07fe6d693..406123e92 100644
--- a/tests/check/elements/hlsdemux_m3u8.c
+++ b/tests/check/elements/hlsdemux_m3u8.c
@@ -558,13 +558,13 @@ GST_START_TEST (test_playlist_with_doubles_duration)
pl = client->current;
/* Check first media segments */
file = GST_M3U8_MEDIA_FILE (g_list_nth_data (pl->files, 0));
- assert_equals_uint64 (file->duration, 10.321 * GST_SECOND);
+ assert_equals_float (file->duration / (double) GST_SECOND, 10.321);
file = GST_M3U8_MEDIA_FILE (g_list_nth_data (pl->files, 1));
- assert_equals_uint64 (file->duration, 9.6789 * GST_SECOND);
+ assert_equals_float (file->duration / (double) GST_SECOND, 9.6789);
file = GST_M3U8_MEDIA_FILE (g_list_nth_data (pl->files, 2));
- assert_equals_uint64 (file->duration, 10.2344 * GST_SECOND);
+ assert_equals_float (file->duration / (double) GST_SECOND, 10.2344);
file = GST_M3U8_MEDIA_FILE (g_list_nth_data (pl->files, 3));
- assert_equals_uint64 (file->duration, 9.92 * GST_SECOND);
+ assert_equals_float (file->duration / (double) GST_SECOND, 9.92);
gst_m3u8_client_free (client);
}