From 77560150fe016ec64e78e7f7b99084ab3211362e Mon Sep 17 00:00:00 2001 From: Malte Schmitz Date: Fri, 25 Nov 2016 16:48:05 +0100 Subject: [PATCH] Remove unused method --- src/interpreter/Interpreter.java | 7 ------- test/interpreter/InterpreterTest.java | 19 ------------------- 2 files changed, 26 deletions(-) diff --git a/src/interpreter/Interpreter.java b/src/interpreter/Interpreter.java index 64611de..c7208f2 100644 --- a/src/interpreter/Interpreter.java +++ b/src/interpreter/Interpreter.java @@ -20,13 +20,6 @@ public class Interpreter extends ProgramVisitor { visit(program); } - public Interpreter(Program program, Map valuation) { - this.program = program; - this.valuation.putAll(valuation); - visit(program); - } - - @Override public void visitAssignment(Assignment assignment) { Evaluator evaluator = new Evaluator(assignment.expression, valuation); diff --git a/test/interpreter/InterpreterTest.java b/test/interpreter/InterpreterTest.java index b297aba..ab60691 100644 --- a/test/interpreter/InterpreterTest.java +++ b/test/interpreter/InterpreterTest.java @@ -9,8 +9,6 @@ import program.Assignment; import program.Composition; import program.Loop; import program.Program; - -import java.util.HashMap; import java.util.Map; import static org.junit.Assert.assertEquals; @@ -34,21 +32,4 @@ public class InterpreterTest { assertEquals(0, valuation.get("a").intValue()); assertEquals(4, valuation.get("b").intValue()); } - - @Test - public void testSemWithValuation() { - Map valuation = new HashMap<>(); - valuation.put("a", 2); - valuation.put("b", 4); - valuation.put("r", 0); - Program body = new Composition( - new Assignment(new Identifier("r"), new Addition(new Identifier("r"), new Identifier("b"))), - new Assignment(new Identifier("a"), new Subtraction(new Identifier("a"), new Int(1)))); - Program loop = new Loop(new Identifier("a"), body); - Interpreter interpreter = new Interpreter(loop, valuation); - valuation = interpreter.getValuation(); - assertEquals(8, valuation.get("r").intValue()); - assertEquals(0, valuation.get("a").intValue()); - assertEquals(4, valuation.get("b").intValue()); - } }