Пример #1
0
            public void ShouldReturn1WithAbadAndA()
            {
                var result = BoyerMooreAlgorithm.MakeCharTable("abad");

                Assert.AreEqual(1, result['a']);
            }
Пример #2
0
            public void ShouldReturnIndex2Of4WithHoHo()
            {
                var result = BoyerMooreAlgorithm.MakeOffsetTable("HoHo");

                Assert.AreEqual(4, result[2]);
            }
Пример #3
0
            public void ShouldReturn6WithNeededAndPointerOf5()
            {
                var result = BoyerMooreAlgorithm.SuffixLength("needed", 5);

                Assert.AreEqual(6, result);
            }
Пример #4
0
            public void ShouldReturn4WithAbcdAndE()
            {
                var result = BoyerMooreAlgorithm.MakeCharTable("abcd");

                Assert.AreEqual(4, result['e']);
            }
Пример #5
0
            public void ShouldReturnTrueWithHoHoAndPointerOf4()
            {
                var result = BoyerMooreAlgorithm.IsPrefix("HoHo", 4);

                Assert.IsTrue(result);
            }
Пример #6
0
            public void ShouldReturn0WithTreeAndPointerOf4()
            {
                var result = BoyerMooreAlgorithm.SuffixLength("tree", 4);

                Assert.AreEqual(0, result);
            }
Пример #7
0
            public void ShouldReturnFalseWithHoHoAndPointerOf3()
            {
                var result = BoyerMooreAlgorithm.IsPrefix("HoHo", 3);

                Assert.IsFalse(result);
            }
Пример #8
0
            public void ShouldReturnIndex4Of9WithAbcde()
            {
                var result = BoyerMooreAlgorithm.MakeOffsetTable("Abcde");

                Assert.AreEqual(9, result[4]);
            }
Пример #9
0
            public void ShouldReturnIndex11Of9WithNeeded()
            {
                var result = BoyerMooreAlgorithm.MakeOffsetTable("Needed");

                Assert.AreEqual(11, result[5]);
            }
Пример #10
0
            public void ShouldReturnIndex3Of7WithTree()
            {
                var result = BoyerMooreAlgorithm.MakeOffsetTable("Tree");

                Assert.AreEqual(7, result[3]);
            }
Пример #11
0
            public void TestMethod1()
            {
                var result = BoyerMooreAlgorithm.GetIndex("This is a string describing farm life in the city of San Jose", "farm");

                Assert.AreEqual(28, result);
            }