コード例 #1
0
 def test_semi_digit_1(self):
     cases = ["12", "343", "2452525", "543442424"]
     for d in cases:
         self.assertEqual(Parser.string_to_result(d), int(d))
コード例 #2
0
 def test_one_digit(self):
     cases = ["0", "1", "7"]
     for d in cases:
         self.assertEqual(Parser.string_to_result(d), int(d))
コード例 #3
0
    def test_1(self):
        cases = {"+ * 2 4 3": 11, "- + 2 3 + 0 2": 3, "+ 0 * 1 0": 0, "- - - 4 2 1 8": -7, "* + 3 5 10": 80}

        for s, r in cases.items():
            self.assertEqual(Parser.string_to_result(s), r)