Ejemplo n.º 1
0
 def test_search(self):
     arr = [1, 2, 3, 4, 5]
     self.assertEqual(search(arr, 5), 4)
     arr = []
     self.assertEqual(search(arr, 5), None)
     arr = [1, 2, 3, 4, 5]
     self.assertEqual(search(arr, 11), None)
Ejemplo n.º 2
0
 def test_search(self):
     arr = [1, 2, 3, 4, 5]
     self.assertEqual(search(arr, 5), 4)
     arr2 = []
     self.assertEqual(search(arr2, 5), None)
     arr3 = [1, 2, 3]
     self.assertEqual(search(arr3, 4), None)
     arr4 = [1, 2, 3, 4, 5]
     self.assertEqual(search(arr4, 2), 1)
Ejemplo n.º 3
0
 def test_search(self):
     arr = [1, 2, 3, 4, 5]
     self.assertEqual(search(arr, 5), 4)
     arr = []
     self.assertEqual(search(arr, 5), None)
     arr = [2, 4, 6, 8, 10, 12, 14, 16]
     self.assertEqual(search(arr, 10), 4)
     arr = [1, 2, 3, 4, 5, 6, 7]
     self.assertEqual(search(arr, 2), 1)
     self.assertEqual(search(arr, 8), None)
Ejemplo n.º 4
0
 def test_search(self):
     arr = [1, 2, 3, 4, 5]
     self.assertEqual(search(arr, 5), 4)
     arr = []
     self.assertEqual(search(arr, 5), None)
     arr = [1, 2, 3, 4, 5, 6]
     self.assertEqual(search(arr, 6), 5)
     arr = [1, 2, 3, 4, 5, 6]
     self.assertEqual(search(arr, 17), None)
     arr = [1, 2, 3, 4, 5, 6]
     self.assertEqual(search(arr, 2), 1)
Ejemplo n.º 5
0
 def test_search_index_bounds(self):
     arr = [1, 2, 3, 4, 5]
     self.assertEqual(search(arr, 6), None)