def test_chop(self): self.assertEqual(-1, KataTwo.chop(3, [])) self.assertEqual(-1, KataTwo.chop(3, [1])) self.assertEqual(0, KataTwo.chop(1, [1])) # self.assertEqual(0, KataTwo.chop(1, [1, 3, 5])) self.assertEqual(1, KataTwo.chop(3, [1, 3, 5])) self.assertEqual(2, KataTwo.chop(5, [1, 3, 5])) self.assertEqual(-1, KataTwo.chop(0, [1, 3, 5])) self.assertEqual(-1, KataTwo.chop(2, [1, 3, 5])) self.assertEqual(-1, KataTwo.chop(4, [1, 3, 5])) self.assertEqual(-1, KataTwo.chop(6, [1, 3, 5])) # self.assertEqual(0, KataTwo.chop(1, [1, 3, 5, 7])) self.assertEqual(1, KataTwo.chop(3, [1, 3, 5, 7])) self.assertEqual(2, KataTwo.chop(5, [1, 3, 5, 7])) self.assertEqual(3, KataTwo.chop(7, [1, 3, 5, 7])) self.assertEqual(-1, KataTwo.chop(0, [1, 3, 5, 7])) self.assertEqual(-1, KataTwo.chop(2, [1, 3, 5, 7])) self.assertEqual(-1, KataTwo.chop(4, [1, 3, 5, 7])) self.assertEqual(-1, KataTwo.chop(6, [1, 3, 5, 7])) self.assertEqual(-1, KataTwo.chop(8, [1, 3, 5, 7]))
def test_chopSliceIterative(self): self.assertEqual(-1, KataTwo.chopSliceIterative(3, [])) self.assertEqual(-1, KataTwo.chopSliceIterative(3, [1])) self.assertEqual(0, KataTwo.chopSliceIterative(1, [1])) # self.assertEqual(0, KataTwo.chopSliceIterative(1, [1, 3, 5])) self.assertEqual(1, KataTwo.chopSliceIterative(3, [1, 3, 5])) self.assertEqual(2, KataTwo.chopSliceIterative(5, [1, 3, 5])) self.assertEqual(-1, KataTwo.chopSliceIterative(0, [1, 3, 5])) self.assertEqual(-1, KataTwo.chopSliceIterative(2, [1, 3, 5])) self.assertEqual(-1, KataTwo.chopSliceIterative(4, [1, 3, 5])) self.assertEqual(-1, KataTwo.chopSliceIterative(6, [1, 3, 5])) # self.assertEqual(0, KataTwo.chopSliceIterative(1, [1, 3, 5, 7])) self.assertEqual(1, KataTwo.chopSliceIterative(3, [1, 3, 5, 7])) self.assertEqual(2, KataTwo.chopSliceIterative(5, [1, 3, 5, 7])) self.assertEqual(3, KataTwo.chopSliceIterative(7, [1, 3, 5, 7])) self.assertEqual(-1, KataTwo.chopSliceIterative(0, [1, 3, 5, 7])) self.assertEqual(-1, KataTwo.chopSliceIterative(2, [1, 3, 5, 7])) self.assertEqual(-1, KataTwo.chopSliceIterative(4, [1, 3, 5, 7])) self.assertEqual(-1, KataTwo.chopSliceIterative(6, [1, 3, 5, 7])) self.assertEqual(-1, KataTwo.chopSliceIterative(8, [1, 3, 5, 7]))