示例#1
0
        public void Suffix_Smoke_Test()
        {
            var suffixTree = new SuffixTree <char>();

            suffixTree.Insert("bananaa".ToCharArray());
            Assert.IsTrue(suffixTree.Count == 1);

            Assert.IsTrue(suffixTree.ContainsPattern("aa".ToCharArray()));
            Assert.IsFalse(suffixTree.ContainsPattern("ab".ToCharArray()));

            var matches = suffixTree.StartsWithPattern("na".ToCharArray());

            Assert.IsTrue(matches.Count == 2);

            matches = suffixTree.StartsWithPattern("an".ToCharArray());
            Assert.IsTrue(matches.Count == 2);

            suffixTree.Delete("bananaa".ToCharArray());
            Assert.IsTrue(suffixTree.Count == 0);
        }