mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
iterator: Add unit test for the single iterator
This commit is contained in:
parent
690f980690
commit
3a5cceeb6b
1 changed files with 32 additions and 0 deletions
|
@ -167,6 +167,37 @@ GST_START_TEST (test_fold)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_single)
|
||||
{
|
||||
GstIterator *it;
|
||||
GstStructure *s = gst_structure_new ("test", NULL);
|
||||
GstStructure *i;
|
||||
|
||||
it = gst_iterator_new_single (GST_TYPE_STRUCTURE, s,
|
||||
(GstCopyFunction) gst_structure_copy, (GFreeFunc) gst_structure_free);
|
||||
|
||||
fail_unless (gst_iterator_next (it, (gpointer *) & i) == GST_ITERATOR_OK);
|
||||
fail_unless (strcmp (gst_structure_get_name (s),
|
||||
gst_structure_get_name (i)) == 0);
|
||||
gst_structure_free (i);
|
||||
i = NULL;
|
||||
fail_unless (gst_iterator_next (it, (gpointer *) & i) == GST_ITERATOR_DONE);
|
||||
fail_unless (i == NULL);
|
||||
|
||||
gst_iterator_free (it);
|
||||
gst_structure_free (s);
|
||||
|
||||
it = gst_iterator_new_single (GST_TYPE_STRUCTURE, NULL,
|
||||
(GstCopyFunction) gst_structure_copy, (GFreeFunc) gst_structure_free);
|
||||
|
||||
fail_unless (gst_iterator_next (it, (gpointer *) & i) == GST_ITERATOR_DONE);
|
||||
fail_unless (i == NULL);
|
||||
|
||||
gst_iterator_free (it);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static Suite *
|
||||
gst_iterator_suite (void)
|
||||
{
|
||||
|
@ -179,6 +210,7 @@ gst_iterator_suite (void)
|
|||
tcase_add_test (tc_chain, test_manual_iteration);
|
||||
tcase_add_test (tc_chain, test_resync);
|
||||
tcase_add_test (tc_chain, test_fold);
|
||||
tcase_add_test (tc_chain, test_single);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue