993c6330c8a651248d5e2d01ddf544c7278b0624
[platform/upstream/gstreamer.git] / tests / check / gst / gst.c
1 /* GStreamer
2  * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org>
3  *
4  * gst.c: Unit test for gst.c
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #include <gst/check/gstcheck.h>
23
24 GST_START_TEST (test_init)
25 {
26   /* don't segfault with NULL, NULL */
27   gst_init (NULL, NULL);
28   /* allow calling twice */
29   gst_init (NULL, NULL);
30 }
31
32 GST_END_TEST;
33
34 GST_START_TEST (test_deinit)
35 {
36   gst_init (NULL, NULL);
37
38   gst_deinit ();
39 }
40
41 GST_END_TEST;
42
43 GST_START_TEST (test_deinit_sysclock)
44 {
45   GstClock *clock;
46
47   gst_init (NULL, NULL);
48
49   clock = gst_system_clock_obtain ();
50   gst_object_unref (clock);
51
52   gst_deinit ();
53 }
54
55 GST_END_TEST;
56
57
58 Suite *
59 gst_suite (void)
60 {
61   Suite *s = suite_create ("Gst");
62   TCase *tc_chain = tcase_create ("gst tests");
63
64   suite_add_tcase (s, tc_chain);
65   tcase_add_test (tc_chain, test_init);
66   tcase_add_test (tc_chain, test_deinit);
67   tcase_add_test (tc_chain, test_deinit_sysclock);
68
69   return s;
70 }
71
72 int
73 main (int argc, char **argv)
74 {
75   int nf;
76
77   Suite *s = gst_suite ();
78   SRunner *sr = srunner_create (s);
79
80   gst_check_init (&argc, &argv);
81
82   srunner_run_all (sr, CK_NORMAL);
83   nf = srunner_ntests_failed (sr);
84   srunner_free (sr);
85
86   return nf;
87 }