tests: add match() - surf-adblock - Surf adblock web extension
(HTM) git clone git://git.codemadness.org/surf-adblock
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit ede99e9ea359312250db995e663de8ce73405f62
(DIR) parent 3cc61dad61ee13b47cc3b6a2931de9413c4c6176
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 5 Jun 2017 17:37:19 +0200
tests: add match()
Diffstat:
A tests/match.c | 51 +++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/tests/match.c b/tests/match.c
@@ -0,0 +1,51 @@
+#include "../adblock.c"
+
+int
+main(void)
+{
+ int m;
+
+ m = match("a", "a", 1);
+ printf("%d = 0\n", m);
+
+ m = match("a*", "a", 1);
+ printf("%d = 0\n", m);
+
+ m = match("*a", "a", 1);
+ printf("%d = 0\n", m);
+
+ m = match("*a*", "a", 1);
+ printf("%d = 0\n", m);
+
+ m = match("^*", "/index.html", 1);
+ printf("%d = 0\n", m);
+
+ m = match("*^*", "/index.html", 1);
+ printf("%d = 0\n", m);
+
+ m = match("*^*", "a/index.html", 1);
+ printf("%d = 0\n", m);
+
+ m = match("*/*", "a/index.html", 1);
+ printf("%d = 0\n", m);
+
+ m = match("*^i*", "a/index.html", 1);
+ printf("%d = 0\n", m);
+
+ m = match("a^i*", "a/index.html", 1);
+ printf("%d = 0\n", m);
+
+ m = match("b^i*", "a/index.html", 1);
+ printf("%d = 1\n", m);
+
+ m = match("a^^i*", "a/index.html", 1);
+ printf("%d = 1\n", m);
+
+ m = match("^^i*", "a/index.html", 1);
+ printf("%d = 1\n", m);
+
+ m = match("^^i*", "a/index.html", 1);
+ printf("%d = 1\n", m);
+
+ return 0;
+}