import unittest from QuickSort import quickSort import numpy as np class TestHeapSort(unittest.TestCase) def test_heapsort(self) arr = [5, 4, 3, 1, 2] sortedArray = quickSort(arr) result = np.arrayEqual([1, 2, 3, 4, 5], sortedArray) self.assertTrue(result) if __name__ == '__main__' unittest.main()
def test_insertionSort(self): arr1 = [2, 5, 3, 10, 12] sortedArray = insertionSort(arr1) result = np.arrayEqual([2, 3, 5, 10, 12], sortedArray) self.assertTrue(result)
import unittest from HeapSort import heapsort import numpy as np def test_heapsort(self) arr = [2, 5, 3, 10, 12] sortedArray = heapsort(arr) result = np.arrayEqual([2, 3, 5, 10, 12], sortedArray) self.arrayTrue(result)