summaryrefslogtreecommitdiff
path: root/erts/lib_src/yielding_c_fun/lib/tiny_regex_c/tests/test_rand_neg.c
diff options
context:
space:
mode:
Diffstat (limited to 'erts/lib_src/yielding_c_fun/lib/tiny_regex_c/tests/test_rand_neg.c')
-rw-r--r--erts/lib_src/yielding_c_fun/lib/tiny_regex_c/tests/test_rand_neg.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/erts/lib_src/yielding_c_fun/lib/tiny_regex_c/tests/test_rand_neg.c b/erts/lib_src/yielding_c_fun/lib/tiny_regex_c/tests/test_rand_neg.c
new file mode 100644
index 0000000000..192ce5c608
--- /dev/null
+++ b/erts/lib_src/yielding_c_fun/lib/tiny_regex_c/tests/test_rand_neg.c
@@ -0,0 +1,29 @@
+/*
+ Negative version of test_rand.c -- returns true if no match
+
+ This program tries to match a given regular expression with text given as input to stdin.
+ If the text is NOT a match for the pattern, the program returns 0.
+ If the text does match the pattern, the program returns -2.
+
+ This program is used in random testing to test a lot of random text and regex together.
+ See ./scripts/regex_test_neg.py and the Makefile for this project for the gritty details.
+*/
+
+#include <stdio.h>
+#include "re.h"
+
+
+int main(int argc, char** argv)
+{
+ if (argc == 3)
+ {
+ int m = re_match(argv[1], argv[2]);
+ if (m == -1)
+ return 0;
+ }
+ else
+ {
+ printf("\nUsage: %s <PATTERN> <TEXT> \n", argv[0]);
+ }
+ return -2;
+}