mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
25 lines
444 B
Python
25 lines
444 B
Python
import unittest
|
|
|
|
|
|
class TestHeight(unittest.TestCase):
|
|
|
|
def test_height(self):
|
|
bst = BstHeight(Node(5))
|
|
self.assertEqual(bst.height(bst.root), 1)
|
|
bst.insert(2)
|
|
bst.insert(8)
|
|
bst.insert(1)
|
|
bst.insert(3)
|
|
self.assertEqual(bst.height(bst.root), 3)
|
|
|
|
print('Success: test_height')
|
|
|
|
|
|
def main():
|
|
test = TestHeight()
|
|
test.test_height()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|