From fc8b28455feddc3453268ca5905d56ddcbe1e2f4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sat, 14 Apr 2012 10:24:38 +0200 Subject: [PATCH] tests: add another adapter test Test performance of merging --- tests/check/libs/adapter.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/check/libs/adapter.c b/tests/check/libs/adapter.c index bf356b992b..19122f0c4b 100644 --- a/tests/check/libs/adapter.c +++ b/tests/check/libs/adapter.c @@ -805,6 +805,33 @@ GST_START_TEST (test_take_list) GST_END_TEST; +GST_START_TEST (test_merge) +{ + GstAdapter *adapter; + GstBuffer *buffer; + gint i; + + adapter = gst_adapter_new (); + fail_if (adapter == NULL); + + buffer = gst_buffer_new_and_alloc (10); + fail_if (buffer == NULL); + gst_adapter_push (adapter, buffer); + + for (i = 0; i < 1000; i++) { + buffer = gst_buffer_new_and_alloc (10); + gst_adapter_push (adapter, buffer); + + fail_unless (gst_adapter_map (adapter, 20) != NULL); + gst_adapter_unmap (adapter); + + gst_adapter_flush (adapter, 10); + } + g_object_unref (adapter); +} + +GST_END_TEST; + static Suite * gst_adapter_suite (void) { @@ -823,6 +850,7 @@ gst_adapter_suite (void) tcase_add_test (tc_chain, test_timestamp); tcase_add_test (tc_chain, test_scan); tcase_add_test (tc_chain, test_take_list); + tcase_add_test (tc_chain, test_merge); return s; }