Exemplo n.º 1
0
 def test_visit_equal_two_same_strings_returns_true(self):
     interpreter = Interpreter("")
     ast_equal = ASTEquals(ASTString("hello"), ASTString("hello"))
     self.assertEqual(interpreter.visit_ast_equals(ast_equal), True)
Exemplo n.º 2
0
 def test_visit_equal_two_different_strings_returns_false(self):
     interpreter = Interpreter("")
     ast_equal = ASTEquals(ASTString("hello"), ASTString("not hello"))
     self.assertEqual(interpreter.visit_ast_equals(ast_equal), False)
Exemplo n.º 3
0
 def test_visit_equal_returns_false(self):
     interpreter = Interpreter("")
     ast_mod = ASTModulus(ASTInteger(16), ASTInteger(5))
     ast_equal = ASTEquals(ast_mod, ASTInteger(2))
     self.assertEqual(interpreter.visit_ast_equals(ast_equal), False)