Skip to content

Commit 901297f

Browse files
test for sorting
1 parent 574b078 commit 901297f

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

Algorithm_tests/sorting_tests/test_sorting.py

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,41 @@
1-
# import alla sorting algoritms
1+
# Import folder where sorting algorithms
2+
import sys
3+
sys.path.append('../../Algorithms/sorting')
4+
5+
# from bubblesort import bubblesort
6+
7+
from bubblesort import bubblesort
28

39
L1 = [1,2,3,4,5,6,7,8,9]
4-
L1_sorted = []
10+
L1_sorted = sorted(L1)
11+
512
L2 = [9,8,7,6,5,4,3,2,1]
6-
L2_sorted = []
13+
L2_sorted = sorted(L2)
14+
715
L3 = [1,1,1,1,1,1,1,1,1]
8-
L3_sorted = []
16+
L3_sorted = sorted(L3)
17+
918
L4 = [6,7,3,5,1,3]
10-
L4_sorted = [1,3,3,5,6,7]
19+
L4_sorted = sorted(L4)
20+
1121
L5 = []
1222
L5_sorted = []
1323

1424

1525
# Bubblesort
16-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
17-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
18-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
19-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
20-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
26+
def test_bubblesort():
27+
assert bubblesort(L1) == L1_sorted, "Not correctly sorted"
28+
assert bubblesort(L4) == L4_sorted, "Not correctly sorted"
29+
assert bubblesort(L4) == L4_sorted, "Not correctly sorted"
30+
assert bubblesort(L4) == L4_sorted, "Not correctly sorted"
31+
assert bubblesort(L4) == L4_sorted, "Not correctly sorted"
2132

2233
# Selectionsort
23-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
24-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
25-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
26-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
27-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
34+
# assert sorted(L4) == L4_sorted, "Not correctly sorted"
35+
# assert sorted(L4) == L4_sorted, "Not correctly sorted"
36+
# assert sorted(L4) == L4_sorted, "Not correctly sorted"
37+
# assert sorted(L4) == L4_sorted, "Not correctly sorted"
38+
# assert sorted(L4) == L4_sorted, "Not correctly sorted"
2839

2940
# Heapsort
3041

0 commit comments

Comments
 (0)