Exemplo n.º 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());
        }
Exemplo n.º 2
0
 private void KmpMatcher(string text, string pattern)
 => KmpStringMatcher.GetMatchIndices(text, pattern).ToArray();
Exemplo n.º 3
0
Arquivo: NHAY.cs Projeto: Dariasz/SPOJ
 public static IEnumerable <int> Solve(string text, string pattern)
 => KmpStringMatcher.GetMatchIndices(text, pattern);