From 54841f6294380c023f586598b672816f36a1adc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 2 Oct 2016 08:58:19 +0200 Subject: api: fix return of function string_match() when there are multiple masks in the string (issue #812) Some tests are added as well to test the multiple masks in the string. --- tests/unit/core/test-string.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/unit/core') diff --git a/tests/unit/core/test-string.cpp b/tests/unit/core/test-string.cpp index fb1d06ddb..34c31793d 100644 --- a/tests/unit/core/test-string.cpp +++ b/tests/unit/core/test-string.cpp @@ -322,6 +322,24 @@ TEST(String, Match) LONGS_EQUAL(1, string_match ("test", "*es*", 1)); LONGS_EQUAL(1, string_match ("test", "*ES*", 0)); LONGS_EQUAL(0, string_match ("test", "*ES*", 1)); + LONGS_EQUAL(1, string_match ("TEST", "*es*", 0)); + LONGS_EQUAL(0, string_match ("TEST", "*es*", 1)); + LONGS_EQUAL(0, string_match ("aaba", "*aa", 0)); + LONGS_EQUAL(0, string_match ("aaba", "*aa", 1)); + LONGS_EQUAL(1, string_match ("abaa", "*aa", 0)); + LONGS_EQUAL(1, string_match ("abaa", "*aa", 1)); + LONGS_EQUAL(1, string_match ("aabaa", "*aa", 0)); + LONGS_EQUAL(1, string_match ("aabaa", "*aa", 1)); + LONGS_EQUAL(1, string_match ("aabaabaabaa", "*aa", 0)); + LONGS_EQUAL(1, string_match ("aabaabaabaa", "*aa", 1)); + LONGS_EQUAL(0, string_match ("abaa", "aa*", 0)); + LONGS_EQUAL(0, string_match ("abaa", "aa*", 1)); + LONGS_EQUAL(1, string_match ("aaba", "aa*", 0)); + LONGS_EQUAL(1, string_match ("aaba", "aa*", 1)); + LONGS_EQUAL(1, string_match ("aabaa", "aa*", 0)); + LONGS_EQUAL(1, string_match ("aabaa", "aa*", 1)); + LONGS_EQUAL(1, string_match ("aabaabaabaa", "aa*", 0)); + LONGS_EQUAL(1, string_match ("aabaabaabaa", "aa*", 1)); } /* -- cgit v1.2.3