예제 #1
0
        public void StringMatchers_ForLargeStrings_AgreeWithEachOther()
        {
            string text    = InputGenerator.GenerateRandomString(1000);
            string pattern = InputGenerator.GenerateRandomString(3);

            CollectionAssert.AreEqual(
                NaiveStringMatcher.GetMatchIndices(text, pattern).ToArray(),
                KmpStringMatcher.GetMatchIndices(text, pattern).ToArray());

            text    = InputGenerator.GenerateRandomString(1000, 'a', 'b');
            pattern = InputGenerator.GenerateRandomString(3, 'a', 'b');

            CollectionAssert.AreEqual(
                NaiveStringMatcher.GetMatchIndices(text, pattern).ToArray(),
                KmpStringMatcher.GetMatchIndices(text, pattern).ToArray());
        }
예제 #2
0
 private void NaiveMatcher(string text, string pattern)
 => NaiveStringMatcher.GetMatchIndices(text, pattern).ToArray();