2014-10-14 00:24:47 +02:00
|
|
|
#include "../termo.h"
|
2011-03-31 14:43:16 +02:00
|
|
|
#include "taplib.h"
|
|
|
|
|
2014-09-28 05:56:13 +02:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
2011-03-31 14:43:16 +02:00
|
|
|
{
|
2023-08-01 03:05:55 +02:00
|
|
|
(void) argc;
|
|
|
|
(void) argv;
|
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
termo_t *tk;
|
|
|
|
termo_sym_t sym;
|
2014-09-28 05:56:13 +02:00
|
|
|
const char *end;
|
2011-03-31 14:43:16 +02:00
|
|
|
|
2014-09-28 05:56:13 +02:00
|
|
|
plan_tests (10);
|
2011-03-31 14:43:16 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
tk = termo_new_abstract ("vt100", NULL, 0);
|
2011-03-31 14:43:16 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
sym = termo_keyname2sym (tk, "Space");
|
|
|
|
is_int (sym, TERMO_SYM_SPACE, "keyname2sym Space");
|
2011-03-31 14:43:16 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
sym = termo_keyname2sym (tk, "SomeUnknownKey");
|
|
|
|
is_int (sym, TERMO_SYM_UNKNOWN, "keyname2sym SomeUnknownKey");
|
2011-03-31 14:43:16 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
end = termo_lookup_keyname (tk, "Up", &sym);
|
|
|
|
ok (!!end, "termo_get_keyname Up returns non-NULL");
|
|
|
|
is_str (end, "", "termo_get_keyname Up return points at endofstring");
|
|
|
|
is_int (sym, TERMO_SYM_UP, "termo_get_keyname Up yields Up symbol");
|
2011-04-01 14:26:54 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
end = termo_lookup_keyname (tk, "DownMore", &sym);
|
|
|
|
ok (!!end, "termo_get_keyname DownMore returns non-NULL");
|
|
|
|
is_str (end, "More", "termo_get_keyname DownMore return points at More");
|
|
|
|
is_int (sym, TERMO_SYM_DOWN,
|
|
|
|
"termo_get_keyname DownMore yields Down symbol");
|
2011-04-01 14:26:54 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
end = termo_lookup_keyname (tk, "SomeUnknownKey", &sym);
|
|
|
|
ok (!end, "termo_get_keyname SomeUnknownKey returns NULL");
|
2011-04-01 14:26:54 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
is_str (termo_get_keyname (tk, TERMO_SYM_SPACE), "Space",
|
2014-09-28 05:56:13 +02:00
|
|
|
"get_keyname SPACE");
|
2011-03-31 14:43:16 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
termo_destroy (tk);
|
2014-09-28 05:56:13 +02:00
|
|
|
return exit_status ();
|
2011-03-31 14:43:16 +02:00
|
|
|
}
|