예제 #1
0
        public void EmptyMultiDawgTest()
        {
            var             builder   = new MultiDawgBuilder <int>();
            MultiDawg <int> multiDawg = builder.BuildMultiDawg();

            Assert.AreEqual(1, multiDawg.GetNodeCount()); // the root node
            AssertSequenceEquals(multiDawg.MultiwordFind(new [] { "" }, out int wordCount), new int[0]);
            Assert.AreEqual(0, wordCount);
        }
예제 #2
0
        public void MergeEndsTest()
        {
            var builder = new MultiDawgBuilder <int>();

            builder.Insert("ax", new [] { 1, 2, 3 });
            builder.Insert("bx", new [] { 1, 2, 3 });
            MultiDawg <int> multiDawg = builder.BuildMultiDawg();

            // The three nodes should be:
            // 1. root with two children, "a" and "b", pointing to the *same* node "2"
            // 2. node "2" pointing to node "x".
            // 3. node "x" carrying the payload 1,2,3.
            Assert.AreEqual(3, multiDawg.GetNodeCount());
        }