1 #include "../termkey.h"
2 #include "taplib.h"
3
main(int argc,char * argv[])4 int main(int argc, char *argv[])
5 {
6 TermKey *tk;
7 TermKeySym sym;
8 const char *end;
9
10 plan_tests(10);
11
12 tk = termkey_new_abstract("vt100", 0);
13
14 sym = termkey_keyname2sym(tk, "Space");
15 is_int(sym, TERMKEY_SYM_SPACE, "keyname2sym Space");
16
17 sym = termkey_keyname2sym(tk, "SomeUnknownKey");
18 is_int(sym, TERMKEY_SYM_UNKNOWN, "keyname2sym SomeUnknownKey");
19
20 end = termkey_lookup_keyname(tk, "Up", &sym);
21 ok(!!end, "termkey_get_keyname Up returns non-NULL");
22 is_str(end, "", "termkey_get_keyname Up return points at endofstring");
23 is_int(sym, TERMKEY_SYM_UP, "termkey_get_keyname Up yields Up symbol");
24
25 end = termkey_lookup_keyname(tk, "DownMore", &sym);
26 ok(!!end, "termkey_get_keyname DownMore returns non-NULL");
27 is_str(end, "More", "termkey_get_keyname DownMore return points at More");
28 is_int(sym, TERMKEY_SYM_DOWN, "termkey_get_keyname DownMore yields Down symbol");
29
30 end = termkey_lookup_keyname(tk, "SomeUnknownKey", &sym);
31 ok(!end, "termkey_get_keyname SomeUnknownKey returns NULL");
32
33 is_str(termkey_get_keyname(tk, TERMKEY_SYM_SPACE), "Space", "get_keyname SPACE");
34
35 termkey_destroy(tk);
36
37 return exit_status();
38 }
39