class TestP2(unittest.TestCase): def setUp(self): self.tree = BinaryTree() def tearDown(self): self.tree = None def test_p2(self): arr = [] for x in range(0, 21): arr.append(x) p2(arr, self.tree) arr.clear() for x in range(0, 21): arr.append(x) self.assertEqual(self.tree.arrify(), arr)
class TestP3(unittest.TestCase): def setUp(self): self.tree = BinaryTree() def tearDown(self): self.tree = None def test_p3(self): self.tree.add(BTNode(5)) for x in range(10): self.tree.add(BTNode(x)) self.assertEqual(len(p3(self.tree)), 6) def test_p3_D2(self): self.tree.add(BTNode(5)) self.tree.add(BTNode(2)) self.tree.add(BTNode(7)) self.assertEqual(len(p3(self.tree)), 2)
def setUp(self): self.tree = BinaryTree()
def setUp(self): self.t1 = BinaryTree() self.t2 = BinaryTree()