index dc5ec1ba467f2653d5e4b79f898217cde40489c1..7f7e931ab1a49c50672ffef8ab02b50e1dfb031b 100644 (file)
fail_if (object == NULL, "Failed to create instance of GstFakeObject");
fail_unless (GST_IS_OBJECT (object),
"GstFakeObject instance is not a GstObject");
+ gst_object_unref (object);
}
GST_END_TEST
fail_if (name == NULL, "Newly created object has no name");
fail_if (strncmp (name, "fakeobject", 10) != 0,
"Random name %s does not start with Gst", name);
+ g_free (name);
/* give a random name by setting with NULL;
* GstFakeObject class -> fakeobject%d */
"Copy of object name affected actual object name");
g_free (name);
g_free (name2);
+
+ gst_object_unref (object);
}
GST_END_TEST
return NULL;
}
-/*
- * main thread sets and gets name while other threads set the name
- * constantly; fails because lock is released inbetween set and get
- */
-
+#if 0
GST_START_TEST (test_fake_object_name_threaded_wrong)
{
GstObject *object;
}
MAIN_STOP_THREADS ();
+ gst_object_unref (object);
+
fail_unless (expected_failure, "name did not get changed");
}
-GST_END_TEST
+GST_END_TEST;
+#endif
+
/*
* main thread sets and gets name directly on struct inside the object lock
* succeed because lock is held during set/get, and threads are locked out
g_free (name);
}
MAIN_STOP_THREADS ();
+ gst_object_unref (object);
}
GST_END_TEST
g_free (name1);
name1 = name2;
}
+ g_free (name1);
/* free stuff */
g_list_foreach (object_list, (GFunc) g_object_unref, NULL);
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_fake_object_new);
tcase_add_test (tc_chain, test_fake_object_name);
+#if 0
tcase_add_test (tc_chain, test_fake_object_name_threaded_wrong);
+#endif
tcase_add_test (tc_chain, test_fake_object_name_threaded_right);
tcase_add_test (tc_chain, test_fake_object_name_threaded_unique);
tcase_add_test (tc_chain, test_fake_object_parentage);
return s;
}
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = gst_object_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
+GST_CHECK_MAIN (gst_object);