def test_double_x(self):
     self.assertEqual(RomanToInt.convert('III'), 3)
     self.assertEqual(RomanToInt.convert('IV'), 4)
     self.assertEqual(RomanToInt.convert('IX'), 9)
     self.assertEqual(RomanToInt.convert('XX'), 20)
     self.assertEqual(RomanToInt.convert('XXVII'), 27)
     self.assertEqual(RomanToInt.convert('XXX'), 30)
     self.assertEqual(RomanToInt.convert('XL'), 40)
     self.assertEqual(RomanToInt.convert('XC'), 90)
    def test_single_x(self):
        lst_letter = ['I', 'V', 'X', 'L', 'C', 'D', 'M']
        lst_number = [1, 5, 10, 50, 100, 500, 1000]

        for letter, number in zip(lst_letter, lst_number):
            self.assertEqual(RomanToInt.convert(letter), number)
Beispiel #3
0
 def test_single_I(self):
     self.assertEqual(RomanToInt.convert('I'), 1)
Beispiel #4
0
 def test_composite_LXV(self):
     self.assertEqual(RomanToInt.convert('LXV'), 65)
Beispiel #5
0
 def test_composite_MMMD(self):
     self.assertEqual(RomanToInt.convert('MMMD'), 3500)
Beispiel #6
0
 def test_single_M(self):
     self.assertEqual(RomanToInt.convert('M'), 1000)
Beispiel #7
0
 def test_single_D(self):
     self.assertEqual(RomanToInt.convert('D'), 500)
Beispiel #8
0
 def test_single_L(self):
     self.assertEqual(RomanToInt.convert('L'), 50)
Beispiel #9
0
 def test_single_X(self):
     self.assertEqual(RomanToInt.convert('X'), 10)
Beispiel #10
0
 def test_single_V(self):
     self.assertEqual(RomanToInt.convert('V'), 5)