def test_min(self): arr = [i for i in range(10)] self.assertEqual(min_search(arr), min(arr), "Minimal element is wrong, right answer: " + str(min(arr))) arr = [i for i in range(10, -3, -1)] self.assertEqual(min_search(arr), min(arr), "Minimal element is wrong, right answer: " + str(min(arr))) arr = np.random.rand(1, 300).tolist() self.assertEqual(min_search(arr), min(arr), "Minimal element is wrong, right answer: " + str(min(arr)))
def test_min_one_more(self): arr = [random.randint(-100, 100) for _ in range(300)] self.assertEqual( min_search(arr), arr.index(min(arr)), "Minimal element is wrong, right answer: " + str(min(arr)))
def test_min(self): arr = [i for i in range(1, 10)] self.assertEqual( min_search(arr), 0, "Minimal element is wrong, right answer: " + str(min(arr)))
def check_min(self, arr): min_index = arr.index(min(arr)) self.assertEqual(min_index, min_search(arr), self.errstr + str(min_index))