示例#1
0
        public void FirstChildNextSibling_2_SmallTree_2_ToStringReturnsProperResult()
        {
            // Arrange
            IFirstChildNextSibling <string> tree = DSBuilder.CreateFirstChildNextSibling_Small();
            string expected = "a,FC(b,FC(d),NS(c))";

            // Act
            string actual = tree.ToString();

            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void FirstChildNextSibling_2_SmallTree_1_SizeReturnsProperResult()
        {
            // Arrange
            IFirstChildNextSibling <string> tree = DSBuilder.CreateFirstChildNextSibling_Small();
            int expected = 4;

            // Act
            int actual = tree.Size();

            Assert.AreEqual(expected, actual);
        }
示例#3
0
        static void Opgave2()
        {
            System.Console.WriteLine("\n=====   Opgave 2 : FirstChildNextSibling   =====\n");

            IFirstChildNextSibling <string> tree;

            // Empty tree
            tree = DSBuilder.CreateFirstChildNextSibling_Empty();
            tree.PrintPreOrder();
            System.Console.WriteLine("Size: {0}", tree.Size());
            System.Console.WriteLine(tree);

            // Small tree
            tree = DSBuilder.CreateFirstChildNextSibling_Small();
            tree.PrintPreOrder();
            System.Console.WriteLine("Size: {0}", tree.Size());
            System.Console.WriteLine(tree);

            // Tree from figure 18.3
            tree = DSBuilder.CreateFirstChildNextSibling_18_3();
            tree.PrintPreOrder();
            System.Console.WriteLine("Size: {0}", tree.Size());
            System.Console.WriteLine(tree);
        }