You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
701 B

#include "../src/common.h"
#include "../src/regexps.h"
int main() {
f2b_regex_t *list = NULL;
f2b_regex_t *regex = NULL;
char matchbuf[32] = "";
assert((regex = f2b_regex_create("line without HOST", true)) == NULL);
assert((regex = f2b_regex_create("line with <HOST>", true)) != NULL);
assert(f2b_regexlist_match(list, "line with 192.168.0.1", matchbuf, sizeof(matchbuf)) == false);
assert((list = f2b_regexlist_append(list, regex)) != NULL);
assert(f2b_regexlist_match(list, "line with 192.168.0.1", matchbuf, sizeof(matchbuf)) == true);
assert(strncmp(matchbuf, "192.168.0.1", sizeof(matchbuf)) == 0);
assert((list = f2b_regexlist_destroy(list)) == NULL);
return 0;
}