01: package test.org.mandarax.util;
02:
03: /*
04: * Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: */
20:
21: import junit.framework.TestSuite;
22:
23: /**
24: * A test suite for the wild card matcher.
25: * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
26: * @version 3.4 <7 March 05>
27: * @since 3.0
28: */
29:
30: public class WildcardMatcherTests {
31: /**
32: * Launch the test suite. See TestRunner for interpretation
33: * of command line parameters.
34: * @see test.org.mandarax.testsupport.TestRunner
35: * @param args parameters
36: */
37: public static void main(String[] args) {
38: test.org.mandarax.testsupport.TestRunner.run(
39: WildcardMatcherTests.class, args);
40: }
41:
42: /**
43: * Return a test suite.
44: * @return a test suite
45: */
46: public static TestSuite suite() {
47: TestSuite suite = new TestSuite(
48: "Test cases for the wildcard matcher");
49: suite.addTest(new WildcardMatcherTest(
50: "a string with numbers 123",
51: "a string with numbers 123", true));
52: suite.addTest(new WildcardMatcherTest("a string % 123",
53: "a string with numbers 123", true));
54: suite.addTest(new WildcardMatcherTest("a%b%c", "aaabbbccc",
55: true));
56: suite
57: .addTest(new WildcardMatcherTest("%ab%c", "abbbccc",
58: true));
59: suite.addTest(new WildcardMatcherTest("%ab%c", "xxxabbbccc",
60: true));
61: suite
62: .addTest(new WildcardMatcherTest("a\\%b%c", "a%bxxc",
63: true));
64: suite.addTest(new WildcardMatcherTest("a%b", "ab", true));
65: suite.addTest(new WildcardMatcherTest("ab%", "ab", true));
66: suite.addTest(new WildcardMatcherTest("ab%", "abxx", true));
67: suite.addTest(new WildcardMatcherTest("ab_", "abx", true));
68: suite.addTest(new WildcardMatcherTest("_ab", "xab", true));
69: suite.addTest(new WildcardMatcherTest("a_b", "axb", true));
70: suite.addTest(new WildcardMatcherTest("ab_", "abxx", false));
71: suite.addTest(new WildcardMatcherTest("_ab", "xxab", false));
72: suite.addTest(new WildcardMatcherTest("a_b", "axxb", false));
73: suite.addTest(new WildcardMatcherTest("ab_", "ab", false));
74: suite.addTest(new WildcardMatcherTest("_ab", "ab", false));
75: suite.addTest(new WildcardMatcherTest("a_b", "ab", false));
76: suite.addTest(new WildcardMatcherTest("a\\_b", "a_b", true));
77: suite.addTest(new WildcardMatcherTest("\\_ab", "_ab", true));
78: suite.addTest(new WildcardMatcherTest("ab\\_", "ab_", true));
79: suite
80: .addTest(new WildcardMatcherTest("a\\\\_b", "a\\_b",
81: true));
82:
83: return suite;
84: }
85: }
|