def test_sample(self): self.assertEqual(1, binarysearch.search([0,1,2], 1))
def test_one_element_in_list(self): self.assertEqual(0, binarysearch.search([1], 0))
def element_not_in_list(self): self.assertEqual(None, binarysearch.search([1, 2, 3], 3))
def element_in_list_of_many(self): self.assertEqual(1, binarysearch.search([1, 2, 3, 4], 1))
def test_lots(self): self.assertEqual(4, binarysearch.search([0, 5, 10, 15, 20, 25, 30, 35], 20))
def test_five(self): self.assertEqual(2, binarysearch.search([0, 1, 2, 3, 4], 2))
def test_none(self): self.assertEqual(None, binarysearch.search([], 1))
def test_words(self): self.assertEqual(0, binarysearch.search(["zebra", "horse"], "zebra"))
def test_beginning(self): self.assertEqual(0, binarysearch.search([0,1,2], 0))
def test_one(self): self.assertEqual(0, binarysearch.search([0], 0))
def test_end(self): self.assertEqual(2, binarysearch.search([0,1,2], 2))
def test_nonexistent(self): self.assertEqual(None, binarysearch.search([0,1,2], 666))
def test_empty(self): self.assertEqual(None, binarysearch.search([], 666))
def test_unit_length_list(self): self.assertEqual(0, binarysearch.search([666], 666))
def test_2items(self): self.assertEqual(1, binarysearch.search([0,1], 1))