-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsorttest.py
More file actions
32 lines (25 loc) · 919 Bytes
/
sorttest.py
File metadata and controls
32 lines (25 loc) · 919 Bytes
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
31
32
import radixsort, mergesort, quicksort, bubblesort
import unittest
TEST_URLS = './test_urls.txt'
class RadixTestCase(unittest.TestCase):
def setUp(self):
# Set up test list of urls
# sort the list using a python library and store in this object
f = open(TEST_URLS, 'r')
self.unsorted = list(url.strip(' \n') for url in f)
self.expected = list(self.unsorted)
self.expected.sort()
def test_radix(self):
retlist = radixsort.sort(self.unsorted)
self.assertEqual(retlist, self.expected)
def test_merge(self):
retlist = mergesort.sort(self.unsorted)
self.assertEqual(retlist, self.expected)
def test_quicksort(self):
retlist = quicksort.sort(self.unsorted)
self.assertEqual(retlist, self.expected)
def test_bubblesort(self):
retlist = bubblesort.sort(self.unsorted)
self.assertEqual(retlist, self.expected)
if __name__ == '__main__':
unittest.main()