diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-09-01 10:21:31 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-09-01 10:21:31 +0200 |
commit | 3a5cceeb6b56e4af6389c831cbf9f4b09734d75c (patch) | |
tree | 0a9fb9fbc35183170f93fff2842b2d724dc32a37 | |
parent | 690f98069049d57d9727d2c95369e0df0fa34b38 (diff) |
iterator: Add unit test for the single iterator
-rw-r--r-- | tests/check/gst/gstiterator.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/check/gst/gstiterator.c b/tests/check/gst/gstiterator.c index 8d78c8130a..16e3078d79 100644 --- a/tests/check/gst/gstiterator.c +++ b/tests/check/gst/gstiterator.c @@ -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; } |