def test_nondecreasing(self): arr = [1] for i in range(1, 10000): arr.append(arr[i - 1] + int(random.randint(0, 1000))) res = solve(arr) expexted = 0 self.assertEqual(expexted, res)
def test_nonincreasing(self): arr = [1] for i in range(1, 10): arr.append(arr[i - 1] + int(random.randint(0, 10))) new_arr = [i for i in reversed(arr)] res = solve(new_arr) expexted = 0 self.assertEqual(expexted, res)
def test_not_trivial(self): arr = [1, 2, 3, 1, 4, 3, 2, 1, 2, 3, 4, 1, 2, 3, 2] res = solve(arr) expected = int(14) self.assertEqual(expected, res)
def test_trivial_1(self): arr = [2, 1, 2] res = solve(arr) expected = int(1) self.assertEqual(expected, res)
def test_equal(self): arr = [int(99999999) for i in range(0, 10000)] res = solve(arr) expexted = 0 self.assertEqual(expexted, res)
def test_empty(self): arr = [] res = solve(arr) expected = 0 self.assertEqual(expected, res)
def test_trivial_5(self): arr = [3, 4, 2, 5, 1, 5, 2, 2] res = solve(arr) expected = int(6) self.assertEqual(expected, res)
def test_trivial_3(self): arr = [1, 2, 2, 1, 1, 1, 2, 5] res = solve(arr) expected = int(3) self.assertEqual(expected, res)
def test_trivial_2(self): arr = [1, 2, 2, 1, 5, 1, 2, 2] res = solve(arr) expected = int(2) self.assertEqual(expected, res)