2 * Keycode Map Generator C Tests
4 * Copyright 2017 Pierre Ossman for Cendio AB
6 * This file is dual license under the terms of the GPLv2 or later
7 * and 3-clause BSD licenses.
13 #include "osx2win32.h"
14 #include "osx2win32_name.h"
17 #include "osx2xkb_name.h"
19 #include "html2win32.h"
20 #include "html2win32_name.h"
25 #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
27 int main(int argc
, char** argv
)
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);
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);
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);
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);
56 assert(i
!= name_map_html_to_win32_len
);
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);