mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-27 14:34:05 +08:00
WildcardMatching Added (#4404)
* Added WildcardMatching DP * Wildcard Matching update * Updated WildcardMatching * Added WildcardMatchingTests * WildcardMatching update * Clang-formatting done * WildcardMatching_Clang-formatting done * WildcardMatching
This commit is contained in:
@ -0,0 +1,26 @@
|
||||
package com.thealgorithms.dynamicprogramming;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class WildcardMatchingTest {
|
||||
|
||||
@Test
|
||||
public void testMatchingPattern() {
|
||||
assertTrue(WildcardMatching.isMatch("aa", "a*"));
|
||||
assertTrue(WildcardMatching.isMatch("adceb", "*a*b"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonMatchingPattern() {
|
||||
assertFalse(WildcardMatching.isMatch("cb", "?a"));
|
||||
assertFalse(WildcardMatching.isMatch("acdcb", "a*c?b"));
|
||||
assertFalse(WildcardMatching.isMatch("mississippi", "m*issi*iss?*i"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyPattern() {
|
||||
assertTrue(WildcardMatching.isMatch("", ""));
|
||||
assertFalse(WildcardMatching.isMatch("abc", ""));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user