public void findEmptyChildInCurrentNodeChildren() { Problem3 p3 = new Problem3(); Node expected = new Node(3); p3.addNode(2, p3._head); p3.addNode(1, p3._head); p3.addNode(1, p3._head); Node actual = p3.findEmptyChild(p3._head, expected); Node expectedNode = p3._head.children[0].children[0]; Assert.AreEqual(expected, actual, "Empty child not found"); Assert.AreEqual(expectedNode, actual, "Node not placed in empty child"); }
public void findEmptyChildInCurrentNodeSecondChild() { Problem3 p3 = new Problem3(); Node expected = new Node(3); p3.addNode(2, p3._head); p3.addNode(2, p3._head); p3.addNode(1, p3._head); p3.addNode(1, p3._head); Node actual = p3.findEmptyChild(p3._head, expected); Node expectedNode = p3._head.children[0].children[1]; //because we always go down left path Assert.AreEqual(expected, actual, "Empty child not found"); Assert.AreEqual(expectedNode, actual, "Node not placed in empty child"); }