Example #1
0
        public void TestBlackConsistency()
        {
            TestContext.Progress.WriteLine("Testing BlackConsistency with invalid tree");
            Node max = tree.Maximum(tree.Root);

            max.Right = new Node(max.Key + 1)
            {
                Color = Black
            };
            max.Right.Parent = max;
            Assert.AreEqual(false, tree.BlackConsistency());

            max.Right.Parent = null;
            max.Right        = tree.Nil;

            max.Color = max.Color == Black ? Red : Black;
            Assert.AreEqual(false, tree.BlackConsistency());
        }