Exemplo n.º 1
0
 public void TestMethod1()
 {
     PatternFinder pf = new PatternFinder(new string[] { "a", "ab", "bab", "bc", "bca", "c", "caa" });
     ISearchResult[] results = pf.FindAll("abccab");
     Assert.IsTrue(results.Length == 7);
     Assert.IsTrue(results[0].Index == 0);
     Assert.IsTrue(results[1].Index == 0);
     Assert.IsTrue(results[1].GetValue() == "ab");
     Assert.IsTrue(results[2].Index == 1);
     Assert.IsTrue(results[3].Index == 2);
 }
Exemplo n.º 2
0
        public void FindAll()
        {
            string target = "CADACADACAABRABRADARCCADAADRCADA";
            PatternFinder finder = new PatternFinder("CADA", SearchOptions.Raita);
            var maches = finder.FindAll(target);

            Assert.IsTrue(maches.Length == 4);
            Assert.IsTrue(maches[0].Index == 0);
            Assert.IsTrue(maches[1].Index == 4);
            Assert.IsTrue(maches[2].Index == 21);
            Assert.IsTrue(maches[3].Index == 28);
        }