コード例 #1
0
 @Test(expected = IllegalArgumentException.class)
 public void testException() {
   StringMatcher.naiveMatcher(text1, pattern2);
   StringMatcher.finiteAutomataMatcher(text1, pattern2);
   StringMatcher.KMPmatcher(text2, pattern2);
 }
コード例 #2
0
 @Test
 public void testFiniteAutomata() {
   assertEquals(1, StringMatcher.finiteAutomataMatcher(text1, pattern1));
   assertEquals(1, StringMatcher.finiteAutomataMatcher(text2, pattern1));
   assertEquals(6, StringMatcher.finiteAutomataMatcher(text2, pattern3));
 }
コード例 #3
0
 @Test
 public void testKMP() {
   assertEquals(1, StringMatcher.KMPmatcher(text1, pattern1));
   assertEquals(1, StringMatcher.KMPmatcher(text2, pattern1));
   assertEquals(6, StringMatcher.KMPmatcher(text2, pattern3));
 }
コード例 #4
0
 @Test
 public void testNaive() {
   assertEquals(1, StringMatcher.naiveMatcher(text1, pattern1));
   assertEquals(1, StringMatcher.naiveMatcher(text2, pattern1));
   assertEquals(6, StringMatcher.naiveMatcher(text2, pattern3));
 }