Ejemplo n.º 1
0
 def test_Calculate_Solution(self):
     sol = Solution()
     self.assertEqual('III', sol.intToRoman(3))
     self.assertEqual('IV', sol.intToRoman(4))
     self.assertEqual('IX', sol.intToRoman(9))
     self.assertEqual('LVIII', sol.intToRoman(58))
     self.assertEqual('MCMXCIV', sol.intToRoman(1994))
Ejemplo n.º 2
0
class IntegerToRomanTest(unittest.TestCase):
    def setUp(self):
        self.sln = Solution()

    def test_zero(self):
        self.assertEqual("", self.sln.intToRoman(0))

    def test_one_to_five(self):
        # self.assertEqual("I", self.sln.intToRoman(1))
        self.assertEqual("II", self.sln.intToRoman(2))
        self.assertEqual("III", self.sln.intToRoman(3))
        self.assertEqual("IV", self.sln.intToRoman(4))
        self.assertEqual("V", self.sln.intToRoman(5))

    def test_leetcode(self):
        self.assertEquals("IX", self.sln.intToRoman(9))
        self.assertEquals("LVIII", self.sln.intToRoman(58))
        self.assertEquals("MCMXCIV", self.sln.intToRoman(1994))
        self.assertEquals("MMMCMXCIX", self.sln.intToRoman(3999))

    def test_leetcode_fails(self):
        self.assertEquals("X", self.sln.intToRoman(10))
Ejemplo n.º 3
0
 def testInputBiggerThan50NotRoundNumber(self):
     input = 96
     expectedResult = "XCVI"
     solution = Solution()
     actualSolution = solution.intToRoman(input)
     self.assertEqual(expectedResult, actualSolution)
Ejemplo n.º 4
0
 def testInputBiggerThan50RoundNumber(self):
     input = 80
     expectedResult = 'LXXX'
     solution = Solution()
     actualSolution = solution.intToRoman(input)
     self.assertEqual(expectedResult, actualSolution)
Ejemplo n.º 5
0
 def testInputBiggerThan50(self):
     input = 61
     expectedResult = 'LXI'
     solution = Solution()
     actualSolution = solution.intToRoman(input)
     self.assertEqual(expectedResult, actualSolution)
Ejemplo n.º 6
0
 def testInputSmallerThan50NotRound2(self):
     input = 48
     expectedResult = "XLVIII"
     solution = Solution()
     actualSolution = solution.intToRoman(input)
     self.assertEqual(expectedResult, actualSolution)
Ejemplo n.º 7
0
 def testInputSmallerThan50(self):
     input = 20
     expectedResult = 'XX'
     solution = Solution()
     actualSolution = solution.intToRoman(input)
     self.assertEqual(expectedResult, actualSolution)
Ejemplo n.º 8
0
 def testInputEqualTo50(self):
     input = 50
     expectedResult = 'L'
     solution = Solution()
     actualSolution = solution.intToRoman(input)
     self.assertEqual(expectedResult, actualSolution)
Ejemplo n.º 9
0
 def testBiggerThan4SamllerThan10(self):
     input = 8
     expectedResult = 'VIII'
     solution = Solution()
     actualSolution = solution.intToRoman(input)
     self.assertEqual(expectedResult, actualSolution)