Ejemplo n.º 1
0
        public void FirstChildNextSibling_3_BigTree_2_ToStringReturnsProperResult()
        {
            // Arrange
            IFirstChildNextSibling <string> tree = DSBuilder.CreateFirstChildNextSibling_18_3();
            string expected = "a,FC(b,FC(f,NS(g)),NS(c,NS(d,FC(h),NS(e,FC(i,NS(j,FC(k)))))))";

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

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        public void FirstChildNextSibling_3_BigTree_1_SizeReturnsProperResult()
        {
            // Arrange
            IFirstChildNextSibling <string> tree = DSBuilder.CreateFirstChildNextSibling_18_3();
            int expected = 11;

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

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 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);
        }