-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathtest2.py
More file actions
32 lines (22 loc) · 971 Bytes
/
test2.py
File metadata and controls
32 lines (22 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import unittest
from program2 import Solution
class TestRomanToInt(unittest.TestCase):
def setUp(self):
self.solution = Solution()
def test_example1(self):
self.assertEqual(self.solution.romanToInt("III"), 3)
def test_example2(self):
self.assertEqual(self.solution.romanToInt("LVIII"), 58)
def test_example3(self):
self.assertEqual(self.solution.romanToInt("MCMXCIV"), 1994)
def test_single_roman_digit(self):
self.assertEqual(self.solution.romanToInt("X"), 10)
def test_subtraction_rule(self):
self.assertEqual(self.solution.romanToInt("IV"), 4)
self.assertEqual(self.solution.romanToInt("IX"), 9)
def test_large_number(self):
self.assertEqual(self.solution.romanToInt("MMMCMXCIX"), 3999)
def test_empty_string(self):
self.assertEqual(self.solution.romanToInt(""), 0)
if __name__ == '__main__':
unittest.main(argv=['first-arg-is-ignored'], exit=False)