示例#1
0
        public void TestMaximum()
        {
            var max = tree.Maximum(tree.Root);

            Assert.AreEqual(11, max.Key);

            var submax = tree.Maximum(tree.Root.Left);

            Assert.AreEqual(2, submax.Key);
        }
示例#2
0
        public void TestRedConsistency()
        {
            Node max = tree.Maximum(tree.Root);

            max.Right = new Node(max.Key + 1)
            {
                Color = Red
            };
            max.Right.Right = new Node(max.Right.Key + 1)
            {
                Color = Red
            };
            TestContext.Progress.WriteLine("Testing RedConsistency after manually violating property 4");
            Assert.AreEqual(false, tree.RedConsistency(tree.Root));
        }