summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2004-04-13 10:44:29 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2004-04-13 10:44:29 +0000
commit21392d9227698ab507bc8407a1c56b295fb8a15b (patch)
treed2c2ae3869dd95df48f48c2f01c71c63e10b0232 /tests
parent0d4983a512623d2131c63549961a7e4370e0c97b (diff)
add asserts, fix up tests slightly
Original commit message from CVS: add asserts, fix up tests slightly
Diffstat (limited to 'tests')
-rw-r--r--tests/old/testsuite/refcounting/bin.c3
-rw-r--r--tests/old/testsuite/refcounting/element_pad.c69
2 files changed, 33 insertions, 39 deletions
diff --git a/tests/old/testsuite/refcounting/bin.c b/tests/old/testsuite/refcounting/bin.c
index df5d76aef..546790276 100644
--- a/tests/old/testsuite/refcounting/bin.c
+++ b/tests/old/testsuite/refcounting/bin.c
@@ -10,10 +10,13 @@ create_bin (void)
GstElement *element;
bin = gst_bin_new ("testbin");
+ g_assert (GST_IS_BIN (bin));
element = gst_element_factory_make ("fakesrc", NULL);
+ g_assert (GST_IS_ELEMENT (element));
gst_element_set_name (element, "test1");
gst_bin_add (GST_BIN (bin), element);
element = gst_element_factory_make ("fakesrc", NULL);
+ g_assert (GST_IS_ELEMENT (element));
gst_element_set_name (element, "test2");
gst_bin_add (GST_BIN (bin), element);
diff --git a/tests/old/testsuite/refcounting/element_pad.c b/tests/old/testsuite/refcounting/element_pad.c
index 1d8dd85b6..bd98282fe 100644
--- a/tests/old/testsuite/refcounting/element_pad.c
+++ b/tests/old/testsuite/refcounting/element_pad.c
@@ -20,103 +20,94 @@ main (int argc, gchar * argv[])
else
iters = ITERS;
-
g_print ("starting element with pad test with %d iterations\n", iters);
usage1 = vmsize ();
element = gst_element_factory_make ("fakesink", NULL);;
+ g_assert (GST_IS_ELEMENT (element));
pad = gst_element_get_pad (element, "sink");
+ g_assert (GST_IS_PAD (pad));
g_assert (GST_OBJECT_FLOATING (element));
g_assert (!GST_OBJECT_FLOATING (pad));
g_assert (gst_pad_get_parent (pad) == element);
gst_object_unref (GST_OBJECT (element));
- g_print ("create/addpad/unref new element %ld\n", vmsize () - usage1);
+ g_print ("create/addpad/unref 1 new element: %ld\n", vmsize () - usage1);
for (i = 0; i < iters; i++) {
element = gst_element_factory_make ("fakesink", NULL);;
+ g_assert (GST_IS_ELEMENT (element));
gst_object_unref (GST_OBJECT (element));
}
- g_print ("create/addpad/unref %d elements %ld\n", iters, vmsize () - usage1);
-
- for (i = 0; i < iters / 2; i++) {
- element = gst_element_factory_make ("fakesink", NULL);
- element2 = gst_element_factory_make ("fakesrc", NULL);
- gst_element_link_pads (element, "sink", element2, "src");
- g_assert (GST_PAD_IS_LINKED (gst_element_get_pad (element2, "src")));
- g_assert (GST_PAD_IS_LINKED (gst_element_get_pad (element, "sink")));
- gst_object_unref (GST_OBJECT (element));
- g_assert (!GST_PAD_IS_LINKED (gst_element_get_pad (element2, "src")));
- gst_object_unref (GST_OBJECT (element2));
- }
- g_print ("create/link/unref %d elements %ld\n", iters / 2,
- vmsize () - usage1);
+ g_print ("create/unref %d elements: %ld\n", iters, vmsize () - usage1);
for (i = 0; i < iters / 2; i++) {
element = gst_element_factory_make ("fakesink", NULL);
+ g_assert (GST_IS_ELEMENT (element));
element2 = gst_element_factory_make ("fakesrc", NULL);
- gst_element_link_pads (element, "sink", element2, "src");
+ g_assert (GST_IS_ELEMENT (element2));
+ gst_element_link_pads (element2, "src", element, "sink");
g_assert (GST_PAD_IS_LINKED (gst_element_get_pad (element2, "src")));
g_assert (GST_PAD_IS_LINKED (gst_element_get_pad (element, "sink")));
gst_object_unref (GST_OBJECT (element));
- g_assert (GST_OBJECT_DESTROYED (element));
g_assert (!GST_PAD_IS_LINKED (gst_element_get_pad (element2, "src")));
gst_object_unref (GST_OBJECT (element2));
- gst_object_unref (GST_OBJECT (element));
}
- g_print ("create/link/destroy %d elements %ld\n", iters / 2,
+ g_print ("create/link/unref %d element duos: %ld\n", iters / 2,
vmsize () - usage1);
element = gst_element_factory_make ("fakesink", NULL);;
+ g_assert (GST_IS_ELEMENT (element));
pad = gst_element_get_pad (element, "sink");
+ g_assert (GST_IS_PAD (pad));
gst_element_remove_pad (element, pad);
g_assert (gst_element_get_pad (element, "sink") == NULL);
+ gst_object_unref (GST_OBJECT (element));
+
+ g_print ("pad removal on one element: %ld\n", vmsize () - usage1);
- g_print ("pad removal ok %ld\n", vmsize () - usage1);
for (i = 0; i < iters / 2; i++) {
element = gst_element_factory_make ("fakesink", NULL);;
+ g_assert (GST_IS_ELEMENT (element));
pad = gst_element_get_pad (element, "sink");
+ g_assert (GST_IS_PAD (pad));
gst_element_remove_pad (element, pad);
+ g_assert (gst_element_get_pad (element, "sink") == NULL);
gst_object_unref (GST_OBJECT (element));
}
- g_print ("pad removal loop %d %ld\n", iters / 2, vmsize () - usage1);
+ g_print ("pad removal loop on %d elements: %ld\n", iters / 2,
+ vmsize () - usage1);
for (i = 0; i < iters / 2; i++) {
element = gst_element_factory_make ("fakesink", NULL);;
+ g_assert (GST_IS_ELEMENT (element));
pad = gst_element_get_pad (element, "sink");
+ g_assert (GST_IS_PAD (pad));
gst_object_ref (GST_OBJECT (pad));
gst_element_remove_pad (element, pad);
g_assert (gst_pad_get_parent (pad) == NULL);
gst_object_unref (GST_OBJECT (pad));
gst_object_unref (GST_OBJECT (element));
}
- g_print ("pad removal and test loop %d %ld\n", iters / 2,
+ g_print ("pad ref/removal/test loop on %d elements: %ld\n", iters / 2,
vmsize () - usage1);
element = gst_element_factory_make ("fakesink", NULL);;
+ g_assert (GST_IS_ELEMENT (element));
pad = gst_element_get_pad (element, "sink");
- gst_object_unref (GST_OBJECT (element));
- g_assert (GST_OBJECT_DESTROYED (element));
- g_assert (gst_element_get_pad (element, "sink") == NULL);
+ g_assert (GST_IS_PAD (pad));
gst_object_unref (GST_OBJECT (element));
- g_print ("pad destroy/removal ok %ld\n", vmsize () - usage1);
+ g_print ("pad unref on one element: %ld\n", vmsize () - usage1);
for (i = 0; i < iters / 2; i++) {
- element = gst_element_factory_make ("fakesink", NULL);;
- pad = gst_element_get_pad (element, "sink");
- gst_object_unref (GST_OBJECT (element));
- gst_object_unref (GST_OBJECT (element));
- }
- g_print ("pad destroy/removal loop %d %ld\n", iters / 2, vmsize () - usage1);
-
- for (i = 0; i < iters / 2; i++) {
- element = gst_element_factory_make ("fakesink", NULL);;
+ element = gst_element_factory_make ("fakesink", NULL);
+ g_assert (GST_IS_ELEMENT (element));
pad = gst_element_get_pad (element, "sink");
- gst_object_unref (GST_OBJECT (pad));
- g_assert (gst_element_get_pad (element, "sink") == NULL);
+ g_assert (GST_IS_PAD (pad));
gst_object_unref (GST_OBJECT (element));
}
- g_print ("pad destroy loop %d %ld\n", iters / 2, vmsize () - usage1);
+ g_print ("pad unref loop on %d elements: %ld\n", iters / 2,
+ vmsize () - usage1);
g_print ("leaked: %ld\n", vmsize () - usage1);