Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import unittest
- x= [10,20,15,48,63,52,15,44]
- class SortingALgorithm(unittest.TestCase):
- def __init__(self):
- pass
- def insertionSort(self,A):
- for j in range(2,len(A)):
- key = A[j]
- i = j-1
- while i>0 and A[i] > key:
- A[i+1] = A[i]
- i=i-1
- A[i+1]=key
- return A
- def checkAlgo():
- value= [10, 15, 15, 20, 44, 48, 52, 63]
- self.assertListEqual(value,self.insertionSort(x))
- sorting = SortingALgorithm()
- if __name__=="__main__":
- unittest.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement