|
I ran the following test cases through wildcmp, all successful. (The test() function compares the pattern to the input string, and compares against the expected result).
test( "", "", true );
test( "*", "", true );
test( "*", "A", true );
test( "", "A", false );
test( "A*", "", false );
test( "A*", "AAB", true );
test( "A*", "BAA", false );
test( "A*", "A", true );
test( "A*B", "", false );
test( "A*B", "AAB", true );
test( "A*B", "AB", true );
test( "A*B", "AABA", false );
test( "A*B", "ABAB", true );
test( "A*B", "ABBBB", true );
test( "A*B*C", "", false );
test( "A*B*C", "ABC", true );
test( "A*B*C", "ABCC", true );
test( "A*B*C", "ABBBC", true );
test( "A*B*C", "ABBBBCCCC", true );
test( "A*B*C", "ABCBBBCBCCCBCBCCCC", true );
test( "A*B*", "AB", true );
test( "A*B*", "AABA", true );
test( "A*B*", "ABAB", true );
test( "A*B*", "ABBBB", true );
test( "A*B*C*", "", false );
test( "A*B*C*", "ABC", true );
test( "A*B*C*", "ABCC", true );
test( "A*B*C*", "ABBBC", true );
test( "A*B*C*", "ABBBBCCCC", true );
test( "A*B*C*", "ABCBBBCBCCCBCBCCCC", true );
test( "A?", "AAB", false );
test( "A?B", "AAB", true );
test( "A?*", "A", false );
test( "A?*", "ABBCC", true );
test( "A?*", "BAA", false );
Paul McGuire
KLA-Tencor/Process Analysis & Control Division
Austin, TX
|
|
|
|
|
Your test #7 prove the bug i found in this code:
pattern: start*end
will not match text: start___end___end
it will not since the second look will go and perform match to the first part of the string: start___end
and then will return false since we did eached the end of the pattern but not the end of the string
|
|
|
|