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)
def test_roman_to_decimal_1(self): result = roman_to_decimal("I") self.assertEqual(result, 1)
def test_roman_to_decimal_94(self): result = roman_to_decimal("XCIV") self.assertEqual(result, 94)
def test_roman_to_decimal_3191(self): result = roman_to_decimal("MMMCXCI") self.assertEqual(result, 3191)
def test_roman_to_decimal_28(self): result = roman_to_decimal("XXVIII") self.assertEqual(result, 28)
def test_roman_to_decimal_19(self): result = roman_to_decimal("XIX") self.assertEqual(result, 19)
def test_roman_to_decimal_15(self): result = roman_to_decimal("XV") self.assertEqual(result, 15)
def test_roman_to_decimal_9(self): result = roman_to_decimal("IX") self.assertEqual(result, 9)
def test_roman_to_decimal_5(self): result = roman_to_decimal("V") self.assertEqual(result, 5)
def test_roman_to_decimal_4(self): result = roman_to_decimal("IV") self.assertEqual(result, 4)
def test_roman_II_to_decimal(self): decimal_number = roman_to_decimal("II") self.assertEqual(decimal_number, 2)
#!/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