]> git.sesse.net Git - vlc/blob - src/control/testapi.c
Make sure assert are built-in
[vlc] / src / control / testapi.c
1 /*
2  * testapi.c - libvlc-control smoke test
3  *
4  * $Id$
5  */
6
7 /**********************************************************************
8  *  Copyright (C) 2007 RĂ©mi Denis-Courmont.                           *
9  *  This program is free software; you can redistribute and/or modify *
10  *  it under the terms of the GNU General Public License as published *
11  *  by the Free Software Foundation; version 2 of the license, or (at *
12  *  your option) any later version.                                   *
13  *                                                                    *
14  *  This program is distributed in the hope that it will be useful,   *
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of    *
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.              *
17  *  See the GNU General Public License for more details.              *
18  *                                                                    *
19  *  You should have received a copy of the GNU General Public License *
20  *  along with this program; if not, you can get it from:             *
21  *  http://www.gnu.org/copyleft/gpl.html                              *
22  **********************************************************************/
23
24 #include <vlc/mediacontrol.h>
25
26 #undef NDEBUG
27 #include <assert.h>
28
29 int main (int argc, char *argv[])
30 {
31     mediacontrol_Exception ex;
32     mediacontrol_Instance *mc, *mc2;
33     libvlc_instance_t *vlc;
34
35     mediacontrol_exception_init (&ex);
36     mc = mediacontrol_new (argc, argv, &ex);
37     assert (mc);
38     assert (!ex.code);
39     mediacontrol_exception_cleanup (&ex);
40
41     /* Duplication test */
42     vlc = mediacontrol_get_libvlc_instance (mc);
43     assert (vlc);
44     assert (!ex.code);
45
46     mediacontrol_exception_init (&ex);
47     mc2 = mediacontrol_new_from_instance (vlc, &ex);
48     assert (mc2);
49     assert (!ex.code);
50     mediacontrol_exception_cleanup (&ex);
51
52     //mediacontrol_exit (mc2);
53
54     /* Input tests */
55     mediacontrol_exception_init (&ex);
56     mediacontrol_resume (mc, NULL, &ex);
57     assert (ex.code); /* should fail: we have no input */
58     mediacontrol_exception_cleanup (&ex);
59
60     mediacontrol_exception_init (&ex);
61     mediacontrol_pause (mc, NULL, &ex);
62     assert (ex.code); /* should fail: we have no input */
63     mediacontrol_exception_cleanup (&ex);
64
65     mediacontrol_exception_init (&ex);
66     mediacontrol_stop (mc, NULL, &ex);
67     mediacontrol_exception_cleanup (&ex);
68
69     /* Playlist tests */
70     mediacontrol_exception_init (&ex);
71     mediacontrol_playlist_clear (mc, &ex);
72     assert (!ex.code);
73     mediacontrol_exception_cleanup (&ex);
74
75     mediacontrol_exception_init (&ex);
76     mediacontrol_playlist_add_item (mc, "/dev/null", &ex);
77     mediacontrol_exception_cleanup (&ex);
78
79     mediacontrol_exception_init (&ex);
80     mediacontrol_playlist_clear (mc, &ex);
81     assert (!ex.code);
82     mediacontrol_exception_cleanup (&ex);
83
84     mediacontrol_exit (mc);
85     return 0;
86 }