예제 #1
0
 def test_all(self):
     for number in range(1, 4000):
         d_to_r = DecimalToRoman()
         print(number)
         roman = d_to_r.decimal_to_roman(number)
         print(roman)
         result_number = roman_to_decimal(roman)
         print(result_number)
         self.assertEquals(number, result_number)
예제 #2
0
 def test_roman_to_decimal_1(self):
     result = roman_to_decimal("I")
     self.assertEqual(result, 1)
예제 #3
0
 def test_roman_to_decimal_94(self):
     result = roman_to_decimal("XCIV")
     self.assertEqual(result, 94)
예제 #4
0
 def test_roman_to_decimal_3191(self):
     result = roman_to_decimal("MMMCXCI")
     self.assertEqual(result, 3191)
예제 #5
0
 def test_roman_to_decimal_28(self):
     result = roman_to_decimal("XXVIII")
     self.assertEqual(result, 28)
예제 #6
0
 def test_roman_to_decimal_19(self):
     result = roman_to_decimal("XIX")
     self.assertEqual(result, 19)
예제 #7
0
 def test_roman_to_decimal_15(self):
     result = roman_to_decimal("XV")
     self.assertEqual(result, 15)
예제 #8
0
 def test_roman_to_decimal_9(self):
     result = roman_to_decimal("IX")
     self.assertEqual(result, 9)
예제 #9
0
 def test_roman_to_decimal_5(self):
     result = roman_to_decimal("V")
     self.assertEqual(result, 5)
예제 #10
0
 def test_roman_to_decimal_4(self):
     result = roman_to_decimal("IV")
     self.assertEqual(result, 4)
예제 #11
0
 def test_roman_II_to_decimal(self):
     decimal_number = roman_to_decimal("II")
     self.assertEqual(decimal_number, 2)
예제 #12
0
#!/bin/python

import roman_to_decimal as r2d
import decimal_to_roman as d2r

import random

t = random.randint(10, 100)

while t:
    t = t - 1
    d = random.randint(1, 3999)
    r = d2r.roman_representation(d)
    d1 = r2d.roman_to_decimal(r)
    print d, r, d1
    try:
        assert(d == d1)
    except AssertionError:
        print d, r, d1
        break