Example #1
0
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)
Example #2
0
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)
Example #3
0
 def setUp(self):
     self.tree = BinaryTree()
Example #4
0
 def setUp(self):
     self.t1 = BinaryTree()
     self.t2 = BinaryTree()