ソースを参照

Remove unused method

pull/1/head
Malte Schmitz 9年前
コミット
77560150fe
2個のファイルの変更0行の追加26行の削除
  1. +0
    -7
      src/interpreter/Interpreter.java
  2. +0
    -19
      test/interpreter/InterpreterTest.java

+ 0
- 7
src/interpreter/Interpreter.java ファイルの表示

@@ -20,13 +20,6 @@ public class Interpreter extends ProgramVisitor {
visit(program);
}

public Interpreter(Program program, Map<String, Integer> valuation) {
this.program = program;
this.valuation.putAll(valuation);
visit(program);
}


@Override
public void visitAssignment(Assignment assignment) {
Evaluator evaluator = new Evaluator(assignment.expression, valuation);


+ 0
- 19
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<String, Integer> 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());
}
}

読み込み中…
キャンセル
保存