From 5692f32bcfa049fc2b5555b5a883045b217349b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Thu, 9 Oct 2014 23:47:24 +0200 Subject: CMake-ify, rename to termkey2 for the time being --- tests/39csi.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tests/39csi.c (limited to 'tests/39csi.c') diff --git a/tests/39csi.c b/tests/39csi.c new file mode 100644 index 0000000..32a15b0 --- /dev/null +++ b/tests/39csi.c @@ -0,0 +1,52 @@ +#include "../termkey.h" +#include "taplib.h" + +int +main (int argc, char *argv[]) +{ + termkey_t *tk; + termkey_key_t key; + long args[16]; + size_t nargs = 16; + unsigned long command; + + plan_tests (15); + + tk = termkey_new_abstract ("vt100", NULL, 0); + + termkey_push_bytes (tk, "\e[5;25v", 7); + + is_int (termkey_getkey (tk, &key), TERMKEY_RES_KEY, + "getkey yields RES_KEY for CSI v"); + + is_int (key.type, TERMKEY_TYPE_UNKNOWN_CSI, "key.type for unknown CSI"); + + is_int (termkey_interpret_csi (tk, &key, args, &nargs, &command), + TERMKEY_RES_KEY, "interpret_csi yields RES_KEY"); + + is_int (nargs, 2, "nargs for unknown CSI"); + is_int (args[0], 5, "args[0] for unknown CSI"); + is_int (args[1], 25, "args[1] for unknown CSI"); + is_int (command, 'v', "command for unknown CSI"); + + termkey_push_bytes (tk, "\e[?w", 4); + + is_int (termkey_getkey (tk, &key), TERMKEY_RES_KEY, + "getkey yields RES_KEY for CSI ? w"); + is_int (key.type, TERMKEY_TYPE_UNKNOWN_CSI, "key.type for unknown CSI"); + is_int (termkey_interpret_csi (tk, &key, args, &nargs, &command), + TERMKEY_RES_KEY, "interpret_csi yields RES_KEY"); + is_int (command, ('?' << 8) | 'w', "command for unknown CSI"); + + termkey_push_bytes (tk, "\e[?$x", 5); + + is_int (termkey_getkey (tk, &key), TERMKEY_RES_KEY, + "getkey yields RES_KEY for CSI ? $x"); + is_int (key.type, TERMKEY_TYPE_UNKNOWN_CSI, "key.type for unknown CSI"); + is_int (termkey_interpret_csi (tk, &key, args, &nargs, &command), + TERMKEY_RES_KEY, "interpret_csi yields RES_KEY"); + is_int (command, ('$' << 16) | ('?' << 8) | 'x', "command for unknown CSI"); + + termkey_destroy (tk); + return exit_status (); +} -- cgit v1.2.3