public void BoyerMooreSearchTest() { string txt = "ABACADABRAC"; string pat = "ABRA"; var bm = new BoyerMooreSearch(pat); Assert.Equal(6, bm.Search(txt)); }
public void TestBoyerMooreSearch() { char[] txt = "ABAAABCD".ToCharArray(); char[] pat = "ABC".ToCharArray(); var actual = boyerMooreSearch.Search(txt, pat); var expected = 1; Assert.Equal(expected, actual.Count); }
public void Search() { Assert.IsTrue(BoyerMooreSearch.Search("abd", "abdfgh").SequenceEqual(new List <int> { })); /* Testing the case where substring is longer than string. */ Assert.IsTrue(BoyerMooreSearch.Search("gcaatgcctatgtgacc", "tatgtg").SequenceEqual(new List <int> { 8 })); /* Example taken from geeks for geeks. */ Assert.IsTrue(BoyerMooreSearch.Search("aaaa", "aa").SequenceEqual(new List <int> { 0, 1, 2 })); Assert.AreEqual(1, BoyerMooreSearch.Search("abcd", "bc")[0]); Assert.AreEqual(2, BoyerMooreSearch.Search("abcd", "cd")[0]); Assert.AreEqual(12, BoyerMooreSearch.Search("aaaaaakcdkaaaabcd", "aab")[0]); Assert.IsTrue(BoyerMooreSearch.Search("abcaab", "a").SequenceEqual(new List <int> { 0, 3, 4 })); Assert.IsTrue(BoyerMooreSearch.Search("abcaab", "abc").SequenceEqual(new List <int> { 0 })); Assert.AreEqual(0, BoyerMooreSearch.Search("aaabbbdaacbb", "kjh").Count); }
public void Test_Found() { BoyerMooreSearch bm = new BoyerMooreSearch("cro", Alphabet.ASCII); Assert.Equal(2, bm.Search("Microsoft")); }