[openssh-commits] [openssh] 04/04: upstream commit

git+noreply at mindrot.org git+noreply at mindrot.org
Sat Feb 4 10:10:21 AEDT 2017


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 97c31c46ee2e6b46dfffdfc4f90bbbf188064cbc
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Fri Feb 3 23:01:42 2017 +0000

    upstream commit
    
    unit test for match_filter_list() function; still want a
    better name for this...
    
    Upstream-Regress-ID: 840ad6118552c35111f0a897af9c8d93ab8de92a
---
 regress/unittests/match/tests.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/regress/unittests/match/tests.c b/regress/unittests/match/tests.c
index 7ff319c..e159336 100644
--- a/regress/unittests/match/tests.c
+++ b/regress/unittests/match/tests.c
@@ -1,4 +1,4 @@
-/* 	$OpenBSD: tests.c,v 1.3 2016/09/21 17:03:54 djm Exp $ */
+/* 	$OpenBSD: tests.c,v 1.4 2017/02/03 23:01:42 djm Exp $ */
 /*
  * Regress test for matching functions
  *
@@ -103,6 +103,25 @@ tests(void)
 	/* XXX negated ASSERT_INT_EQ(addr_match_list("127.0.0.1", "!127.0.0.2,10.0.0.1"), 1); */
 	TEST_DONE();
 
+#define CHECK_FILTER(string,filter,expected) \
+	do { \
+		char *result = match_filter_list((string), (filter)); \
+		ASSERT_STRING_EQ(result, expected); \
+		free(result); \
+	} while (0)
+
+	TEST_START("match_filter_list");
+	CHECK_FILTER("a,b,c", "", "a,b,c");
+	CHECK_FILTER("a,b,c", "a", "b,c");
+	CHECK_FILTER("a,b,c", "b", "a,c");
+	CHECK_FILTER("a,b,c", "c", "a,b");
+	CHECK_FILTER("a,b,c", "a,b", "c");
+	CHECK_FILTER("a,b,c", "a,c", "b");
+	CHECK_FILTER("a,b,c", "b,c", "a");
+	CHECK_FILTER("a,b,c", "a,b,c", "");
+	CHECK_FILTER("a,b,c", "b,c", "a");
+	CHECK_FILTER("", "a,b,c", "");
+	TEST_DONE();
 /*
  * XXX TODO
  * int      match_host_and_ip(const char *, const char *, const char *);

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list