Skip to content
Snippets Groups Projects
Commit e82f08a2 authored by Chris's avatar Chris
Browse files

Name Shadowing beendet

parent 35f66707
Branches
No related tags found
1 merge request!1Master
...@@ -234,12 +234,12 @@ class LOOPInterpreterTest(unittest.TestCase): ...@@ -234,12 +234,12 @@ class LOOPInterpreterTest(unittest.TestCase):
self.assertEqual(interpret('x1:=x1-2;\n x0:=x1+2'), 2) self.assertEqual(interpret('x1:=x1-2;\n x0:=x1+2'), 2)
@mock.patch('loopinterpreter.input', side_effect=input_exit) @mock.patch('loopinterpreter.input', side_effect=input_exit)
def test_break_exit(self, input): def test_break_exit(self, custom_input):
self.assertEqual(interpret('x1:=2; BREAK x0:=2'), -1) self.assertEqual(interpret('x1:=2; BREAK x0:=2'), -1)
self.assertEqual(interpret('LOOP x1 DO BREAK x2:= 2 END'), -1) self.assertEqual(interpret('LOOP x1 DO BREAK x2:= 2 END'), -1)
@mock.patch('loopinterpreter.input', side_effect=input_continue) @mock.patch('loopinterpreter.input', side_effect=input_continue)
def test_break_continue(self, input): def test_break_continue(self, custom_input):
self.assertEqual(interpret('x1:=2; LOOP x1 DO x0:=x0+2 BREAK END'), 4) self.assertEqual(interpret('x1:=2; LOOP x1 DO x0:=x0+2 BREAK END'), 4)
@mock.patch('lexer.Lexer.__init__', init_without_tokens) @mock.patch('lexer.Lexer.__init__', init_without_tokens)
......
...@@ -116,5 +116,5 @@ class WHILEInterpreterTest(LOOPInterpreterTest): ...@@ -116,5 +116,5 @@ class WHILEInterpreterTest(LOOPInterpreterTest):
interpret('WHILE x1 != 0 DO x0:=2;;x2:=1 END') interpret('WHILE x1 != 0 DO x0:=2;;x2:=1 END')
@mock.patch('whileinterpreter.input', side_effect=str_yes) @mock.patch('whileinterpreter.input', side_effect=str_yes)
def test_infinite_loop(self, input): def test_infinite_loop(self, custom_input):
self.assertEqual(interpret('x1:=100000; WHILE x1 != 0 DO x0:=1; x1:=x1-1 END', 1), -1) self.assertEqual(interpret('x1:=100000; WHILE x1 != 0 DO x0:=1; x1:=x1-1 END', 1), -1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment