def test_binarysearch_empty(self): L6_result_iterative = binarysearch_iterative(self.L6, self.L6_target) L6_result_recursive = binarysearch_recursive(self.L6, self.L6_target, 0, len(self.L6) - 1) self.assertEqual(L6_result_iterative, self.L6_correct) self.assertEqual(L6_result_recursive, self.L6_correct)
def test_binarysearch_standard(self): L7_result_iterative = binarysearch_iterative(self.L7, self.L7_target) L7_result_recursive = binarysearch_recursive(self.L7, self.L7_target, 0, len(self.L7) - 1) self.assertEqual(L7_result_iterative, self.L7_correct) self.assertEqual(L7_result_recursive, self.L7_correct)
def test_binarysearch_firstvalue(self): L5_result_iterative = binarysearch_iterative(self.L5, self.L5_target) L5_result_recursive = binarysearch_recursive(self.L5, self.L5_target, 0, len(self.L5) - 1) self.assertEqual(L5_result_iterative, self.L5_correct) self.assertEqual(L5_result_recursive, self.L5_correct)
def test_binarysearch_lastvalue(self): L4_result_iterative = binarysearch_iterative(self.L4, self.L4_target) L4_result_recursive = binarysearch_recursive(self.L4, self.L4_target, 0, len(self.L4) - 1) self.assertEqual(L4_result_iterative, self.L4_correct) self.assertEqual(L4_result_recursive, self.L4_correct)
def test_binarysearch_identical(self): L3_result_iterative = binarysearch_iterative(self.L3, self.L3_target) L3_result_recursive = binarysearch_recursive(self.L3, self.L3_target, 0, len(self.L3) - 1) self.assertEqual(L3_result_iterative, self.L3_correct) self.assertEqual(L3_result_recursive, self.L3_correct)
def test_binarysearch_nonexistant(self): L2_result_iterative = binarysearch_iterative(self.L2, self.L2_target) L2_result_recursive = binarysearch_recursive(self.L2, self.L2_target, 0, len(self.L1) - 1) self.assertEqual(L2_result_iterative, self.L2_correct) self.assertEqual(L2_result_recursive, self.L2_correct)
def test_binarysearch_basic(self): L1_result_iterative = binarysearch_iterative(self.L1, self.L1_target) L1_result_recursive = binarysearch_recursive(self.L1, self.L1_target, 0, len(self.L1) - 1) self.assertEqual(L1_result_iterative, self.L1_correct) self.assertEqual(L1_result_recursive, self.L1_correct)