Commit a0ff0420 authored by Sarah Grebing's avatar Sarah Grebing

Testcase for cut rule, needs to be considered next

parent bdef62d7
Pipeline #13438 failed with stage
in 2 minutes and 51 seconds
......@@ -178,6 +178,7 @@ INDENT : '{' ;
DEDENT : '}' ;
SEMICOLON : ';' ;
COLON : ':' ;
HEAPSIMP:'heap-simp';
STRING_LITERAL
......@@ -208,4 +209,4 @@ EXE_MARKER: '\u2316' -> channel(HIDDEN);
DIGITS : DIGIT+ ;
fragment DIGIT : [0-9] ;
ID : [a-zA-Z] ([_a-zA-Z0-9] | '.' | '\\')*;
\ No newline at end of file
ID : ([a-zA-Z]|'#') ([_a-zA-Z0-9] | '.' | '\\'| '#')*;
\ No newline at end of file
......@@ -364,7 +364,12 @@ public class TransformAst implements ScriptLanguageVisitor<Object> {
public Object visitScriptCommand(ScriptLanguageParser.ScriptCommandContext ctx) {
CallStatement scs = new CallStatement();
scs.setRuleContext(ctx);
scs.setCommand(ctx.cmd.getText());
String commandName = ctx.cmd.getText();
//Sonderfall für KeYs heap-simp macro
if (commandName.equals("heap_simp")) {
commandName = "heap-simp";
}
scs.setCommand(commandName);
if (ctx.parameters() != null) {
scs.setParameters((Parameters) ctx.parameters().accept(this));
}
......
package edu.kit.iti.formal.psdbg.interpreter;
import edu.kit.iti.formal.psdbg.interpreter.Execute;
import edu.kit.iti.formal.psdbg.interpreter.Interpreter;
import static edu.kit.iti.formal.psdbg.TestHelper.getFile;
import edu.kit.iti.formal.psdbg.interpreter.data.KeyData;
import org.apache.commons.cli.ParseException;
import org.junit.Test;
import java.io.IOException;
import static edu.kit.iti.formal.psdbg.TestHelper.getFile;
/**
* @author Alexander Weigl
* @version 1 (28.05.17)
......@@ -47,4 +44,14 @@ public class ExecuteTest {
System.out.println(i.getCurrentState());
}
@Test
public void testContrapositionCut() throws IOException, ParseException {
Execute execute = create(
getFile(getClass(), "contraposition/contraposition.key"),
"-s", getFile(getClass(), "contraposition/cutTest.kps"));
Interpreter<KeyData> i = execute.run();
System.out.println(i.getCurrentState());
}
}
\ No newline at end of file
......@@ -2,8 +2,8 @@ script cpwb () {
impRight;
impLeft;
cases{
case match `==> p`:{
auto;
case match `==> ?X`:{
auto;
}
default:{
auto;
......
......@@ -10,27 +10,27 @@ script Simple1(i:int, j:int) {
assertEq i 4;
assert (i=4) & j=8;
split;
print_state;
//print_state;
foreach {
assert (i=4) & j=8;
split 5;
print_state;
//print_state;
}
print_state;
//print_state;
cases {
case match `(?<X>.*).b.a` using [X : string] {
case match `(?<X>.*).b.a` using [X : string] :
assertEq X 'abc' msg='bla bla';
print_state;
}
case match '.*b' {
case match '.*b' :
print_state;
}
default {
default :
print_state;
}
}
}
\ No newline at end of file
script prove_transitive(){
symbex;
symbex;
foreach{
heap_simp;
}
cases{
case match
`seqPerm(?Res0Copy, ?Arr),
`seqPerm(?Res0Copy, ?Arr),
seqPerm(?Res0Sort, ?Res0Copy),
seqPerm(?Res1Copy0, ?Res0Sort),
seqPerm(?Res2Copy1, ?Res0Sort) ==>
seqPerm(?Res2Copy1, ?Arr)` using [ ?Res0Copy: Seq, ?Arr: Seq,?Res0Sort: Seq, ?Res1Copy0: Seq, ?Res2Copy1: Seq, ?Res0Sort: Seq ]:
{SeqPermSym on=`seqPerm(?Res0Copy, ?Arr) ==>`;
seqPerm(?Res2Copy1, ?Arr)`:
SeqPermSym on=`seqPerm(?Res0Copy, ?Arr) ==>`;
SeqPermSym on=`seqPerm(?Res0Sort, ?Res0Copy) ==>`;
SeqPermSym on=`seqPerm(?Res1Copy0, ?Res0Sort)==>`;
SeqPermSym on=`seqPerm(?Res2Copy1, ?Res0Sort) ==>`;
......@@ -17,22 +20,22 @@ script prove_transitive(){
with=`seqPerm(?Arr,?Res2Copy1)`;
SeqPermSym on=`seqPerm(?Arr,?Res2Copy1)`;
auto;
}
case match
`seqPerm(?Res0Copy, ?Arr),
`seqPerm(?Res0Copy, ?Arr),
seqPerm(?Res0Sort, ?Res0Copy),
seqPerm(?Res1Copy0, ?Res0Sort) ==>
seqPerm(?Res1Copy0, ?Arr)` using [ ?Res0Copy: Seq, ?Arr: Seq,?Res0Sort: Seq, ?Res1Copy0: Seq, ?Res0Sort: Seq ]:
{SeqPermSym on=`seqPerm(?Res0Copy, ?Arr)`;
seqPerm(?Res1Copy0, ?Arr)`:
SeqPermSym on=`seqPerm(?Res0Copy, ?Arr)`;
SeqPermSym on=`seqPerm(?Res0Sort, ?Res0Copy)`;
SeqPermSym on=`seqPerm(?Res1Copy0, ?Res0Sort)`;
SeqPermTrans on=`seqPerm(?Res0Copy, ?Arr)`;
SeqPermTrans on=`seqPerm(?Arr, ?Res0Sort)`
SeqPermSym on=`==> seqPerm(?Res1Copy0, ?Arr)`;
auto;
}
default:{
default:
auto;
}
}
}
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