1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00
freebsd/contrib/mandoc/test-rewb-sysv.c
Baptiste Daroussin 61d06d6bd1 Import mandoc 1.14.4
Approved by:	re (kib)
MFC after:	1 week
2018-09-20 10:58:52 +00:00

28 lines
610 B
C

#include <sys/types.h>
#include <stddef.h>
#include <regex.h>
int
main(void)
{
regex_t re;
if (regcomp(&re, "\\<word\\>", REG_EXTENDED | REG_NOSUB))
return 1;
if (regexec(&re, "the word is here", 0, NULL, 0))
return 2;
if (regexec(&re, "same word", 0, NULL, 0))
return 3;
if (regexec(&re, "word again", 0, NULL, 0))
return 4;
if (regexec(&re, "word", 0, NULL, 0))
return 5;
if (regexec(&re, "wordy", 0, NULL, 0) != REG_NOMATCH)
return 6;
if (regexec(&re, "sword", 0, NULL, 0) != REG_NOMATCH)
return 7;
if (regexec(&re, "reworded", 0, NULL, 0) != REG_NOMATCH)
return 8;
return 0;
}