]> git.proxmox.com Git - pve-qemu.git/blob - keycodemapdb/tests/stdc.c
bump version to 2.11.1-1
[pve-qemu.git] / keycodemapdb / tests / stdc.c
1 /*
2 * Keycode Map Generator C Tests
3 *
4 * Copyright 2017 Pierre Ossman for Cendio AB
5 *
6 * This file is dual license under the terms of the GPLv2 or later
7 * and 3-clause BSD licenses.
8 */
9
10 #include <assert.h>
11 #include <string.h>
12
13 #include "osx2win32.h"
14 #include "osx2win32_name.h"
15
16 #include "osx2xkb.h"
17 #include "osx2xkb_name.h"
18
19 #include "html2win32.h"
20 #include "html2win32_name.h"
21
22 #include "osx.h"
23 #include "osx_name.h"
24
25 #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
26
27 int main(int argc, char** argv)
28 {
29 unsigned i;
30
31 assert(code_map_osx_to_win32_len == ARRAY_SIZE(code_map_osx_to_win32));
32 assert(code_map_osx_to_win32[0x1d] == 0x30);
33 assert(name_map_osx_to_win32_len == ARRAY_SIZE(name_map_osx_to_win32));
34 assert(strcmp(name_map_osx_to_win32[0x1d], "VK_0") == 0);
35
36 assert(code_map_osx_to_xkb_len == ARRAY_SIZE(code_map_osx_to_xkb));
37 assert(strcmp(code_map_osx_to_xkb[0x1d], "AE10") == 0);
38 assert(name_map_osx_to_xkb_len == ARRAY_SIZE(name_map_osx_to_xkb));
39 assert(strcmp(name_map_osx_to_xkb[0x1d], "AE10") == 0);
40
41 assert(code_map_html_to_win32_len == ARRAY_SIZE(code_map_html_to_win32));
42 for (i = 0;i < code_map_html_to_win32_len;i++) {
43 if (strcmp(code_map_html_to_win32[i].from, "ControlLeft") == 0) {
44 assert(code_map_html_to_win32[i].to == 0x11);
45 break;
46 }
47 }
48 assert(i != code_map_html_to_win32_len);
49 assert(name_map_html_to_win32_len == ARRAY_SIZE(name_map_html_to_win32));
50 for (i = 0;i < name_map_html_to_win32_len;i++) {
51 if (strcmp(name_map_html_to_win32[i].from, "ControlLeft") == 0) {
52 assert(strcmp(name_map_html_to_win32[i].to, "VK_CONTROL") == 0);
53 break;
54 }
55 }
56 assert(i != name_map_html_to_win32_len);
57
58 assert(code_table_osx_len == ARRAY_SIZE(code_table_osx));
59 assert(code_table_osx[0x1d] == 0x3b);
60 assert(name_table_osx_len == ARRAY_SIZE(name_table_osx));
61 assert(strcmp(name_table_osx[0x1d], "Control") == 0);
62
63 return 0;
64 }