diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2014-03-05 01:11:45 +0000 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2014-03-05 01:11:45 +0000 |
commit | 8aa5b7acb59eb815bc32b17dc0335dc7fc129910 (patch) | |
tree | e356e6665d193eed4cc04a2e7afb1c1bc626bac3 | |
parent | 97e0e9cde26fd847f2dd434c2fd175cfce6b92ee (diff) | |
download | termo-8aa5b7acb59eb815bc32b17dc0335dc7fc129910.tar.gz termo-8aa5b7acb59eb815bc32b17dc0335dc7fc129910.tar.xz termo-8aa5b7acb59eb815bc32b17dc0335dc7fc129910.zip |
Unit tests should use .code.codepoint/.sym instead of not .code.number when appropriate
-rw-r--r-- | t/02getkey.c | 14 | ||||
-rw-r--r-- | t/03utf8.c | 58 | ||||
-rw-r--r-- | t/04flags.c | 12 | ||||
-rw-r--r-- | t/05read.c | 8 |
4 files changed, 46 insertions, 46 deletions
diff --git a/t/02getkey.c b/t/02getkey.c index 92779b4..279a598 100644 --- a/t/02getkey.c +++ b/t/02getkey.c @@ -20,10 +20,10 @@ int main(int argc, char *argv[]) is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY after h"); - is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type after h"); - is_int(key.code.number, 'h', "key.code.number after h"); - is_int(key.modifiers, 0, "key.modifiers after h"); - is_str(key.utf8, "h", "key.utf8 after h"); + is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type after h"); + is_int(key.code.codepoint, 'h', "key.code.codepoint after h"); + is_int(key.modifiers, 0, "key.modifiers after h"); + is_str(key.utf8, "h", "key.utf8 after h"); is_int(termkey_get_buffer_remaining(tk), 256, "buffer free 256 after getkey"); @@ -33,9 +33,9 @@ int main(int argc, char *argv[]) is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY after C-a"); - is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type after C-a"); - is_int(key.code.number, 'a', "key.code.number after C-a"); - is_int(key.modifiers, TERMKEY_KEYMOD_CTRL, "key.modifiers after C-a"); + is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type after C-a"); + is_int(key.code.codepoint, 'a', "key.code.codepoint after C-a"); + is_int(key.modifiers, TERMKEY_KEYMOD_CTRL, "key.modifiers after C-a"); termkey_push_bytes(tk, "\033OA", 3); @@ -13,8 +13,8 @@ int main(int argc, char *argv[]) termkey_push_bytes(tk, "a", 1); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY low ASCII"); - is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type low ASCII"); - is_int(key.code.number, 'a', "key.code.number low ASCII"); + is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type low ASCII"); + is_int(key.code.codepoint, 'a', "key.code.codepoint low ASCII"); /* 2-byte UTF-8 range is U+0080 to U+07FF (0xDF 0xBF) */ /* However, we'd best avoid the C1 range, so we'll start at U+00A0 (0xC2 0xA0) */ @@ -22,86 +22,86 @@ int main(int argc, char *argv[]) termkey_push_bytes(tk, "\xC2\xA0", 2); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 2 low"); - is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 2 low"); - is_int(key.code.number, 0x00A0, "key.code.number UTF-8 2 low"); + is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 2 low"); + is_int(key.code.codepoint, 0x00A0, "key.code.codepoint UTF-8 2 low"); termkey_push_bytes(tk, "\xDF\xBF", 2); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 2 high"); - is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 2 high"); - is_int(key.code.number, 0x07FF, "key.code.number UTF-8 2 high"); + is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 2 high"); + is_int(key.code.codepoint, 0x07FF, "key.code.codepoint UTF-8 2 high"); /* 3-byte UTF-8 range is U+0800 (0xE0 0xA0 0x80) to U+FFFD (0xEF 0xBF 0xBD) */ termkey_push_bytes(tk, "\xE0\xA0\x80", 3); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 3 low"); - is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 3 low"); - is_int(key.code.number, 0x0800, "key.code.number UTF-8 3 low"); + is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 3 low"); + is_int(key.code.codepoint, 0x0800, "key.code.codepoint UTF-8 3 low"); termkey_push_bytes(tk, "\xEF\xBF\xBD", 3); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 3 high"); - is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 3 high"); - is_int(key.code.number, 0xFFFD, "key.code.number UTF-8 3 high"); + is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 3 high"); + is_int(key.code.codepoint, 0xFFFD, "key.code.codepoint UTF-8 3 high"); /* 4-byte UTF-8 range is U+10000 (0xF0 0x90 0x80 0x80) to U+10FFFF (0xF4 0x8F 0xBF 0xBF) */ termkey_push_bytes(tk, "\xF0\x90\x80\x80", 4); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 4 low"); - is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 4 low"); - is_int(key.code.number, 0x10000, "key.code.number UTF-8 4 low"); + is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 4 low"); + is_int(key.code.codepoint, 0x10000, "key.code.codepoint UTF-8 4 low"); termkey_push_bytes(tk, "\xF4\x8F\xBF\xBF", 4); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 4 high"); - is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 4 high"); - is_int(key.code.number, 0x10FFFF, "key.code.number UTF-8 4 high"); + is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 4 high"); + is_int(key.code.codepoint, 0x10FFFF, "key.code.codepoint UTF-8 4 high"); /* Invalid continuations */ termkey_push_bytes(tk, "\xC2!", 2); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 2 invalid cont"); - is_int(key.code.number, 0xFFFD, "key.code.number UTF-8 2 invalid cont"); + is_int(key.code.codepoint, 0xFFFD, "key.code.codepoint UTF-8 2 invalid cont"); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 2 invalid after"); - is_int(key.code.number, '!', "key.code.number UTF-8 2 invalid after"); + is_int(key.code.codepoint, '!', "key.code.codepoint UTF-8 2 invalid after"); termkey_push_bytes(tk, "\xE0!", 2); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 3 invalid cont"); - is_int(key.code.number, 0xFFFD, "key.code.number UTF-8 3 invalid cont"); + is_int(key.code.codepoint, 0xFFFD, "key.code.codepoint UTF-8 3 invalid cont"); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 3 invalid after"); - is_int(key.code.number, '!', "key.code.number UTF-8 3 invalid after"); + is_int(key.code.codepoint, '!', "key.code.codepoint UTF-8 3 invalid after"); termkey_push_bytes(tk, "\xE0\xA0!", 3); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 3 invalid cont 2"); - is_int(key.code.number, 0xFFFD, "key.code.number UTF-8 3 invalid cont 2"); + is_int(key.code.codepoint, 0xFFFD, "key.code.codepoint UTF-8 3 invalid cont 2"); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 3 invalid after"); - is_int(key.code.number, '!', "key.code.number UTF-8 3 invalid after"); + is_int(key.code.codepoint, '!', "key.code.codepoint UTF-8 3 invalid after"); termkey_push_bytes(tk, "\xF0!", 2); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 4 invalid cont"); - is_int(key.code.number, 0xFFFD, "key.code.number UTF-8 4 invalid cont"); + is_int(key.code.codepoint, 0xFFFD, "key.code.codepoint UTF-8 4 invalid cont"); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 4 invalid after"); - is_int(key.code.number, '!', "key.code.number UTF-8 4 invalid after"); + is_int(key.code.codepoint, '!', "key.code.codepoint UTF-8 4 invalid after"); termkey_push_bytes(tk, "\xF0\x90!", 3); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 4 invalid cont 2"); - is_int(key.code.number, 0xFFFD, "key.code.number UTF-8 4 invalid cont 2"); + is_int(key.code.codepoint, 0xFFFD, "key.code.codepoint UTF-8 4 invalid cont 2"); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 4 invalid after"); - is_int(key.code.number, '!', "key.code.number UTF-8 4 invalid after"); + is_int(key.code.codepoint, '!', "key.code.codepoint UTF-8 4 invalid after"); termkey_push_bytes(tk, "\xF0\x90\x80!", 4); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 4 invalid cont 3"); - is_int(key.code.number, 0xFFFD, "key.code.number UTF-8 4 invalid cont 3"); + is_int(key.code.codepoint, 0xFFFD, "key.code.codepoint UTF-8 4 invalid cont 3"); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 4 invalid after"); - is_int(key.code.number, '!', "key.code.number UTF-8 4 invalid after"); + is_int(key.code.codepoint, '!', "key.code.codepoint UTF-8 4 invalid after"); /* Partials */ @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) termkey_push_bytes(tk, "\xA0", 1); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 2 partial"); - is_int(key.code.number, 0x00A0, "key.code.number UTF-8 2 partial"); + is_int(key.code.codepoint, 0x00A0, "key.code.codepoint UTF-8 2 partial"); termkey_push_bytes(tk, "\xE0", 1); is_int(termkey_getkey(tk, &key), TERMKEY_RES_AGAIN, "getkey yields RES_AGAIN UTF-8 3 partial"); @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) termkey_push_bytes(tk, "\x80", 1); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 3 partial"); - is_int(key.code.number, 0x0800, "key.code.number UTF-8 3 partial"); + is_int(key.code.codepoint, 0x0800, "key.code.codepoint UTF-8 3 partial"); termkey_push_bytes(tk, "\xF0", 1); is_int(termkey_getkey(tk, &key), TERMKEY_RES_AGAIN, "getkey yields RES_AGAIN UTF-8 4 partial"); @@ -133,7 +133,7 @@ int main(int argc, char *argv[]) termkey_push_bytes(tk, "\x80", 1); is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 4 partial"); - is_int(key.code.number, 0x10000, "key.code.number UTF-8 4 partial"); + is_int(key.code.codepoint, 0x10000, "key.code.codepoint UTF-8 4 partial"); termkey_destroy(tk); diff --git a/t/04flags.c b/t/04flags.c index 1c66c93..b81f7f7 100644 --- a/t/04flags.c +++ b/t/04flags.c @@ -15,9 +15,9 @@ int main(int argc, char *argv[]) is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY after space"); - is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type after space"); - is_int(key.code.number, ' ', "key.code.number after space"); - is_int(key.modifiers, 0, "key.modifiers after space"); + is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type after space"); + is_int(key.code.codepoint, ' ', "key.code.codepoint after space"); + is_int(key.modifiers, 0, "key.modifiers after space"); termkey_set_flags(tk, TERMKEY_FLAG_SPACESYMBOL); @@ -25,9 +25,9 @@ int main(int argc, char *argv[]) is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY after space"); - is_int(key.type, TERMKEY_TYPE_KEYSYM, "key.type after space with FLAG_SPACESYMBOL"); - is_int(key.code.number, TERMKEY_SYM_SPACE, "key.code.sym after space with FLAG_SPACESYMBOL"); - is_int(key.modifiers, 0, "key.modifiers after space with FLAG_SPACESYMBOL"); + is_int(key.type, TERMKEY_TYPE_KEYSYM, "key.type after space with FLAG_SPACESYMBOL"); + is_int(key.code.sym, TERMKEY_SYM_SPACE, "key.code.sym after space with FLAG_SPACESYMBOL"); + is_int(key.modifiers, 0, "key.modifiers after space with FLAG_SPACESYMBOL"); termkey_destroy(tk); @@ -34,10 +34,10 @@ int main(int argc, char *argv[]) is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY after h"); - is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type after h"); - is_int(key.code.number, 'h', "key.code.number after h"); - is_int(key.modifiers, 0, "key.modifiers after h"); - is_str(key.utf8, "h", "key.utf8 after h"); + is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type after h"); + is_int(key.code.codepoint, 'h', "key.code.codepoint after h"); + is_int(key.modifiers, 0, "key.modifiers after h"); + is_str(key.utf8, "h", "key.utf8 after h"); is_int(termkey_get_buffer_remaining(tk), 256, "buffer free 256 after getkey"); |