Skip to content

Commit b096dc0

Browse files
committed
⏪ Revert assertion change to linear_search
linear_search is meant to return the index of the value and not the value itself, the initial test cases were correct and I misunderstood the expected return
1 parent 50acf9d commit b096dc0

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

‎src/iterative_sorting/test_iterative.py‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
import random
33
from iterative_sorting import *
44

5-
65
class IterativeSortingTest(unittest.TestCase):
76
def test_selection_sort(self):
87
arr1 = [1, 5, 8, 4, 2, 9, 6, 0, 3, 7]
98
arr2 = []
109
arr3 = [0, 1, 2, 3, 4, 5]
1110
arr4 = random.sample(range(200), 50)
1211

13-
self.assertEqual(selection_sort(arr1), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
12+
self.assertEqual(selection_sort(arr1), [0,1,2,3,4,5,6,7,8,9])
1413
self.assertEqual(selection_sort(arr2), [])
15-
self.assertEqual(selection_sort(arr3), [0, 1, 2, 3, 4, 5])
14+
self.assertEqual(selection_sort(arr3), [0,1,2,3,4,5])
1615
self.assertEqual(selection_sort(arr4), sorted(arr4))
1716

1817
def test_bubble_sort(self):
@@ -21,10 +20,10 @@ def test_bubble_sort(self):
2120
arr3 = [0, 1, 2, 3, 4, 5]
2221
arr4 = random.sample(range(200), 50)
2322

24-
self.assertEqual(bubble_sort(arr1), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
23+
self.assertEqual(bubble_sort(arr1), [0,1,2,3,4,5,6,7,8,9])
2524
self.assertEqual(bubble_sort(arr2), [])
26-
self.assertEqual(bubble_sort(arr3), [0, 1, 2, 3, 4, 5])
27-
self.assertEqual(bubble_sort(arr4), sorted(arr4))
25+
self.assertEqual(bubble_sort(arr3), [0,1,2,3,4,5])
26+
self.assertEqual(selection_sort(arr4), sorted(arr4))
2827

2928
# Uncomment this test to test your count_sort implementation
3029
# def test_counting_sort(self):

‎src/searching/test_searching.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ def test_linear_search(self):
88
arr2 = []
99

1010
self.assertEqual(linear_search(arr1, 6), -1)
11-
self.assertEqual(linear_search(arr1, -6), -6)
12-
self.assertEqual(linear_search(arr1, 0), 0)
11+
self.assertEqual(linear_search(arr1, -6), 8)
12+
self.assertEqual(linear_search(arr1, 0), 6)
1313
self.assertEqual(linear_search(arr2, 3), -1)
1414

1515
def test_binary_search(self):

0 commit comments

Comments
 (0)