Example #1
0
 public void TestMachAtTheMiddle()
 {
     string text = "CADRABRACABARACADA";
     string pattern = "CABA";
     BoyerMoore om = new BoyerMoore(pattern);
     int index = om.Find(text, 0);
     Assert.IsTrue(index == 8);
 }
Example #2
0
 public void TestMultipleMaches()
 {
     string text = "CADRABRACADRBARACADR";
     string pattern = "CADR";
     BoyerMoore om = new BoyerMoore(pattern);
     var list = om.FindAll(text, 0).ToArray();
     Assert.IsTrue(list.Count() == 3);
     Assert.IsTrue(list[0] == 0);
     Assert.IsTrue(list[1] == 8);
     Assert.IsTrue(list[2] == 16);
 }