aboutsummaryrefslogtreecommitdiffstats
path: root/test.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-04-10 22:03:29 +0200
committerMattias Andrée <maandree@kth.se>2021-04-10 22:03:29 +0200
commit4dfd8b7b3a1b7c1bab141a3e503bed77b2198aa0 (patch)
tree19a9f2ff9706a0b3339b64875fe0e7b6fa808a2d /test.c
parentAdd final tests for mouse tracking (diff)
downloadlibterminput-4dfd8b7b3a1b7c1bab141a3e503bed77b2198aa0.tar.gz
libterminput-4dfd8b7b3a1b7c1bab141a3e503bed77b2198aa0.tar.bz2
libterminput-4dfd8b7b3a1b7c1bab141a3e503bed77b2198aa0.tar.xz
Add last test
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'test.c')
-rw-r--r--test.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test.c b/test.c
index bac8f8b..c801d39 100644
--- a/test.c
+++ b/test.c
@@ -286,6 +286,26 @@ main(void)
TEST(input.keypress.mods == (MODS));\
TEST(input.keypress.times == times__);\
}\
+ if (buffer[0] && buffer[1]) {\
+ size_t i__;\
+ for (i__ = 0; buffer[i__ + 1]; i__++) {\
+ TEST(write(fds[1], &buffer[i__], 1) == 1);\
+ TEST(libterminput_read(fds[0], &input, &ctx) == 1);\
+ TEST(input.type == LIBTERMINPUT_NONE);\
+ }\
+ TEST(write(fds[1], &buffer[i__], 1) == 1);\
+ TEST(libterminput_read(fds[0], &input, &ctx) == 1);\
+ TEST(input.keypress.key == (KEY));\
+ TEST(input.keypress.mods == (MODS));\
+ TEST(input.keypress.times == (TIMES));\
+ for (times__ = (TIMES) - 1; times__; times__--) {\
+ TEST(libterminput_read(fds[0], &input, &ctx) == 1);\
+ TEST(input.type == LIBTERMINPUT_KEYPRESS);\
+ TEST(input.keypress.key == (KEY));\
+ TEST(input.keypress.mods == (MODS));\
+ TEST(input.keypress.times == times__);\
+ }\
+ }\
} while (0)
#define KEYPRESS(A, B, KEY, MODS)\