adding some more tests for insertion sort to compare performance given inputs of varying sizes

This commit is contained in:
Dan Buch 2011-08-15 06:57:09 -04:00
parent f0e703c695
commit 59465b1152

View File

@ -1,3 +1,4 @@
import random
import unittest
import insertion_sort01
@ -14,6 +15,26 @@ class Test(unittest.TestCase):
self.assertEqual(expected, a)
def test_big_example(self):
tmpl = list(range(0, 1000))
a = tmpl[:]
random.shuffle(a)
expected = tmpl[:]
insertion_sort01.insertion_sort(a)
self.assertEqual(expected, a)
def test_bigger_example(self):
tmpl = list(range(0, 10000))
a = tmpl[:]
random.shuffle(a)
expected = tmpl[:]
insertion_sort01.insertion_sort(a)
self.assertEqual(expected, a)
if __name__ == '__main__':
unittest.main()