Skip to content

Commit

Permalink
Test for if-then-else optimisation in goto convert
Browse files Browse the repository at this point in the history
The optimisation has been inadvertently broken by 199d4cc
due to lack of a regression test.
  • Loading branch information
peterschrammel committed Jun 15, 2018
1 parent 8e6244c commit d433438
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Binary file added jbmc/regression/jbmc/JumpSimplification/Test.class
Binary file not shown.
14 changes: 14 additions & 0 deletions jbmc/regression/jbmc/JumpSimplification/Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
public class Test {

public int foo(int i) {
int x = 0;
if (i > 0) {
x++;
}
else
{
x--;
}
return x + 1000;
}
}
10 changes: 10 additions & 0 deletions jbmc/regression/jbmc/JumpSimplification/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
KNOWNBUG
Test.class
--show-goto-functions --function Test.foo
activate-multi-line-match
EXIT=0
SIGNAL=0
IF \w* <= 0 THEN GOTO 1\n\s*//.*\n\s*//.*\n\s*\w*::
--
IF !\(\w* <= 0\) THEN GOTO 1\n\s*//.*\n.*GOTO 2\n\s*//.*\n\s*//.*\n\s*1: \w*::
^warning: ignoring

0 comments on commit d433438

Please sign in to comment.