forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWildcardMatchingTest.java
More file actions
27 lines (22 loc) · 847 Bytes
/
WildcardMatchingTest.java
File metadata and controls
27 lines (22 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.thealgorithms.dynamicprogramming;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
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", ""));
}
}