summaryrefslogtreecommitdiff
path: root/regress/unittests/match/tests.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2017-04-02 01:26:17 +0100
committerColin Watson <cjwatson@debian.org>2017-04-02 01:54:08 +0100
commit20adc7e0fc13ff9c7d270db250aac1fa140e3851 (patch)
tree5d9f06b0ff195db88093037d9102f0cdcf3884c6 /regress/unittests/match/tests.c
parentaf27669f905133925224acc753067dea710881dd (diff)
parentec338656a3d6b21bb87f3b6367b232d297f601e5 (diff)
New upstream release (7.5p1)
Diffstat (limited to 'regress/unittests/match/tests.c')
-rw-r--r--regress/unittests/match/tests.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/regress/unittests/match/tests.c b/regress/unittests/match/tests.c
index 7ff319c16..e1593367b 100644
--- a/regress/unittests/match/tests.c
+++ b/regress/unittests/match/tests.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tests.c,v 1.3 2016/09/21 17:03:54 djm Exp $ */ 1/* $OpenBSD: tests.c,v 1.4 2017/02/03 23:01:42 djm Exp $ */
2/* 2/*
3 * Regress test for matching functions 3 * Regress test for matching functions
4 * 4 *
@@ -103,6 +103,25 @@ tests(void)
103 /* XXX negated ASSERT_INT_EQ(addr_match_list("127.0.0.1", "!127.0.0.2,10.0.0.1"), 1); */ 103 /* XXX negated ASSERT_INT_EQ(addr_match_list("127.0.0.1", "!127.0.0.2,10.0.0.1"), 1); */
104 TEST_DONE(); 104 TEST_DONE();
105 105
106#define CHECK_FILTER(string,filter,expected) \
107 do { \
108 char *result = match_filter_list((string), (filter)); \
109 ASSERT_STRING_EQ(result, expected); \
110 free(result); \
111 } while (0)
112
113 TEST_START("match_filter_list");
114 CHECK_FILTER("a,b,c", "", "a,b,c");
115 CHECK_FILTER("a,b,c", "a", "b,c");
116 CHECK_FILTER("a,b,c", "b", "a,c");
117 CHECK_FILTER("a,b,c", "c", "a,b");
118 CHECK_FILTER("a,b,c", "a,b", "c");
119 CHECK_FILTER("a,b,c", "a,c", "b");
120 CHECK_FILTER("a,b,c", "b,c", "a");
121 CHECK_FILTER("a,b,c", "a,b,c", "");
122 CHECK_FILTER("a,b,c", "b,c", "a");
123 CHECK_FILTER("", "a,b,c", "");
124 TEST_DONE();
106/* 125/*
107 * XXX TODO 126 * XXX TODO
108 * int match_host_and_ip(const char *, const char *, const char *); 127 * int match_host_and_ip(const char *, const char *, const char *);