File | Lines added | Lines deleted |
---|---|---|
src/hstr.c | 1 | 0 |
tests/_ranking | 0 | 0 |
tests/src/test_regexp.c | 34 | 0 |
tests/test_args.sh | 5 | 0 |
tests/test_curses.sh | 5 | 0 |
tests/test_hashset.sh | 5 | 0 |
tests/test_keyb.sh | 4 | 0 |
tests/test_ranking.sh | 4 | 0 |
tests/test_regexp.sh | 7 | 0 |
File src/hstr.c changed (mode: 100644) (index 1af9afd..b63a5fa) | |||
10 | 10 | #define _GNU_SOURCE | #define _GNU_SOURCE |
11 | 11 | ||
12 | 12 | #include <curses.h> | #include <curses.h> |
13 | #include <regex.h> | ||
13 | 14 | #include <signal.h> | #include <signal.h> |
14 | 15 | #include <stdbool.h> | #include <stdbool.h> |
15 | 16 | #include <stddef.h> | #include <stddef.h> |
File tests/_ranking deleted (index bef97a8..0000000) |
File tests/src/test_regexp.c added (mode: 100644) (index 0000000..6592c03) | |||
1 | /* | ||
2 | ============================================================================ | ||
3 | Name : test_regexp.c | ||
4 | Author : martin.dvorak@mindforger.com | ||
5 | Copyright : Apache 2.0 | ||
6 | Description : A test for regular expression based matching | ||
7 | ============================================================================ | ||
8 | */ | ||
9 | |||
10 | #include <regex.h> | ||
11 | #include <stdio.h> | ||
12 | #include <stdbool.h> | ||
13 | |||
14 | void main() { | ||
15 | bool caseSensitive=false; | ||
16 | |||
17 | char *regexp="a"; | ||
18 | char *text="This is a command that I want to match: go.sh there"; | ||
19 | |||
20 | regex_t compiled; | ||
21 | int compilationFlags=(caseSensitive?0:REG_ICASE); | ||
22 | printf("Regular expressions matching:\n '%s'\n '%s'",text,regexp); | ||
23 | int compilationStatus=regcomp(&compiled, regexp, compilationFlags); | ||
24 | printf("\nCompilation: %d",compilationStatus); | ||
25 | |||
26 | int matches; | ||
27 | regmatch_t **matchPtr; | ||
28 | int matchingFlags=0; | ||
29 | int matchingStatus=regexec(&compiled, text, matches, matchPtr, matchingFlags); | ||
30 | printf("\nMatching (status/matches/ptr): %d %d %p",matchingStatus,matches,matchPtr); | ||
31 | |||
32 | printf("\n"); | ||
33 | } | ||
34 |
File tests/test_args.sh changed (mode: 100755) (index 2a800a4..e005bb6) | |||
1 | #!/bin/bash | ||
2 | |||
1 | 3 | gcc ./src/test_args.c -o _args | gcc ./src/test_args.c -o _args |
4 | |||
5 | # eof | ||
6 |
File tests/test_curses.sh changed (mode: 100755) (index c783782..93dd6b9) | |||
1 | #!/bin/bash | ||
2 | |||
1 | 3 | gcc ./src/test_curses_keyb.c -lcurses -o _curses | gcc ./src/test_curses_keyb.c -lcurses -o _curses |
4 | |||
5 | # eof | ||
6 |
File tests/test_hashset.sh changed (mode: 100755) (index a7b363e..2302c83) | |||
1 | #!/bin/bash | ||
2 | |||
1 | 3 | gcc ./src/test_hashset.c ../src/hashset.c -o _hashset | gcc ./src/test_hashset.c ../src/hashset.c -o _hashset |
4 | |||
5 | # eof | ||
6 |
File tests/test_keyb.sh changed (mode: 100755) (index c6683c9..828e87b) | |||
1 | #!/bin/bash | ||
2 | |||
1 | 3 | gcc ./src/test_keyb.c -o _keyb | gcc ./src/test_keyb.c -o _keyb |
4 | |||
5 | # eof |
File tests/test_ranking.sh changed (mode: 100755) (index 6543b3d..9f336de) | |||
1 | #!/bin/bash | ||
2 | |||
1 | 3 | gcc ./src/test_ranking.c -lm -o _ranking | gcc ./src/test_ranking.c -lm -o _ranking |
4 | |||
5 | # eof |
File tests/test_regexp.sh added (mode: 100755) (index 0000000..c222ac1) | |||
1 | #!/bin/bash | ||
2 | |||
3 | rm -vf _regexp | ||
4 | gcc ./src/test_regexp.c -o _regexp | ||
5 | ./_regexp | ||
6 | |||
7 | # eof |