mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-04 00:18:02 +00:00
Add math ops challenge
This commit is contained in:
33
online_judges/math_ops/test_math_ops.py
Normal file
33
online_judges/math_ops/test_math_ops.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from nose.tools import assert_equal, assert_true, assert_raises
|
||||
|
||||
|
||||
class TestMathOps(object):
|
||||
|
||||
def test_math_ops(self):
|
||||
solution = Solution()
|
||||
assert_raises(TypeError, solution.insert, None)
|
||||
solution.insert(5)
|
||||
solution.insert(2)
|
||||
solution.insert(7)
|
||||
solution.insert(9)
|
||||
solution.insert(9)
|
||||
solution.insert(2)
|
||||
solution.insert(9)
|
||||
solution.insert(4)
|
||||
solution.insert(3)
|
||||
solution.insert(3)
|
||||
solution.insert(2)
|
||||
assert_equal(solution.max, 9)
|
||||
assert_equal(solution.min, 2)
|
||||
assert_equal(solution.mean, 5)
|
||||
assert_true(solution.mode in (2, 92))
|
||||
print('Success: test_math_ops')
|
||||
|
||||
|
||||
def main():
|
||||
test = TestMathOps()
|
||||
test.test_math_ops()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user