as well as lists and ranges ("{ 1, 2 }" and "[ 1, 2 ]" are equal) */
ltype = gst_value_list_get_type ();
if (G_VALUE_HOLDS (value1, ltype) && !G_VALUE_HOLDS (value2, ltype)) {
+ gint i, n, ret;
if (gst_value_list_equals_range (value1, value2)) {
return GST_VALUE_EQUAL;
- } else if (gst_value_list_get_size (value1) == 1) {
+ }
+
+ n = gst_value_list_get_size (value1);
+ if (n == 0)
+ return GST_VALUE_UNORDERED;
+
+ for (i = 0; i < n; i++) {
const GValue *elt;
- elt = gst_value_list_get_value (value1, 0);
- return gst_value_compare (elt, value2);
+ elt = gst_value_list_get_value (value1, i);
+ ret = gst_value_compare (elt, value2);
+ if (ret != GST_VALUE_EQUAL && n == 1)
+ return ret;
+ else if (ret != GST_VALUE_EQUAL)
+ return GST_VALUE_UNORDERED;
}
+
+ return GST_VALUE_EQUAL;
} else if (G_VALUE_HOLDS (value2, ltype) && !G_VALUE_HOLDS (value1, ltype)) {
+ gint i, n, ret;
+
if (gst_value_list_equals_range (value2, value1)) {
return GST_VALUE_EQUAL;
- } else if (gst_value_list_get_size (value2) == 1) {
+ }
+
+ n = gst_value_list_get_size (value2);
+ if (n == 0)
+ return GST_VALUE_UNORDERED;
+
+ for (i = 0; i < n; i++) {
const GValue *elt;
- elt = gst_value_list_get_value (value2, 0);
- return gst_value_compare (elt, value1);
+ elt = gst_value_list_get_value (value2, i);
+ ret = gst_value_compare (elt, value1);
+ if (ret != GST_VALUE_EQUAL && n == 1)
+ return ret;
+ else if (ret != GST_VALUE_EQUAL)
+ return GST_VALUE_UNORDERED;
}
+
+ return GST_VALUE_EQUAL;
}
if (G_VALUE_TYPE (value1) != G_VALUE_TYPE (value2))
GstCaps *c1, *c2;
c1 = gst_caps_from_string ("audio/x-raw, format=(string)F32LE");
+ c2 = gst_caps_from_string ("audio/x-raw, format=(string)F32LE");
+
+ fail_unless (gst_caps_is_subset (c1, c2));
+ fail_unless (gst_caps_is_subset (c2, c1));
+
+ gst_caps_unref (c2);
+ c2 = gst_caps_from_string ("audio/x-raw, format=(string){ F32LE }");
+
+ fail_unless (gst_caps_is_subset (c1, c2));
+ fail_unless (gst_caps_is_subset (c2, c1));
+
+ gst_caps_unref (c2);
c2 = gst_caps_from_string ("audio/x-raw, format=(string){ F32LE, F32LE }");
fail_unless (gst_caps_is_subset (c1, c2));
+ fail_unless (gst_caps_is_subset (c2, c1));
+
+ gst_caps_unref (c2);
+ c2 = gst_caps_from_string
+ ("audio/x-raw, format=(string){ F32LE, F32LE, F32LE }");
+
+ fail_unless (gst_caps_is_subset (c1, c2));
+ fail_unless (gst_caps_is_subset (c2, c1));
+
gst_caps_unref (c1);
gst_caps_unref (c2);
}
tcase_add_test (tc_chain, test_simplify);
tcase_add_test (tc_chain, test_truncate);
tcase_add_test (tc_chain, test_subset);
- tcase_skip_broken_test (tc_chain, test_subset_duplication);
+ tcase_add_test (tc_chain, test_subset_duplication);
tcase_add_test (tc_chain, test_merge_fundamental);
tcase_add_test (tc_chain, test_merge_same);
tcase_add_test (tc_chain, test_merge_subset);