-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathtests.py
57 lines (53 loc) · 1.46 KB
/
tests.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import numpy
import sys
sys.path.insert(0, 'sorting')
nums = numpy.random.randint(100, size=20).tolist()
sortedNums = sorted(nums)
try:
from bubble import bubble
if(bubble(list(nums)) == sortedNums):
print "bubblesort success!"
else:
print "bubblesort incorrect."
except:
print "bubblesort function errored or is incomplete."
try:
from insertion import insertion
if(insertion(list(nums)) == sortedNums):
print "insertionsort success!"
else:
print "insertionsort incorrect."
except:
print "insertionsort function errored or is incomplete."
try:
from merge import mergesort
if(mergesort(list(nums)) == sortedNums):
print "mergesort success!"
else:
print "mergesort incorrect."
except:
print "mergesort function errored or is incomplete."
try:
from quick import quick
if(quick(list(nums)) == sortedNums):
print "quicksort success!"
else:
print "quicksort incorrect."
except:
print "quicksort function errored or is incomplete."
try:
from heap import heap
if(heap(list(nums)) == sortedNums):
print "Heap Sort success!"
else:
print "Heap Sort incorrect."
except:
print "Heapsort function errored or is incomplete."
try:
from bucket import bucket
if(bucket(list(nums)) == sortedNums):
print "Bucket Sort success"
else:
print "Bucket Sort incorrect"
except:
print "Bucketsort function errored or is incomplete"