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 @@
</content>
<orderEntry type="inheritedJdk" />
<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: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.16" level="project" />
......
......@@ -36,7 +36,7 @@ public class ExecuteTest {
System.out.println(i.getCurrentState());
}
//@Test
@Test
public void testContrapositionManualWoBranching() throws IOException, ParseException {
Execute execute = create(
getFile(getClass(), "contraposition/contraposition.key"),
......
......@@ -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.data.GoalNode;
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.parser.ast.CallStatement;
import edu.kit.iti.formal.psdbg.parser.ast.Variable;
import edu.kit.iti.formal.psdbg.parser.data.Value;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
......@@ -53,7 +53,7 @@ public abstract class BuiltinCommands {
@Override
public void evaluate(Interpreter<String> interpreter, CallStatement call, VariableAssignment params) {
Value<BigInteger> val = (Value<BigInteger>) params.getValues().getOrDefault(
new Variable("#1"),
new Variable("#2"),
Value.from(2));
int num = val.getData().intValue();
GoalNode<String> g = interpreter.getSelectedNode();
......
......@@ -53,19 +53,24 @@ public class DefaultLookup implements CommandLookup {
if (b.handles(callStatement)) {
foundHandlers.add(b);
found = b;
} else {
}
}
if (found == null && mayBeEscapedMacro) {
//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 (mayBeEscapedMacro) {
String command = callStatement.getCommand();
callStatement.setCommand(command.replace("_", "-"));
for (CommandHandler b : builders) {
if (b.handles(callStatement)) {
foundHandlers.add(b);
found = b;
}
}
}
}
if (foundHandlers.size() >= 1) return foundHandlers.get(0);
throw new NoCallHandlerException(callStatement);
......
......@@ -59,7 +59,7 @@ public class InterpreterTest {
return defaultLookup;
}
//@Test
@Test
public void testSimple() throws IOException {
Interpreter<String> i = execute(getClass().getResourceAsStream("simple1.txt"));
Assert.assertEquals(10, i.getCurrentState().getGoals().size());
......@@ -85,8 +85,8 @@ public class InterpreterTest {
@Override
public void evaluate(Interpreter interpreter, CallStatement call, VariableAssignment params) {
Map<Variable, Value> m = params.asMap();
Value exp = get(m, "exp", "expected", "#1");
Value act = get(m, "act", "actual", "#2");
Value exp = get(m, "exp", "expected", "#2");
Value act = get(m, "act", "actual", "#3");
Value msg = get(m, "msg", "#4");
if (msg == null)
Assert.assertEquals(exp, act);
......@@ -104,8 +104,8 @@ public class InterpreterTest {
@Override
public void evaluate(Interpreter interpreter, CallStatement call, VariableAssignment params) {
Map<Variable, Value> m = params.asMap();
Value<Boolean> exp = get(m, "val", "#1");
Value<String> msg = get(m, "msg", "#2");
Value<Boolean> exp = get(m, "val", "#2");
Value<String> msg = get(m, "msg", "#3");
if (msg == null)
Assert.assertTrue(exp.getData());
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