aboutsummaryrefslogtreecommitdiff
path: root/t/12strpkey.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-10-09 23:47:24 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-10-09 23:47:24 +0200
commit5692f32bcfa049fc2b5555b5a883045b217349b9 (patch)
tree512eaa1bece48291ffdf7cf4865a085e6ee0b2cc /t/12strpkey.c
parent3465d5553fbe88a75320d1da3f7228619492b036 (diff)
downloadtermo-5692f32bcfa049fc2b5555b5a883045b217349b9.tar.gz
termo-5692f32bcfa049fc2b5555b5a883045b217349b9.tar.xz
termo-5692f32bcfa049fc2b5555b5a883045b217349b9.zip
CMake-ify, rename to termkey2 for the time being
Diffstat (limited to 't/12strpkey.c')
-rw-r--r--t/12strpkey.c157
1 files changed, 0 insertions, 157 deletions
diff --git a/t/12strpkey.c b/t/12strpkey.c
deleted file mode 100644
index f67b67a..0000000
--- a/t/12strpkey.c
+++ /dev/null
@@ -1,157 +0,0 @@
-#include "../termkey.h"
-#include "taplib.h"
-
-int
-main (int argc, char *argv[])
-{
- termkey_t *tk;
- termkey_key_t key;
- const char *endp;
-
-#define CLEAR_KEY do { key.type = -1; key.code.codepoint = -1; \
- key.modifiers = -1; key.multibyte[0] = 0; } while (0)
-
- plan_tests (62);
-
- tk = termkey_new_abstract ("vt100", NULL, 0);
-
- CLEAR_KEY;
- endp = termkey_strpkey (tk, "A", &key, 0);
- is_int (key.type, TERMKEY_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");
- is_str (key.multibyte, "A", "key.multibyte for unicode/A/0");
- is_str (endp, "", "consumed entire input for unicode/A/0");
-
- CLEAR_KEY;
- endp = termkey_strpkey (tk, "A and more", &key, 0);
- is_int (key.type, TERMKEY_TYPE_KEY,
- "key.type for unicode/A/0 trailing");
- is_int (key.code.codepoint, 'A',
- "key.code.codepoint for unicode/A/0 trailing");
- is_int (key.modifiers, 0, "key.modifiers for unicode/A/0 trailing");
- is_str (key.multibyte, "A", "key.multibyte for unicode/A/0 trailing");
- is_str (endp, " and more",
- "points at string tail for unicode/A/0 trailing");
-
- CLEAR_KEY;
- endp = termkey_strpkey (tk, "C-b", &key, 0);
- is_int (key.type, TERMKEY_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, TERMKEY_KEYMOD_CTRL,
- "key.modifiers for unicode/b/CTRL");
- is_str (key.multibyte, "b", "key.multibyte for unicode/b/CTRL");
- is_str (endp, "", "consumed entire input for unicode/b/CTRL");
-
- CLEAR_KEY;
- endp = termkey_strpkey (tk, "Ctrl-b", &key, TERMKEY_FORMAT_LONGMOD);
- is_int (key.type, TERMKEY_TYPE_KEY,
- "key.type for unicode/b/CTRL longmod");
- is_int (key.code.codepoint, 'b',
- "key.code.codepoint for unicode/b/CTRL longmod");
- is_int (key.modifiers, TERMKEY_KEYMOD_CTRL,
- "key.modifiers for unicode/b/CTRL longmod");
- is_str (key.multibyte, "b", "key.multibyte for unicode/b/CTRL longmod");
- is_str (endp, "", "consumed entire input for unicode/b/CTRL longmod");
-
- CLEAR_KEY;
- endp = termkey_strpkey (tk, "^B", &key, TERMKEY_FORMAT_CARETCTRL);
- is_int (key.type, TERMKEY_TYPE_KEY,
- "key.type for unicode/b/CTRL caretctrl");
- is_int (key.code.codepoint, 'b',
- "key.code.codepoint for unicode/b/CTRL caretctrl");
- is_int (key.modifiers, TERMKEY_KEYMOD_CTRL,
- "key.modifiers for unicode/b/CTRL caretctrl");
- is_str (key.multibyte, "b", "key.multibyte for unicode/b/CTRL caretctrl");
- is_str (endp, "", "consumed entire input for unicode/b/CTRL caretctrl");
-
- CLEAR_KEY;
- endp = termkey_strpkey (tk, "A-c", &key, 0);
- is_int (key.type, TERMKEY_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, TERMKEY_KEYMOD_ALT,
- "key.modifiers for unicode/c/ALT");
- is_str (key.multibyte, "c", "key.multibyte for unicode/c/ALT");
- is_str (endp, "", "consumed entire input for unicode/c/ALT");
-
- CLEAR_KEY;
- endp = termkey_strpkey (tk, "Alt-c", &key, TERMKEY_FORMAT_LONGMOD);
- is_int (key.type, TERMKEY_TYPE_KEY,
- "key.type for unicode/c/ALT longmod");
- is_int (key.code.codepoint, 'c',
- "key.code.codepoint for unicode/c/ALT longmod");
- is_int (key.modifiers, TERMKEY_KEYMOD_ALT,
- "key.modifiers for unicode/c/ALT longmod");
- is_str (key.multibyte, "c", "key.multibyte for unicode/c/ALT longmod");
- is_str (endp, "", "consumed entire input for unicode/c/ALT longmod");
-
- CLEAR_KEY;
- endp = termkey_strpkey (tk, "M-c", &key, TERMKEY_FORMAT_ALTISMETA);
- is_int (key.type, TERMKEY_TYPE_KEY,
- "key.type for unicode/c/ALT altismeta");
- is_int (key.code.codepoint, 'c',
- "key.code.codepoint for unicode/c/ALT altismeta");
- is_int (key.modifiers, TERMKEY_KEYMOD_ALT,
- "key.modifiers for unicode/c/ALT altismeta");
- is_str (key.multibyte, "c", "key.multibyte for unicode/c/ALT altismeta");
- is_str (endp, "", "consumed entire input for unicode/c/ALT altismeta");
-
- CLEAR_KEY;
- endp = termkey_strpkey (tk, "Meta-c", &key,
- TERMKEY_FORMAT_ALTISMETA | TERMKEY_FORMAT_LONGMOD);
- is_int (key.type, TERMKEY_TYPE_KEY,
- "key.type for unicode/c/ALT altismeta+longmod");
- is_int (key.code.codepoint, 'c',
- "key.code.codepoint for unicode/c/ALT altismeta+longmod");
- is_int (key.modifiers, TERMKEY_KEYMOD_ALT,
- "key.modifiers for unicode/c/ALT altismeta+longmod");
- is_str (key.multibyte, "c", "key.multibyte for unicode/c/ALT altismeta+longmod");
- is_str (endp, "",
- "consumed entire input for unicode/c/ALT altismeta+longmod");
-
- CLEAR_KEY;
- endp = termkey_strpkey (tk, "meta c", &key,
- TERMKEY_FORMAT_ALTISMETA | TERMKEY_FORMAT_LONGMOD
- | TERMKEY_FORMAT_SPACEMOD | TERMKEY_FORMAT_LOWERMOD);
- is_int (key.type, TERMKEY_TYPE_KEY,
- "key.type for unicode/c/ALT altismeta+long/space+lowermod");
- is_int (key.code.codepoint, 'c',
- "key.code.codepoint for unicode/c/ALT altismeta+long/space+lowermod");
- is_int (key.modifiers, TERMKEY_KEYMOD_ALT,
- "key.modifiers for unicode/c/ALT altismeta+long/space+lowermod");
- is_str (key.multibyte, "c",
- "key.multibyte for unicode/c/ALT altismeta+long/space_lowermod");
- is_str (endp, "",
- "consumed entire input for unicode/c/ALT altismeta+long/space+lowermod");
-
- CLEAR_KEY;
- endp = termkey_strpkey (tk, "ctrl alt page up", &key,
- TERMKEY_FORMAT_LONGMOD | TERMKEY_FORMAT_SPACEMOD
- | TERMKEY_FORMAT_LOWERMOD | TERMKEY_FORMAT_LOWERSPACE);
- is_int (key.type, TERMKEY_TYPE_KEYSYM,
- "key.type for sym/PageUp/CTRL+ALT long/space/lowermod+lowerspace");
- is_int (key.code.sym, TERMKEY_SYM_PAGEUP,
- "key.code.codepoint for sym/PageUp/CTRL+ALT long/space/lowermod+lowerspace");
- is_int (key.modifiers, TERMKEY_KEYMOD_ALT | TERMKEY_KEYMOD_CTRL,
- "key.modifiers for sym/PageUp/CTRL+ALT long/space/lowermod+lowerspace");
- is_str (endp, "",
- "consumed entire input for sym/PageUp/CTRL+ALT"
- " long/space/lowermod+lowerspace");
-
- CLEAR_KEY;
- endp = termkey_strpkey (tk, "Up", &key, 0);
- is_int (key.type, TERMKEY_TYPE_KEYSYM, "key.type for sym/Up/0");
- is_int (key.code.sym, TERMKEY_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 = termkey_strpkey (tk, "F5", &key, 0);
- is_int (key.type, TERMKEY_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");
- is_str (endp, "", "consumed entire input for func/5/0");
-
- termkey_destroy (tk);
- return exit_status ();
-}