def test_list_with_even_number_elements(self): rc = chop( 1, self.list2 ) self.assertEqual( rc, -1, 'Wrong value when failing to find entry' ) rc = chop( 0, self.list2 ) self.assertEqual( rc, 0, 'Cannot find element when it is first element of list' ) rc = chop( 8, self.list2 ) self.assertEqual( rc, 3, 'Cannot find element when it is last element of list' )
def test_list_with_odd_number_elements(self): rc = chop( 1, self.list3 ) self.assertEqual( rc, -1, 'Wrong value when failing to find entry' ) rc = chop( 0, self.list3 ) self.assertEqual( rc, 0, 'Cannot find element when it is first element of list' ) rc = chop( 255, self.list3 ) self.assertEqual( rc, 4, 'Cannot find element when it is first element of list' )
def test_single_element_list(self): rc = chop( 0, self.list1 ) self.assertEqual( rc, -1, 'Wrong value when failing to find entry' ) rc = chop( 1, self.list1 ) self.assertEqual( rc, 0, 'Wrong element returned' )