Exemplo n.º 1
0
        public void ThreadedBinaryTreeDummyNodeTest()
        {
            ThreadedBinaryTreeNode <int>      root  = new ThreadedBinaryTreeNode <int>(1);
            ThreadedBinaryTreeDummyNode <int> dummy = new ThreadedBinaryTreeDummyNode <int>(root);

            Assert.AreEqual(0, dummy.Value);
            Assert.AreSame(root, dummy.Left);
            Assert.AreSame(dummy, dummy.Right);
        }
Exemplo n.º 2
0
        public void ThreadedBinaryTreeNodeTest()
        {
            ThreadedBinaryTreeNode <int> n = new ThreadedBinaryTreeNode <int>(2, new ThreadedBinaryTreeNode <int>(3), new ThreadedBinaryTreeNode <int>(4));

            Assert.AreEqual(2, n.Value);
            Assert.IsFalse(n.IsThreaded);
            Assert.IsNotNull(n.Left);
            Assert.IsNotNull(n.Right);
            Assert.AreEqual(3, n.Left.Value);
            Assert.AreEqual(4, n.Right.Value);
        }
Exemplo n.º 3
0
        public void ThreadedBinaryTreeNodeSimpleTest()
        {
            ThreadedBinaryTreeNode <int> n = new ThreadedBinaryTreeNode <int>(1);

            Assert.AreEqual(1, n.Value);
            Assert.IsNull(n.Left);
            Assert.IsNull(n.Right);
            Assert.IsFalse(n.IsLeftThreaded);
            Assert.IsFalse(n.IsRightThreaded);
            Assert.IsFalse(n.IsThreaded);
        }