• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifdef HAVE_CONFIG_H
2 #include <config.h>
3 #endif
4 
5 #include <stdlib.h>
6 #include <stdio.h>
7 #include <assert.h>
8 
9 #include <check.h>
10 
11 #include <pulse/channelmap.h>
12 
START_TEST(channelmap_test)13 START_TEST (channelmap_test) {
14     char cm[PA_CHANNEL_MAP_SNPRINT_MAX];
15     pa_channel_map map, map2;
16 
17     pa_channel_map_init_auto(&map, 6, PA_CHANNEL_MAP_AIFF);
18 
19     fprintf(stderr, "map: <%s>\n", pa_channel_map_snprint(cm, sizeof(cm), &map));
20 
21     pa_channel_map_init_auto(&map, 6, PA_CHANNEL_MAP_AUX);
22 
23     fprintf(stderr, "map: <%s>\n", pa_channel_map_snprint(cm, sizeof(cm), &map));
24 
25     pa_channel_map_init_auto(&map, 6, PA_CHANNEL_MAP_ALSA);
26 
27     fprintf(stderr, "map: <%s>\n", pa_channel_map_snprint(cm, sizeof(cm), &map));
28 
29     pa_channel_map_init_extend(&map, 14, PA_CHANNEL_MAP_ALSA);
30 
31     fprintf(stderr, "map: <%s>\n", pa_channel_map_snprint(cm, sizeof(cm), &map));
32 
33     pa_channel_map_parse(&map2, cm);
34 
35     fail_unless(pa_channel_map_equal(&map, &map2));
36 
37     pa_channel_map_parse(&map2, "left,test");
38 }
39 END_TEST
40 
main(int argc,char * argv[])41 int main(int argc, char *argv[]) {
42     int failed = 0;
43     Suite *s;
44     TCase *tc;
45     SRunner *sr;
46 
47     s = suite_create("Channel Map");
48     tc = tcase_create("channelmap");
49     tcase_add_test(tc, channelmap_test);
50     suite_add_tcase(s, tc);
51 
52     sr = srunner_create(s);
53     srunner_run_all(sr, CK_NORMAL);
54     failed = srunner_ntests_failed(sr);
55     srunner_free(sr);
56 
57     return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
58 }
59