Run source tree through uncrustify
[platform/upstream/libxkbcommon.git] / test / stringcomp.c
1 /* Copyright 2009 Dan Nicholson
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a
4  * copy of this software and associated documentation files (the "Software"),
5  * to deal in the Software without restriction, including without limitation
6  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7  * and/or sell copies of the Software, and to permit persons to whom the
8  * Software is furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16  * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
17  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19  *
20  * Except as contained in this notice, the names of the authors or their
21  * institutions shall not be used in advertising or otherwise to promote the
22  * sale, use or other dealings in this Software without prior written
23  * authorization from the authors.
24  */
25
26 #include <assert.h>
27 #include <fcntl.h>
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <string.h>
31 #include <unistd.h>
32 #include <sys/stat.h>
33 #include <sys/types.h>
34
35 #include "xkbcommon/xkbcommon.h"
36 #include "test.h"
37
38 int
39 main(int argc, char *argv[])
40 {
41     struct xkb_context *ctx = test_get_context();
42     struct xkb_keymap *keymap;
43     char *as_string;
44
45     assert(ctx);
46
47     as_string = test_read_file("keymaps/stringcomp.data");
48     assert(as_string);
49
50     keymap = test_compile_string(ctx, as_string);
51     assert(keymap);
52     free(as_string);
53     xkb_map_unref(keymap);
54
55     keymap = test_compile_string(ctx, "");
56     assert(!keymap);
57
58     xkb_context_unref(ctx);
59
60     return 0;
61 }