]> code.delx.au - pulseaudio/blob - src/tests/sig2str-test.c
sink-input, source-output: Add hooks for mute changes
[pulseaudio] / src / tests / sig2str-test.c
1 /***
2 This file is part of PulseAudio.
3
4 PulseAudio is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published
6 by the Free Software Foundation; either version 2.1 of the License,
7 or (at your option) any later version.
8
9 PulseAudio is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with PulseAudio; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17 USA.
18 ***/
19
20 #ifdef HAVE_CONFIG_H
21 #include <config.h>
22 #endif
23
24 #include <check.h>
25
26 #include <signal.h>
27 #include <stdio.h>
28
29 #include <pulsecore/macro.h>
30 #include <pulsecore/core-util.h>
31
32 static const char *names[] = {
33 "SIG-1",
34 "SIG0",
35 "SIGHUP",
36 "SIGINT",
37 "SIGQUIT",
38 "SIGULL",
39 "SIGTRAP",
40 "SIGABRT",
41 "SIGBUS",
42 "SIGFPE",
43 "SIGKILL",
44 "SIGUSR1",
45 "SIGSEGV",
46 "SIGUSR2",
47 "SIGPIPE",
48 "SIGALRM",
49 "SIGTERM",
50 "SIGSTKFLT",
51 "SIGCHLD",
52 "SIGCONT",
53 "SIGSTOP",
54 "SIGTSTP",
55 "SIGTTIN",
56 "SIGTTOU",
57 "SIGURG",
58 "SIGXCPU",
59 "SIGXFSZ",
60 "SIGVTALRM",
61 "SIGPROF",
62 "SIGWINCH",
63 "SIGIO",
64 "SIGPWR",
65 "SIGSYS",
66 "SIG32",
67 "SIG33",
68 "SIGRTMIN+0",
69 "SIGRTMIN+1",
70 "SIGRTMIN+2",
71 "SIGRTMIN+3",
72 "SIGRTMIN+4",
73 "SIGRTMIN+5",
74 "SIGRTMIN+6",
75 "SIGRTMIN+7",
76 "SIGRTMIN+8",
77 "SIGRTMIN+9",
78 "SIGRTMIN+10",
79 "SIGRTMIN+11",
80 "SIGRTMIN+12",
81 "SIGRTMIN+13",
82 "SIGRTMIN+14",
83 "SIGRTMIN+15",
84 "SIGRTMIN+16",
85 "SIGRTMIN+17",
86 "SIGRTMIN+18",
87 "SIGRTMIN+19",
88 "SIGRTMIN+20",
89 "SIGRTMIN+21",
90 "SIGRTMIN+22",
91 "SIGRTMIN+23",
92 "SIGRTMIN+24",
93 "SIGRTMIN+25",
94 "SIGRTMIN+26",
95 "SIGRTMIN+27",
96 "SIGRTMIN+28",
97 "SIGRTMIN+29",
98 "SIGRTMIN+30",
99 "SIG65"
100 };
101
102 START_TEST (sig2str_test) {
103 int sig;
104
105 for (sig = -1; sig <= NSIG; sig++) {
106 printf("%i = %s\n", sig, pa_sig2str(sig));
107 fail_unless(pa_streq(pa_sig2str(sig), names[sig+1]));
108 }
109 }
110 END_TEST
111
112 int main(int argc, char *argv[]) {
113 int failed = 0;
114 Suite *s;
115 TCase *tc;
116 SRunner *sr;
117
118 s = suite_create("Signal String");
119 tc = tcase_create("sig2str");
120 tcase_add_test(tc, sig2str_test);
121 suite_add_tcase(s, tc);
122
123 sr = srunner_create(s);
124 srunner_run_all(sr, CK_NORMAL);
125 failed = srunner_ntests_failed(sr);
126 srunner_free(sr);
127
128 return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
129 }