forked from supix/ex_roman_to_arabic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_01.py
100 lines (55 loc) · 2.59 KB
/
test_01.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import unittest
from main import convert_roman_to_arabic
class MyTestCase(unittest.TestCase):
def test_trailing_A_is_recognized_as_an_invalid_symbol(self):
with self.assertRaises(ValueError):
convert_roman_to_arabic('XIIIA')
def test_leading_B_is_recognized_as_an_invalid_symbol(self):
with self.assertRaises(ValueError):
convert_roman_to_arabic('BXX')
def test_mid_F_is_recognized_as_an_invalid_symbol(self):
with self.assertRaises(ValueError):
convert_roman_to_arabic('XFX')
def test_space_is_recognized_as_an_invalid_symbol(self):
with self.assertRaises(ValueError):
convert_roman_to_arabic('X X')
def test_XIII_is_13(self):
self.assertEqual(convert_roman_to_arabic('XIII'), '13')
def test_MDCLXVI_is_1666(self):
self.assertEqual(convert_roman_to_arabic('MDCLXVI'), '1666')
def test_XXI_is_21(self):
self.assertEqual(convert_roman_to_arabic('XXI'), '21')
def test_LIX_is_59(self):
self.assertEqual(convert_roman_to_arabic('LIX'), '59')
def test_XCI_is_91(self):
self.assertEqual(convert_roman_to_arabic('XCI'), '91')
def test_LXXXIX_is_89(self):
self.assertEqual(convert_roman_to_arabic('LXXXIX'), '89')
def test_XCV_is_95(self):
self.assertEqual(convert_roman_to_arabic('XCV'), '95')
def test_LXXXIV_is_84(self):
self.assertEqual(convert_roman_to_arabic('LXXXIV'), '84')
def test_LXIV_is_64(self):
self.assertEqual(convert_roman_to_arabic('LXIV'), '64')
def test_C_is_100(self):
self.assertEqual(convert_roman_to_arabic('C'), '100')
def test_LXX_is_70(self):
self.assertEqual(convert_roman_to_arabic('LXX'), '70')
def test_XIV_is_14(self):
self.assertEqual(convert_roman_to_arabic('XIV'), '14')
def test_LXIX_is_69(self):
self.assertEqual(convert_roman_to_arabic('LXIX'), '69')
def test_XCVIII_is_98(self):
self.assertEqual(convert_roman_to_arabic('XCVIII'), '98')
def test_CIX_is_109(self):
self.assertEqual(convert_roman_to_arabic('CIX'), '109')
def test_DCCLXXXVI_is_786(self):
self.assertEqual(convert_roman_to_arabic('DCCLXXXVI'), '786')
def test_MCCXCVIII_is_1298(self):
self.assertEqual(convert_roman_to_arabic('MCCXCVIII'), '1298')
def test_MMXVII_is_2018(self):
self.assertEqual(convert_roman_to_arabic('MMXVIII'), '2018')
def test_MCMLXXXIV_is_1984(self):
self.assertEqual(convert_roman_to_arabic('MCMLXXXIV'), '1984')
if __name__ == '__main__':
unittest.main()