mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-04 00:18:02 +00:00
Add max profit challenge
This commit is contained in:
21
online_judges/max_profit/test_max_profit.py
Normal file
21
online_judges/max_profit/test_max_profit.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from nose.tools import assert_equal, assert_raises
|
||||
|
||||
|
||||
class TestMaxProfit(object):
|
||||
|
||||
def test_max_profit(self):
|
||||
solution = Solution()
|
||||
assert_raises(TypeError, solution.find_max_profit, None)
|
||||
assert_raises(ValueError, solution.find_max_profit, [])
|
||||
assert_equal(solution.find_max_profit([8, 5, 3, 2, 1]), -1)
|
||||
assert_equal(solution.find_max_profit([5, 3, 7, 4, 2, 6, 9]), 7)
|
||||
print('Success: test_max_profit')
|
||||
|
||||
|
||||
def main():
|
||||
test = TestMaxProfit()
|
||||
test.test_max_profit()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user