Exemplo n.º 1
0
        public void CheckForNotNull()
        {
            pattern = "a";
            text    = "c";

            boyer_Moore = new BoyerMooreSearch(pattern);
            Assert.IsNotNull(boyer_Moore.BoyerMooreMatch(text));
        }
Exemplo n.º 2
0
        public void PatternMatchesInSeveralPlaces()
        {
            pattern = "ab";
            text    = "aabaaaababbaabab";
            string expected = "1681214";

            boyer_Moore = new BoyerMooreSearch(pattern);

            string actual = String.Empty;

            foreach (var a in boyer_Moore.BoyerMooreMatch(text))
            {
                actual += a;
            }

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void DifferenceInTheLastCharacter()
        {
            pattern = "aaaaaaaaab";
            text    = "aaaaaaaaaa";
            string expected = String.Empty;

            boyer_Moore = new BoyerMooreSearch(pattern);

            string actual = String.Empty;

            foreach (var a in boyer_Moore.BoyerMooreMatch(text))
            {
                actual += a;
            }

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 4
0
        public void NoPatternInTheText()
        {
            pattern = "c";
            text    = "abbbbaaababbab";
            string expected = String.Empty;

            boyer_Moore = new BoyerMooreSearch(pattern);

            string actual = String.Empty;

            foreach (var a in boyer_Moore.BoyerMooreMatch(text))
            {
                actual += a;
            }

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 5
0
        public void PatternAndTextAreTheSame()
        {
            pattern = "ab";
            text    = "ab";
            string expected = "0";

            boyer_Moore = new BoyerMooreSearch(pattern);

            string actual = String.Empty;

            foreach (var a in boyer_Moore.BoyerMooreMatch(text))
            {
                actual += a;
            }

            Assert.AreEqual(expected, actual);
        }