Commit 9880e692 authored by Sarah Grebing's avatar Sarah Grebing

bugfix

parent 47018a59
Pipeline #13827 failed with stage
in 2 minutes and 36 seconds
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.6" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.16" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.16" level="project" />
......
...@@ -36,7 +36,7 @@ public class ExecuteTest { ...@@ -36,7 +36,7 @@ public class ExecuteTest {
System.out.println(i.getCurrentState()); System.out.println(i.getCurrentState());
} }
//@Test @Test
public void testContrapositionManualWoBranching() throws IOException, ParseException { public void testContrapositionManualWoBranching() throws IOException, ParseException {
Execute execute = create( Execute execute = create(
getFile(getClass(), "contraposition/contraposition.key"), getFile(getClass(), "contraposition/contraposition.key"),
......
...@@ -3,10 +3,10 @@ package edu.kit.iti.formal.psdbg.interpreter.funchdl; ...@@ -3,10 +3,10 @@ package edu.kit.iti.formal.psdbg.interpreter.funchdl;
import edu.kit.iti.formal.psdbg.interpreter.Interpreter; import edu.kit.iti.formal.psdbg.interpreter.Interpreter;
import edu.kit.iti.formal.psdbg.interpreter.data.GoalNode; import edu.kit.iti.formal.psdbg.interpreter.data.GoalNode;
import edu.kit.iti.formal.psdbg.interpreter.data.State; import edu.kit.iti.formal.psdbg.interpreter.data.State;
import edu.kit.iti.formal.psdbg.parser.data.Value;
import edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment; import edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment;
import edu.kit.iti.formal.psdbg.parser.ast.CallStatement; import edu.kit.iti.formal.psdbg.parser.ast.CallStatement;
import edu.kit.iti.formal.psdbg.parser.ast.Variable; import edu.kit.iti.formal.psdbg.parser.ast.Variable;
import edu.kit.iti.formal.psdbg.parser.data.Value;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -53,7 +53,7 @@ public abstract class BuiltinCommands { ...@@ -53,7 +53,7 @@ public abstract class BuiltinCommands {
@Override @Override
public void evaluate(Interpreter<String> interpreter, CallStatement call, VariableAssignment params) { public void evaluate(Interpreter<String> interpreter, CallStatement call, VariableAssignment params) {
Value<BigInteger> val = (Value<BigInteger>) params.getValues().getOrDefault( Value<BigInteger> val = (Value<BigInteger>) params.getValues().getOrDefault(
new Variable("#1"), new Variable("#2"),
Value.from(2)); Value.from(2));
int num = val.getData().intValue(); int num = val.getData().intValue();
GoalNode<String> g = interpreter.getSelectedNode(); GoalNode<String> g = interpreter.getSelectedNode();
......
...@@ -53,16 +53,21 @@ public class DefaultLookup implements CommandLookup { ...@@ -53,16 +53,21 @@ public class DefaultLookup implements CommandLookup {
if (b.handles(callStatement)) { if (b.handles(callStatement)) {
foundHandlers.add(b); foundHandlers.add(b);
found = b; found = b;
} else { }
//if a proof macro contains a "-" character, the proof script language does not support this. }
// Therefore we have to check for both versions
if (mayBeEscapedMacro) { if (found == null && mayBeEscapedMacro) {
String command = callStatement.getCommand(); //if a proof macro contains a "-" character, the proof script language does not support this.
callStatement.setCommand(command.replace("_", "-")); // Therefore we have to check for both versions
if (b.handles(callStatement)) { // if (mayBeEscapedMacro) {
foundHandlers.add(b);
found = b; String command = callStatement.getCommand();
} callStatement.setCommand(command.replace("_", "-"));
for (CommandHandler b : builders) {
if (b.handles(callStatement)) {
foundHandlers.add(b);
found = b;
} }
} }
} }
......
...@@ -59,7 +59,7 @@ public class InterpreterTest { ...@@ -59,7 +59,7 @@ public class InterpreterTest {
return defaultLookup; return defaultLookup;
} }
//@Test @Test
public void testSimple() throws IOException { public void testSimple() throws IOException {
Interpreter<String> i = execute(getClass().getResourceAsStream("simple1.txt")); Interpreter<String> i = execute(getClass().getResourceAsStream("simple1.txt"));
Assert.assertEquals(10, i.getCurrentState().getGoals().size()); Assert.assertEquals(10, i.getCurrentState().getGoals().size());
...@@ -85,8 +85,8 @@ public class InterpreterTest { ...@@ -85,8 +85,8 @@ public class InterpreterTest {
@Override @Override
public void evaluate(Interpreter interpreter, CallStatement call, VariableAssignment params) { public void evaluate(Interpreter interpreter, CallStatement call, VariableAssignment params) {
Map<Variable, Value> m = params.asMap(); Map<Variable, Value> m = params.asMap();
Value exp = get(m, "exp", "expected", "#1"); Value exp = get(m, "exp", "expected", "#2");
Value act = get(m, "act", "actual", "#2"); Value act = get(m, "act", "actual", "#3");
Value msg = get(m, "msg", "#4"); Value msg = get(m, "msg", "#4");
if (msg == null) if (msg == null)
Assert.assertEquals(exp, act); Assert.assertEquals(exp, act);
...@@ -104,8 +104,8 @@ public class InterpreterTest { ...@@ -104,8 +104,8 @@ public class InterpreterTest {
@Override @Override
public void evaluate(Interpreter interpreter, CallStatement call, VariableAssignment params) { public void evaluate(Interpreter interpreter, CallStatement call, VariableAssignment params) {
Map<Variable, Value> m = params.asMap(); Map<Variable, Value> m = params.asMap();
Value<Boolean> exp = get(m, "val", "#1"); Value<Boolean> exp = get(m, "val", "#2");
Value<String> msg = get(m, "msg", "#2"); Value<String> msg = get(m, "msg", "#3");
if (msg == null) if (msg == null)
Assert.assertTrue(exp.getData()); Assert.assertTrue(exp.getData());
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment