FileDocCategorySizeDatePackage
TestCompWildcard.javaAPI DocphoneME MR2 API (J2ME)3022Wed May 02 18:00:00 BST 2007com.sun.midp.i3test

TestCompWildcard

public class TestCompWildcard extends TestCase

Fields Summary
Constructors Summary
Methods Summary
private native booleancmpWildCard(java.lang.String filter, java.lang.String src)
Compare the filter and source address.

param
filter The filter string to be used
param
src The incoming address to be tested by the filter
return
true if the comparison is successful, false if it fails

public voidrunTests()
Runs all the tests.

        declare("Compare * 1.2.3.4");
        assertTrue("Wrong compare", cmpWildCard("*", "1.2.3.4"));
        declare("Compare 1.* 1.2.3.4");
        assertTrue("Wrong compare", cmpWildCard("1.*", "1.2.3.4"));
        declare("Compare 1.** 1.2.3.4");
        assertTrue("Wrong compare", cmpWildCard("1.**", "1.2.3.4"));
        declare("Compare *4 1.2.3.4");
        assertTrue("Wrong compare", cmpWildCard("*4", "1.2.3.4"));
        declare("Compare 1.?.3.4 1.2.3.4");
        assertTrue("Wrong compare", cmpWildCard("1.?.3.4", "1.2.3.4"));
        declare("Compare ?*? 1.2.3.4");
        assertTrue("Wrong compare", cmpWildCard("?*?", "1.2.3.4"));
        declare("Compare ?**?3?*4 1.2.3.4");
        assertTrue("Wrong compare", cmpWildCard("?**?3?*4", "1.2.3.4"));
        declare("Compare *5* 1.2.3.4");
        assertTrue("Wrong compare", !cmpWildCard("*5*", "1.2.3.4"));
        declare("Compare 1.2.3.?? 1.2.3.4");
        assertTrue("Wrong compare", !cmpWildCard("1.2.3.??", "1.2.3.4"));
        declare("Compare *.??.* 1.2.3.4");
        assertTrue("Wrong compare", !cmpWildCard("*.??.*", "1.2.3.4"));
        declare("Compare *ab* axab");
        assertTrue("Wrong compare", cmpWildCard("*ab*", "axab"));
        declare("Compare *aab aaab");
        assertTrue("Wrong compare", cmpWildCard("*aab", "aaab"));
        declare("Compare *abcde*aab uuabcdeuuauuabcdeuuaab");
        assertTrue("Wrong compare", cmpWildCard("*abcde*aab", "uuabcdeuuauuabcdeuuaab"));