mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 11:32:38 +00:00
tests/structure: add some more is_subset checks
Explicitly testing extra/missing fields and name differences
This commit is contained in:
parent
3d283665cc
commit
865247d32a
1 changed files with 78 additions and 2 deletions
|
@ -464,7 +464,7 @@ GST_START_TEST (test_fixate_frac_list)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_is_subset)
|
||||
GST_START_TEST (test_is_subset_equal_array_list)
|
||||
{
|
||||
GstStructure *s1, *s2;
|
||||
|
||||
|
@ -481,6 +481,78 @@ GST_START_TEST (test_is_subset)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_is_subset_different_name)
|
||||
{
|
||||
GstStructure *s1, *s2;
|
||||
|
||||
s1 = gst_structure_from_string ("test/test, channels=(int)1", NULL);
|
||||
fail_if (s1 == NULL);
|
||||
s2 = gst_structure_from_string ("test/baz, channels=(int)1", NULL);
|
||||
fail_if (s2 == NULL);
|
||||
|
||||
fail_unless (!gst_structure_is_subset (s1, s2));
|
||||
|
||||
gst_structure_free (s1);
|
||||
gst_structure_free (s2);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_is_subset_superset_missing_fields)
|
||||
{
|
||||
GstStructure *s1, *s2;
|
||||
|
||||
/* a missing field is equivalent to any value */
|
||||
s1 = gst_structure_from_string ("test/test, channels=(int)1, rate=(int)1",
|
||||
NULL);
|
||||
fail_if (s1 == NULL);
|
||||
s2 = gst_structure_from_string ("test/test, channels=(int)1", NULL);
|
||||
fail_if (s2 == NULL);
|
||||
|
||||
fail_unless (gst_structure_is_subset (s1, s2));
|
||||
|
||||
gst_structure_free (s1);
|
||||
gst_structure_free (s2);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_is_subset_superset_extra_fields)
|
||||
{
|
||||
GstStructure *s1, *s2;
|
||||
|
||||
/* a missing field is equivalent to any value */
|
||||
s1 = gst_structure_from_string ("test/test, channels=(int)1", NULL);
|
||||
fail_if (s1 == NULL);
|
||||
s2 = gst_structure_from_string ("test/test, channels=(int)1, rate=(int)1",
|
||||
NULL);
|
||||
fail_if (s2 == NULL);
|
||||
|
||||
fail_unless (!gst_structure_is_subset (s1, s2));
|
||||
|
||||
gst_structure_free (s1);
|
||||
gst_structure_free (s2);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_is_subset_superset_extra_values)
|
||||
{
|
||||
GstStructure *s1, *s2;
|
||||
|
||||
s1 = gst_structure_from_string ("test/test, channels=(int)1", NULL);
|
||||
fail_if (s1 == NULL);
|
||||
s2 = gst_structure_from_string ("test/test, channels=(int)[ 1, 2 ]", NULL);
|
||||
fail_if (s2 == NULL);
|
||||
|
||||
fail_unless (gst_structure_is_subset (s1, s2));
|
||||
|
||||
gst_structure_free (s1);
|
||||
gst_structure_free (s2);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
|
||||
GST_START_TEST (test_structure_nested)
|
||||
{
|
||||
|
@ -792,7 +864,11 @@ gst_structure_suite (void)
|
|||
tcase_add_test (tc_chain, test_structure_new);
|
||||
tcase_add_test (tc_chain, test_fixate);
|
||||
tcase_add_test (tc_chain, test_fixate_frac_list);
|
||||
tcase_add_test (tc_chain, test_is_subset);
|
||||
tcase_add_test (tc_chain, test_is_subset_equal_array_list);
|
||||
tcase_add_test (tc_chain, test_is_subset_different_name);
|
||||
tcase_add_test (tc_chain, test_is_subset_superset_missing_fields);
|
||||
tcase_add_test (tc_chain, test_is_subset_superset_extra_fields);
|
||||
tcase_add_test (tc_chain, test_is_subset_superset_extra_values);
|
||||
tcase_add_test (tc_chain, test_structure_nested);
|
||||
tcase_add_test (tc_chain, test_structure_nested_from_and_to_string);
|
||||
tcase_add_test (tc_chain, test_vararg_getters);
|
||||
|
|
Loading…
Reference in a new issue