summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEdward Hervey <edward@collabora.com>2013-12-10 17:53:24 -0500
committerEdward Hervey <edward@collabora.com>2013-12-10 18:01:52 -0500
commit3ea6b04c10b10fde9d62190068f274b940edef07 (patch)
tree71bcc12b7347bc85a13c244e20e5e0a5fd27f88b /tests
parentb363ab17e7a34fb1040481b9aadabf2ad6c93901 (diff)
gstvalue: Fix comparision of double range
Checking twice the lower bound is great (you never know, it might change between the two calls by someone using emacs butterfly-mode), but it's a bit more useful to check the higher bound are also identical. Detected by Coverity
Diffstat (limited to 'tests')
-rw-r--r--tests/check/gst/gstvalue.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/check/gst/gstvalue.c b/tests/check/gst/gstvalue.c
index fcb7220b7d..5f1b347d0a 100644
--- a/tests/check/gst/gstvalue.c
+++ b/tests/check/gst/gstvalue.c
@@ -1475,6 +1475,26 @@ GST_START_TEST (test_value_subtract_double)
/* double_range <-> double_range
*/
+ /* Check equality */
+ g_value_init (&src1, GST_TYPE_DOUBLE_RANGE);
+ gst_value_set_double_range (&src1, 10.0, 20.0);
+ g_value_init (&src2, GST_TYPE_DOUBLE_RANGE);
+ gst_value_set_double_range (&src2, 10.0, 15.0);
+ /* They are not equal (higher bound is different */
+ fail_if (gst_value_compare (&src1, &src2) == GST_VALUE_EQUAL);
+ g_value_unset (&src1);
+ /* They are not equal (lower bound is different */
+ g_value_init (&src1, GST_TYPE_DOUBLE_RANGE);
+ gst_value_set_double_range (&src1, 5.0, 15.0);
+ fail_if (gst_value_compare (&src1, &src2) == GST_VALUE_EQUAL);
+ g_value_unset (&src1);
+ /* And finally check equality */
+ g_value_init (&src1, GST_TYPE_DOUBLE_RANGE);
+ gst_value_set_double_range (&src1, 10.0, 15.0);
+ fail_unless (gst_value_compare (&src1, &src2) == GST_VALUE_EQUAL);
+ g_value_unset (&src1);
+ g_value_unset (&src2);
+
/* same range, empty set */
g_value_init (&src1, GST_TYPE_DOUBLE_RANGE);
gst_value_set_double_range (&src1, 10.0, 20.0);