Exemple #1
0
        public void DepthZeroReturnRootNode()
        {
            Tree tree = CreateTree(3);
            TreeSearch search = new TreeSearch();

            Assert.AreEqual(3, search.FindMaxValue(tree, 0));
        }
Exemple #2
0
        public void DepthZeroOnTreeWithChildren()
        {
            Tree tree = CreateTree(5, 3, 7);
            TreeSearch search = new TreeSearch();

            Assert.AreEqual(5, search.FindMaxValue(tree, 0));
        }
Exemple #3
0
        public void DepthTwoOnTreeWithTwoLevelsOfChildren()
        {
            Tree tree = CreateTreeNodes(5, CreateTree(3, 5, 7), CreateTree(7, 9, 11));
            TreeSearch search = new TreeSearch();

            Assert.AreEqual(11, search.FindMaxValue(tree, 2));
        }
Exemple #4
0
        public void DepthOneReturnRootNodeOnTreeWithoutChildren()
        {
            Tree tree = CreateTree(5);
            TreeSearch search = new TreeSearch();

            Assert.AreEqual(5, search.FindMaxValue(tree, 1));
        }
Exemple #5
0
        public void DepthOneOnTreeWithOnlyTwoChildren()
        {
            Tree tree = CreateTree(5, 3, 7);
            TreeSearch search = new TreeSearch();

            Assert.AreEqual(7, search.FindMaxValue(tree, 1));
        }
Exemple #6
0
        public void DepthOneOnTreeWithOnlyOneChild()
        {
            Tree tree = CreateTree(5, 3);
            TreeSearch search = new TreeSearch();

            Assert.AreEqual(3, search.FindMaxValue(tree, 1));
        }