예제 #1
0
        public void InsertTestString()
        {
            string[]            array    = new string[] { "7", "4", "8", "9", "5" };
            string[]            expected = new string[] { "10", "4", "5", "7", "8", "9" };
            GenericBST <string> tree     = new GenericBST <string>(array);

            tree.Add("10");
            Assert.AreEqual(tree.Traversing(WalkOrder.In).ToArray(), expected);
        }
예제 #2
0
        public void InsertTestBook()
        {
            Book[]            array    = { new Book("A", "T"), new Book("B", "TB"), new Book("C", "TC"), new Book("D", "TD"), new Book("E", "TE") };
            Book[]            expected = { new Book("A", "T"), new Book("B", "TB"), new Book("C", "TC"), new Book("D", "TD"), new Book("E", "TE"), new Book("G", "TG") };
            GenericBST <Book> tree     = new GenericBST <Book>(array);

            tree.Add(new Book("G", "TG"));
            Assert.AreEqual(tree.Traversing(WalkOrder.In).ToArray(), expected);
        }
예제 #3
0
        public void InsertTestInt()
        {
            int[]            array    = new int[] { 7, 4, 8, 9, 5 };
            int[]            expected = new int[] { 4, 5, 7, 8, 9, 10 };
            GenericBST <int> tree     = new GenericBST <int>(array);

            tree.Add(10);
            Assert.AreEqual(tree.Traversing(WalkOrder.In).ToArray(), expected);
        }