Skip to content

Commit

Permalink
Add additional test case
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Nov 2, 2023
1 parent 8c78d33 commit 3129c21
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions server/src/test/java/org/opensearch/common/regex/RegexTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public void testDoubleWildcardMatch() {
assertFalse(Regex.simpleMatch("fff**ddd", "fffabcdd"));
assertTrue(Regex.simpleMatch("fff*******ddd", "fffabcddd"));
assertTrue(Regex.simpleMatch("fff*******ddd", "FffAbcdDd", true));
assertFalse(Regex.simpleMatch("fff*******ddd", "FffAbcdDd", false));
assertFalse(Regex.simpleMatch("fff******ddd", "fffabcdd"));
}

Expand Down Expand Up @@ -124,10 +125,10 @@ public void testSimpleMatch() {
}

public void testRemoveDuplicates() {
assertEquals("*", Regex.removeDuplicates("***", '*'));
assertEquals("*abc*", Regex.removeDuplicates("**abc**", '*'));
assertEquals("a*b*c*", Regex.removeDuplicates("a*b**c****", '*'));
assertEquals("*abc", Regex.removeDuplicates("****abc", '*'));
assertEquals("*", Regex.removeDuplicates("*".repeat(100), '*'));
assertEquals("*", Regex.removeAdjacentDuplicates("***", '*'));
assertEquals("*abc*", Regex.removeAdjacentDuplicates("**abc**", '*'));
assertEquals("a*b*c*", Regex.removeAdjacentDuplicates("a*b**c****", '*'));
assertEquals("*abc", Regex.removeAdjacentDuplicates("****abc", '*'));
assertEquals("*", Regex.removeAdjacentDuplicates("*".repeat(100), '*'));
}
}

0 comments on commit 3129c21

Please sign in to comment.