dte test coverage


Directory: ./
File: src/terminal/linux.c
Date: 2025-02-14 16:55:22
Exec Total Coverage
Lines: 8 8 100.0%
Functions: 1 1 100.0%
Branches: 8 8 100.0%

Line Branch Exec Source
1 #include "linux.h"
2 #include "parse.h"
3 #include "util/xstring.h"
4
5 10 ssize_t linux_parse_key(const char *buf, size_t length, KeyCode *k)
6 {
7
4/4
✓ Branch 0 (2→3) taken 8 times.
✓ Branch 1 (2→5) taken 2 times.
✓ Branch 2 (4→5) taken 1 times.
✓ Branch 3 (4→6) taken 7 times.
10 if (length < 3 || !mem_equal(buf, "\033[[", 3)) {
8 3 return term_parse_sequence(buf, length, k);
9 }
10
11
2/2
✓ Branch 0 (6→7) taken 6 times.
✓ Branch 1 (6→9) taken 1 times.
7 if (unlikely(length == 3)) {
12 return TPARSE_PARTIAL_MATCH;
13 }
14
15 // Letters A-E represent keys F1-F5
16 6 char c = buf[3];
17
2/2
✓ Branch 0 (7→8) taken 5 times.
✓ Branch 1 (7→9) taken 1 times.
6 if (c >= 'A' && c <= 'E') {
18 5 *k = KEY_F1 + (c - 'A');
19 5 return 4;
20 }
21
22 return 0;
23 }
24