tests: add another adapter test

Test performance of merging
This commit is contained in:
Wim Taymans 2012-04-14 10:24:38 +02:00
parent 2503dcddfb
commit fc8b28455f

View file

@ -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;
}