Skip to content

Commit 6fdc4cd

Browse files
authored
Merge pull request #986 from diffblue/smv-enum-tests
SMV: add tests for enums
2 parents 081b322 + bcd53e5 commit 6fdc4cd

16 files changed

+162
-0
lines changed

regression/smv/enums/enum1.desc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE broken-smt-backend
2+
enum1.smv
3+
4+
^\[.*\] AG some_var != off: PROVED$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring

regression/smv/enums/enum1.smv

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
MODULE main
2+
3+
VAR some_var: { red, green, yellow, off };
4+
5+
ASSIGN next(some_var) :=
6+
case
7+
some_var=red: green;
8+
some_var=green: yellow;
9+
some_var=yellow: red;
10+
TRUE: off;
11+
esac;
12+
13+
INIT some_var != off
14+
15+
SPEC AG some_var != off

regression/smv/enums/enum2.desc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE broken-smt-backend
2+
enum2.smv
3+
4+
^\[.*\] AG x != y: PROVED up to bound \d+$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring

regression/smv/enums/enum2.smv

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
MODULE main
2+
3+
VAR x: { red, green, yellow };
4+
VAR y: { red, green, yellow };
5+
6+
ASSIGN init(y) := green;
7+
ASSIGN next(y) := x;
8+
9+
ASSIGN next(x) :=
10+
case
11+
x=red: green;
12+
x=green: yellow;
13+
x=yellow: red;
14+
esac;
15+
16+
ASSIGN init(x) := red;
17+
18+
SPEC AG x != y;

regression/smv/enums/enum3.desc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
KNOWNBUG
2+
enum3.smv
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
--
9+
This should be a type error.

regression/smv/enums/enum3.smv

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
MODULE main
2+
3+
VAR x: { a, b, c };
4+
VAR y: { a, b };
5+
6+
ASSIGN init(x) := c; -- ok
7+
ASSIGN init(y) := c; -- error

regression/smv/enums/enum4.desc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
KNOWNBUG
2+
enum4.smv
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
--
9+
This fails in the decision procedure.

regression/smv/enums/enum4.smv

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MODULE main
2+
3+
VAR x: { a, b, c };
4+
VAR y: { a, b };
5+
6+
-- ok; it's a subset
7+
ASSIGN x := y;
8+
9+
SPEC AG x = y

regression/smv/enums/enum5.desc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
KNOWNBUG
2+
enum5.smv
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
--
9+
This fails in the decision procedure.

regression/smv/enums/enum5.smv

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MODULE main
2+
3+
VAR x: { a, b };
4+
VAR y: { b, a };
5+
6+
-- ok; the ordering does not matter
7+
ASSIGN x := y;
8+
9+
SPEC AG x = y

regression/smv/enums/enum6.desc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
KNOWNBUG
2+
enum6.smv
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
--
9+
This crashes when generating the trace.

regression/smv/enums/enum6.smv

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
MODULE main
2+
3+
VAR x: { a, b, c };
4+
5+
ASSIGN init(x) := a;
6+
ASSIGN next(x) := case
7+
x=a: b;
8+
x=b: c;
9+
TRUE: c;
10+
esac;
11+
12+
-- fails
13+
SPEC AG x != c

regression/smv/enums/enum7.desc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
KNOWNBUG
2+
enum7.smv
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
--
9+
The literal is converted incorrectly.

regression/smv/enums/enum7.smv

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MODULE main
2+
3+
VAR x: { a, b, c };
4+
5+
DEFINE x_value := a;
6+
7+
ASSIGN x := x_value;
8+
9+
SPEC AG x = a
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
KNOWNBUG
2+
module_with_enum1.smv
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
--
9+
The enum literal is not found.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
MODULE main
2+
3+
VAR sub : my-module;
4+
5+
-- the enum is visible here as well
6+
SPEC AG sub.some_enum = a
7+
8+
MODULE my-module
9+
10+
VAR some_enum : { a, b };
11+
12+
ASSIGN some_enum := a;

0 commit comments

Comments
 (0)