コード例 #1
0
 def test_maxsubarray_allpositive(self):
     arr = [1, 1, 1]
     expected = (0, 2, 3)
     actual = dac.find_max_subarray(arr, 0, 2)
     self.assertEqual(expected, actual)
コード例 #2
0
 def test_maxsubarray_allnegative(self):
     arr = [-3, -1, -3]
     expected = (1, 1, -1)
     actual = dac.find_max_subarray(arr, 0, 2)
     self.assertEqual(expected, actual)
コード例 #3
0
 def test_maxsubarray_singleelement(self):
     actual = dac.find_max_subarray([3], 0, 0)
     expected = (0, 0, 3)
     self.assertEqual(expected, actual)