diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2016-10-04 13:22:52 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2016-10-04 13:22:52 +0200 |
commit | 258691135f3df9604e00cf35c3add81412b83241 (patch) | |
tree | ce9af08f72697caf8830fc5a759b53e59fd00c8a /tests | |
parent | f7c67b2a2eeaa0d62c4473751e2d062b2b082cc8 (diff) | |
download | termo-258691135f3df9604e00cf35c3add81412b83241.tar.gz termo-258691135f3df9604e00cf35c3add81412b83241.tar.xz termo-258691135f3df9604e00cf35c3add81412b83241.zip |
Use termo_str{f,p}key_utf8 in tests
No need to be locale dependent here.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/11strfkey.c | 46 | ||||
-rw-r--r-- | tests/12strpkey.c | 26 | ||||
-rw-r--r-- | tests/20canon.c | 12 | ||||
-rw-r--r-- | tests/30mouse.c | 6 |
4 files changed, 45 insertions, 45 deletions
diff --git a/tests/11strfkey.c b/tests/11strfkey.c index 41f0273..647d92c 100644 --- a/tests/11strfkey.c +++ b/tests/11strfkey.c @@ -18,11 +18,11 @@ main (int argc, char *argv[]) key.modifiers = 0; key.multibyte[0] = 0; - len = termo_strfkey (tk, buffer, sizeof buffer, &key, 0); + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, 0); is_int (len, 1, "length for unicode/A/0"); is_str (buffer, "A", "buffer for unicode/A/0"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_WRAPBRACKET); is_int (len, 1, "length for unicode/A/0 wrapbracket"); is_str (buffer, "A", "buffer for unicode/A/0 wrapbracket"); @@ -32,38 +32,38 @@ main (int argc, char *argv[]) key.modifiers = TERMO_KEYMOD_CTRL; key.multibyte[0] = 0; - len = termo_strfkey (tk, buffer, sizeof buffer, &key, 0); + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, 0); is_int (len, 3, "length for unicode/b/CTRL"); is_str (buffer, "C-b", "buffer for unicode/b/CTRL"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_LONGMOD); is_int (len, 6, "length for unicode/b/CTRL longmod"); is_str (buffer, "Ctrl-b", "buffer for unicode/b/CTRL longmod"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_LONGMOD | TERMO_FORMAT_SPACEMOD); is_int (len, 6, "length for unicode/b/CTRL longmod|spacemod"); is_str (buffer, "Ctrl b", "buffer for unicode/b/CTRL longmod|spacemod"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_LONGMOD | TERMO_FORMAT_LOWERMOD); is_int (len, 6, "length for unicode/b/CTRL longmod|lowermod"); is_str (buffer, "ctrl-b", "buffer for unicode/b/CTRL longmod|lowermod"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_LONGMOD | TERMO_FORMAT_SPACEMOD | TERMO_FORMAT_LOWERMOD); is_int (len, 6, "length for unicode/b/CTRL longmod|spacemod|lowermode"); is_str (buffer, "ctrl b", "buffer for unicode/b/CTRL longmod|spacemod|lowermode"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_CARETCTRL); is_int (len, 2, "length for unicode/b/CTRL caretctrl"); is_str (buffer, "^B", "buffer for unicode/b/CTRL caretctrl"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_WRAPBRACKET); is_int (len, 5, "length for unicode/b/CTRL wrapbracket"); is_str (buffer, "<C-b>", "buffer for unicode/b/CTRL wrapbracket"); @@ -73,21 +73,21 @@ main (int argc, char *argv[]) key.modifiers = TERMO_KEYMOD_ALT; key.multibyte[0] = 0; - len = termo_strfkey (tk, buffer, sizeof buffer, &key, 0); + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, 0); is_int (len, 3, "length for unicode/c/ALT"); is_str (buffer, "A-c", "buffer for unicode/c/ALT"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_LONGMOD); is_int (len, 5, "length for unicode/c/ALT longmod"); is_str (buffer, "Alt-c", "buffer for unicode/c/ALT longmod"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_ALTISMETA); is_int (len, 3, "length for unicode/c/ALT altismeta"); is_str (buffer, "M-c", "buffer for unicode/c/ALT altismeta"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_LONGMOD|TERMO_FORMAT_ALTISMETA); is_int (len, 6, "length for unicode/c/ALT longmod|altismeta"); is_str (buffer, "Meta-c", "buffer for unicode/c/ALT longmod|altismeta"); @@ -96,11 +96,11 @@ main (int argc, char *argv[]) key.code.sym = TERMO_SYM_UP; key.modifiers = 0; - len = termo_strfkey (tk, buffer, sizeof buffer, &key, 0); + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, 0); is_int (len, 2, "length for sym/Up/0"); is_str (buffer, "Up", "buffer for sym/Up/0"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_WRAPBRACKET); is_int (len, 4, "length for sym/Up/0 wrapbracket"); is_str (buffer, "<Up>", "buffer for sym/Up/0 wrapbracket"); @@ -109,22 +109,22 @@ main (int argc, char *argv[]) key.code.sym = TERMO_SYM_PAGEUP; key.modifiers = 0; - len = termo_strfkey (tk, buffer, sizeof buffer, &key, 0); + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, 0); is_int (len, 6, "length for sym/PageUp/0"); is_str (buffer, "PageUp", "buffer for sym/PageUp/0"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_LOWERSPACE); is_int (len, 7, "length for sym/PageUp/0 lowerspace"); is_str (buffer, "page up", "buffer for sym/PageUp/0 lowerspace"); // If size of buffer is too small, - // strfkey should return something consistent - len = termo_strfkey (tk, buffer, 4, &key, 0); + // strfkey_utf8 should return something consistent + len = termo_strfkey_utf8 (tk, buffer, 4, &key, 0); is_int (len, 6, "length for sym/PageUp/0"); is_str (buffer, "Pag", "buffer of len 4 for sym/PageUp/0"); - len = termo_strfkey (tk, buffer, 4, &key, TERMO_FORMAT_LOWERSPACE); + len = termo_strfkey_utf8 (tk, buffer, 4, &key, TERMO_FORMAT_LOWERSPACE); is_int (len, 7, "length for sym/PageUp/0 lowerspace"); is_str (buffer, "pag", "buffer of len 4 for sym/PageUp/0 lowerspace"); @@ -132,16 +132,16 @@ main (int argc, char *argv[]) key.code.number = 5; key.modifiers = 0; - len = termo_strfkey (tk, buffer, sizeof buffer, &key, 0); + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, 0); is_int (len, 2, "length for func/5/0"); is_str (buffer, "F5", "buffer for func/5/0"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_WRAPBRACKET); is_int (len, 4, "length for func/5/0 wrapbracket"); is_str (buffer, "<F5>", "buffer for func/5/0 wrapbracket"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_LOWERSPACE); is_int (len, 2, "length for func/5/0 lowerspace"); is_str (buffer, "f5", "buffer for func/5/0 lowerspace"); diff --git a/tests/12strpkey.c b/tests/12strpkey.c index d21a547..96f1d31 100644 --- a/tests/12strpkey.c +++ b/tests/12strpkey.c @@ -16,7 +16,7 @@ main (int argc, char *argv[]) tk = termo_new_abstract ("vt100", NULL, 0); CLEAR_KEY; - endp = termo_strpkey (tk, "A", &key, 0); + endp = termo_strpkey_utf8 (tk, "A", &key, 0); is_int (key.type, TERMO_TYPE_KEY, "key.type for unicode/A/0"); is_int (key.code.codepoint, 'A', "key.code.codepoint for unicode/A/0"); is_int (key.modifiers, 0, "key.modifiers for unicode/A/0"); @@ -24,7 +24,7 @@ main (int argc, char *argv[]) is_str (endp, "", "consumed entire input for unicode/A/0"); CLEAR_KEY; - endp = termo_strpkey (tk, "A and more", &key, 0); + endp = termo_strpkey_utf8 (tk, "A and more", &key, 0); is_int (key.type, TERMO_TYPE_KEY, "key.type for unicode/A/0 trailing"); is_int (key.code.codepoint, 'A', @@ -35,7 +35,7 @@ main (int argc, char *argv[]) "points at string tail for unicode/A/0 trailing"); CLEAR_KEY; - endp = termo_strpkey (tk, "C-b", &key, 0); + endp = termo_strpkey_utf8 (tk, "C-b", &key, 0); is_int (key.type, TERMO_TYPE_KEY, "key.type for unicode/b/CTRL"); is_int (key.code.codepoint, 'b', "key.code.codepoint for unicode/b/CTRL"); is_int (key.modifiers, TERMO_KEYMOD_CTRL, @@ -44,7 +44,7 @@ main (int argc, char *argv[]) is_str (endp, "", "consumed entire input for unicode/b/CTRL"); CLEAR_KEY; - endp = termo_strpkey (tk, "Ctrl-b", &key, TERMO_FORMAT_LONGMOD); + endp = termo_strpkey_utf8 (tk, "Ctrl-b", &key, TERMO_FORMAT_LONGMOD); is_int (key.type, TERMO_TYPE_KEY, "key.type for unicode/b/CTRL longmod"); is_int (key.code.codepoint, 'b', @@ -55,7 +55,7 @@ main (int argc, char *argv[]) is_str (endp, "", "consumed entire input for unicode/b/CTRL longmod"); CLEAR_KEY; - endp = termo_strpkey (tk, "^B", &key, TERMO_FORMAT_CARETCTRL); + endp = termo_strpkey_utf8 (tk, "^B", &key, TERMO_FORMAT_CARETCTRL); is_int (key.type, TERMO_TYPE_KEY, "key.type for unicode/b/CTRL caretctrl"); is_int (key.code.codepoint, 'b', @@ -66,7 +66,7 @@ main (int argc, char *argv[]) is_str (endp, "", "consumed entire input for unicode/b/CTRL caretctrl"); CLEAR_KEY; - endp = termo_strpkey (tk, "A-c", &key, 0); + endp = termo_strpkey_utf8 (tk, "A-c", &key, 0); is_int (key.type, TERMO_TYPE_KEY, "key.type for unicode/c/ALT"); is_int (key.code.codepoint, 'c', "key.code.codepoint for unicode/c/ALT"); is_int (key.modifiers, TERMO_KEYMOD_ALT, @@ -75,7 +75,7 @@ main (int argc, char *argv[]) is_str (endp, "", "consumed entire input for unicode/c/ALT"); CLEAR_KEY; - endp = termo_strpkey (tk, "Alt-c", &key, TERMO_FORMAT_LONGMOD); + endp = termo_strpkey_utf8 (tk, "Alt-c", &key, TERMO_FORMAT_LONGMOD); is_int (key.type, TERMO_TYPE_KEY, "key.type for unicode/c/ALT longmod"); is_int (key.code.codepoint, 'c', @@ -86,7 +86,7 @@ main (int argc, char *argv[]) is_str (endp, "", "consumed entire input for unicode/c/ALT longmod"); CLEAR_KEY; - endp = termo_strpkey (tk, "M-c", &key, TERMO_FORMAT_ALTISMETA); + endp = termo_strpkey_utf8 (tk, "M-c", &key, TERMO_FORMAT_ALTISMETA); is_int (key.type, TERMO_TYPE_KEY, "key.type for unicode/c/ALT altismeta"); is_int (key.code.codepoint, 'c', @@ -97,7 +97,7 @@ main (int argc, char *argv[]) is_str (endp, "", "consumed entire input for unicode/c/ALT altismeta"); CLEAR_KEY; - endp = termo_strpkey (tk, "Meta-c", &key, + endp = termo_strpkey_utf8 (tk, "Meta-c", &key, TERMO_FORMAT_ALTISMETA | TERMO_FORMAT_LONGMOD); is_int (key.type, TERMO_TYPE_KEY, "key.type for unicode/c/ALT altismeta+longmod"); @@ -110,7 +110,7 @@ main (int argc, char *argv[]) "consumed entire input for unicode/c/ALT altismeta+longmod"); CLEAR_KEY; - endp = termo_strpkey (tk, "meta c", &key, + endp = termo_strpkey_utf8 (tk, "meta c", &key, TERMO_FORMAT_ALTISMETA | TERMO_FORMAT_LONGMOD | TERMO_FORMAT_SPACEMOD | TERMO_FORMAT_LOWERMOD); is_int (key.type, TERMO_TYPE_KEY, @@ -125,7 +125,7 @@ main (int argc, char *argv[]) "consumed entire input for unicode/c/ALT altismeta+long/space+lowermod"); CLEAR_KEY; - endp = termo_strpkey (tk, "ctrl alt page up", &key, + endp = termo_strpkey_utf8 (tk, "ctrl alt page up", &key, TERMO_FORMAT_LONGMOD | TERMO_FORMAT_SPACEMOD | TERMO_FORMAT_LOWERMOD | TERMO_FORMAT_LOWERSPACE); is_int (key.type, TERMO_TYPE_KEYSYM, @@ -139,14 +139,14 @@ main (int argc, char *argv[]) " long/space/lowermod+lowerspace"); CLEAR_KEY; - endp = termo_strpkey (tk, "Up", &key, 0); + endp = termo_strpkey_utf8 (tk, "Up", &key, 0); is_int (key.type, TERMO_TYPE_KEYSYM, "key.type for sym/Up/0"); is_int (key.code.sym, TERMO_SYM_UP, "key.code.codepoint for sym/Up/0"); is_int (key.modifiers, 0, "key.modifiers for sym/Up/0"); is_str (endp, "", "consumed entire input for sym/Up/0"); CLEAR_KEY; - endp = termo_strpkey (tk, "F5", &key, 0); + endp = termo_strpkey_utf8 (tk, "F5", &key, 0); is_int (key.type, TERMO_TYPE_FUNCTION, "key.type for func/5/0"); is_int (key.code.number, 5, "key.code.number for func/5/0"); is_int (key.modifiers, 0, "key.modifiers for func/5/0"); diff --git a/tests/20canon.c b/tests/20canon.c index f6d6317..76ee049 100644 --- a/tests/20canon.c +++ b/tests/20canon.c @@ -16,7 +16,7 @@ main (int argc, char *argv[]) tk = termo_new_abstract ("vt100", NULL, 0); CLEAR_KEY; - endp = termo_strpkey (tk, " ", &key, 0); + endp = termo_strpkey_utf8 (tk, " ", &key, 0); is_int (key.type, TERMO_TYPE_KEY, "key.type for SP/unicode"); is_int (key.code.codepoint, ' ', "key.code.codepoint for SP/unicode"); is_int (key.modifiers, 0, "key.modifiers for SP/unicode"); @@ -24,7 +24,7 @@ main (int argc, char *argv[]) is_str (endp, "", "consumed entire input for SP/unicode"); CLEAR_KEY; - endp = termo_strpkey (tk, "Space", &key, 0); + endp = termo_strpkey_utf8 (tk, "Space", &key, 0); is_int (key.type, TERMO_TYPE_KEY, "key.type for Space/unicode"); is_int (key.code.codepoint, ' ', "key.code.codepoint for Space/unicode"); is_int (key.modifiers, 0, "key.modifiers for Space/unicode"); @@ -35,7 +35,7 @@ main (int argc, char *argv[]) termo_get_canonflags (tk) | TERMO_CANON_SPACESYMBOL); CLEAR_KEY; - endp = termo_strpkey (tk, " ", &key, 0); + endp = termo_strpkey_utf8 (tk, " ", &key, 0); is_int (key.type, TERMO_TYPE_KEYSYM, "key.type for SP/symbol"); is_int (key.code.sym, TERMO_SYM_SPACE, "key.code.codepoint for SP/symbol"); @@ -43,7 +43,7 @@ main (int argc, char *argv[]) is_str (endp, "", "consumed entire input for SP/symbol"); CLEAR_KEY; - endp = termo_strpkey (tk, "Space", &key, 0); + endp = termo_strpkey_utf8 (tk, "Space", &key, 0); is_int (key.type, TERMO_TYPE_KEYSYM, "key.type for Space/symbol"); is_int (key.code.sym, TERMO_SYM_SPACE, "key.code.codepoint for Space/symbol"); @@ -51,7 +51,7 @@ main (int argc, char *argv[]) is_str (endp, "", "consumed entire input for Space/symbol"); CLEAR_KEY; - endp = termo_strpkey (tk, "DEL", &key, 0); + endp = termo_strpkey_utf8 (tk, "DEL", &key, 0); is_int (key.type, TERMO_TYPE_KEYSYM, "key.type for Del/unconverted"); is_int (key.code.sym, TERMO_SYM_DEL, "key.code.codepoint for Del/unconverted"); @@ -62,7 +62,7 @@ main (int argc, char *argv[]) termo_get_canonflags (tk) | TERMO_CANON_DELBS); CLEAR_KEY; - endp = termo_strpkey (tk, "DEL", &key, 0); + endp = termo_strpkey_utf8 (tk, "DEL", &key, 0); is_int (key.type, TERMO_TYPE_KEYSYM, "key.type for Del/as-backspace"); is_int (key.code.sym, TERMO_SYM_BACKSPACE, "key.code.codepoint for Del/as-backspace"); diff --git a/tests/30mouse.c b/tests/30mouse.c index fba9ba1..62cfddc 100644 --- a/tests/30mouse.c +++ b/tests/30mouse.c @@ -33,11 +33,11 @@ main (int argc, char *argv[]) is_int (col, 0, "mouse column for press"); is_int (key.modifiers, 0, "modifiers for press"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, 0); + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, 0); is_int (len, 13, "string length for press"); is_str (buffer, "MousePress(1)", "string buffer for press"); - len = termo_strfkey (tk, buffer, sizeof buffer, + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, TERMO_FORMAT_MOUSE_POS); is_int (len, 21, "string length for press"); is_str (buffer, "MousePress(1) @ (0,0)", "string buffer for press"); @@ -83,7 +83,7 @@ main (int argc, char *argv[]) is_int (col, 10, "mouse column for Ctrl-press"); is_int (key.modifiers, TERMO_KEYMOD_CTRL, "modifiers for Ctrl-press"); - len = termo_strfkey (tk, buffer, sizeof buffer, &key, 0); + len = termo_strfkey_utf8 (tk, buffer, sizeof buffer, &key, 0); is_int (len, 15, "string length for Ctrl-press"); is_str (buffer, "C-MousePress(1)", "string buffer for Ctrl-press"); |