Esempio n. 1
0
        public void NodeDecreaseLevel()
        {
            var rootNode = new ArneTreeNode <Int32, Int32>(100, 0);
            var aNode    = new ArneTreeNode <Int32, Int32>(90, 4);
            var bNode    = new ArneTreeNode <Int32, Int32>(20, 1);
            var cNode    = new ArneTreeNode <Int32, Int32>(120, 3);
            var dNode    = new ArneTreeNode <Int32, Int32>(10, 5);
            var eNode    = new ArneTreeNode <Int32, Int32>(30, 3);

            // initialize
            rootNode.Left = aNode;
            aNode.Left    = bNode;
            aNode.Right   = cNode;
            bNode.Left    = dNode;
            bNode.Right   = eNode;

            // perform opeation

            Assert.AreEqual(dNode, dNode.DecraseLevel());
            Assert.AreEqual(eNode, eNode.DecraseLevel());

            aNode.DecraseLevel();

            Assert.AreEqual(2u, aNode.Level);
            Assert.AreEqual(2u, aNode.Right.Level);
        }