import unittest from reverse_integer import Solution s = Solution() class TestUM(unittest.TestCase): def setUp(self): pass def test_123(self): self.assertEqual(s.reverse(123), 321) def test_m123(self): self.assertEqual(s.reverse(-321), -123) def test_100(self): self.assertEqual(s.reverse(100), 1) if __name__ == '__main__': unittest.main()
def test_reverse(self): _input = -32487249 out = -94278423 self.assertEqual(out, Solution().reverse(_input))
def TestReverseInteger(): solut = Solution() assert solut.reverse(-123) == -321 assert solut.reverse(123) == 321 assert solut.reverse(120) == 21
def test_reverse_integer(self): solution = Solution() self.assertEqual(solution.reverse(123), 321) self.assertEqual(solution.reverse(-123), -321) self.assertEqual(solution.reverse(+123), 321) self.assertEqual(solution.reverse(120), 21) self.assertEqual(solution.reverse(0), 0) self.assertEqual(solution.reverse(1534236469), 0) self.assertEqual(solution.reverse_math(123), 321) self.assertEqual(solution.reverse_math(-123), -321) self.assertEqual(solution.reverse_math(+123), 321) self.assertEqual(solution.reverse_math(120), 21) self.assertEqual(solution.reverse_math(0), 0) self.assertEqual(solution.reverse_math(1534236469), 0)
def testReverseString(self): self.assertEqual(Solution().reverse(4321), 1234) self.assertEqual(Solution().reverse(-4321), -1234) self.assertEqual(Solution().reverse(1000), 1) self.assertEqual(Solution().reverse(1563847412), 0) self.assertEqual(Solution().reverse(-1563847412), 0)
def test(self): solution = Solution() self.assertEqual(solution.reverse(123), 321)
def test_zero(self): solution = Solution() self.assertEqual(solution.reverse(0), 0)
def test_leading_zero(self): solution = Solution() self.assertEqual(solution.reverse(120), 21)
def test_negative(self): solution = Solution() self.assertEqual(solution.reverse(-123), -321)