public void InOrderNull() { ///Testing In order on empty tree BT testTree = new BT(); Assert.Null(BT.IOrder(testTree.Root)); }
public void InOrderEvenBT() { /// Testing In order traversal on even amoutn of branches BT testTree = new BT(); testTree.Root = new Nodeb(100); Nodeb leftChild = new Nodeb(5); testTree.Root.Left = leftChild; Nodeb rightChild = new Nodeb(10); testTree.Root.Right = rightChild; List <int> expected = new List <int> { 5, 100, 10 }; Assert.Equal(expected, BT.IOrder(testTree.Root)); }
public void InOrderOddBT() { /// Testing in order traversal on odd number of branches BT testTree = new BT(); testTree.Root = new Nodeb(100); Nodeb leftChild = new Nodeb(5); testTree.Root.Left = leftChild; Nodeb rightChild = new Nodeb(10); testTree.Root.Right = rightChild; Nodeb leftRightLeaf = new Nodeb(20); testTree.Root.Left.Right = leftRightLeaf; List <int> expected = new List <int> { 5, 20, 100, 10 }; Assert.Equal(expected, BT.IOrder(testTree.Root)); }