-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_merge_sort.py
30 lines (27 loc) · 994 Bytes
/
test_merge_sort.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import unittest
from merge_sort import merge_sort
from insertion_sort import insertion_sort
class Test_Sorting(unittest.TestCase):
def test_empty(self):
inp = []
self.assertEqual(merge_sort(inp),sorted(inp))
def test_singel_element(self):
inp = [1]
self.assertEqual(merge_sort(inp),sorted(inp))
def test_two_elements(self):
inp = [2, 1]
self.assertEqual(merge_sort(inp),sorted(inp))
def test_three_elements(self):
inp = [13, 7, 5]
self.assertEqual(merge_sort(inp),sorted(inp))
def test_four(self):
inp = [23, 7, 13, 5]
self.assertEqual(merge_sort(inp),sorted(inp))
def test_large_nums(self):
inp = [135604, 1000000, 45, 78435, 456219832, 2, 546]
self.assertEqual(merge_sort(inp),sorted(inp))
def test_more_inps(self):
inp = [1, 2, 2, 1, 0, 0, 15, 15]
self.assertEqual(merge_sort(inp),sorted(inp))
if __name__ == "__main__":
unittest.main()