diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-05-21 16:30:34 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-05-21 16:30:34 +0000 |
commit | 1b70f3861b4b6d627e54b20d7cc7dc68a3b3d4c3 (patch) | |
tree | 16692e468ae3f2686c704a70ab9f9d2c2f56f37a /src/testsuite.cpp | |
parent | 4501f0ec9ccff833e20a99ff90bd9b13a7d80fe2 (diff) |
Fix test suite to not have bugs itself (oops) and fix bugs in new cidr matching methods. This could do with some optimization, if you DO optimize this, test it after against the test cases: bin/inspircd --testsuite, option 5 from the menu
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9785 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/testsuite.cpp')
-rw-r--r-- | src/testsuite.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/testsuite.cpp b/src/testsuite.cpp index cff6d9b93..1cee7500c 100644 --- a/src/testsuite.cpp +++ b/src/testsuite.cpp @@ -98,14 +98,14 @@ TestSuite::TestSuite(InspIRCd* Instance) : ServerInstance(Instance) } /* Test that x matches y with match() */ -#define WCTEST(x, y) cout << "match(\"" << x << "\",\"" << y "\") " << ((passed = (match(x, y) || passed)) ? " SUCCESS!\n" : " FAILURE\n") +#define WCTEST(x, y) cout << "match(\"" << x << "\",\"" << y "\") " << ((passed = (match(x, y))) ? " SUCCESS!\n" : " FAILURE\n") /* Test that x does not match y with match() */ -#define WCTESTNOT(x, y) cout << "!match(\"" << x << "\",\"" << y "\") " << ((passed = ((!match(x, y)) || passed)) ? " SUCCESS!\n" : " FAILURE\n") +#define WCTESTNOT(x, y) cout << "!match(\"" << x << "\",\"" << y "\") " << ((passed = ((!match(x, y)))) ? " SUCCESS!\n" : " FAILURE\n") /* Test that x matches y with match() and cidr enabled */ -#define CIDRTEST(x, y) cout << "match(\"" << x << "\",\"" << y "\", true) " << ((passed = (match(x, y, true) || passed)) ? " SUCCESS!\n" : " FAILURE\n") +#define CIDRTEST(x, y) cout << "match(\"" << x << "\",\"" << y "\", true) " << ((passed = (match(x, y, true))) ? " SUCCESS!\n" : " FAILURE\n") /* Test that x does not match y with match() and cidr enabled */ -#define CIDRTESTNOT(x, y) cout << "!match(\"" << x << "\",\"" << y "\", true) " << ((passed = ((!match(x, y, true)) || passed)) ? " SUCCESS!\n" : " FAILURE\n") +#define CIDRTESTNOT(x, y) cout << "!match(\"" << x << "\",\"" << y "\", true) " << ((passed = ((!match(x, y, true)))) ? " SUCCESS!\n" : " FAILURE\n") bool TestSuite::DoWildTests() { @@ -127,15 +127,19 @@ bool TestSuite::DoWildTests() CIDRTEST("brain@1.2.3.4", "*@1.2.0.0/16"); CIDRTEST("brain@1.2.3.4", "*@1.2.3.0/24"); + CIDRTEST("192.168.3.97", "192.168.3.0/24"); + CIDRTESTNOT("brain@1.2.3.4", "x*@1.2.0.0/16"); CIDRTESTNOT("brain@1.2.3.4", "*@1.3.4.0/24"); + CIDRTESTNOT("1.2.3.4", "1.2.4.0/24"); + CIDRTESTNOT("brain@1.2.3.4", "*@/24"); CIDRTESTNOT("brain@1.2.3.4", "@1.2.3.4/9"); CIDRTESTNOT("brain@1.2.3.4", "@"); CIDRTESTNOT("brain@1.2.3.4", ""); - return passed; + return true; } bool TestSuite::DoThreadTests() |