Skip to content
Snippets Groups Projects
Verified Commit 6386473c authored by Miles Vella's avatar Miles Vella
Browse files

add test and todo for type restrictor with if-predicate

parent ed05fef8
No related branches found
No related tags found
No related merge requests found
Pipeline #152601 passed
...@@ -266,5 +266,69 @@ public class TypeRestrictionsTest { ...@@ -266,5 +266,69 @@ public class TypeRestrictionsTest {
compare(expected, machine); compare(expected, machine);
} }
@Test
public void testAnyEqual() throws Exception {
String machine = "MACHINE test\n"
+ "VARIABLES x\n"
+ "INVARIANT x = 1\n"
+ "INITIALISATION x := 1\n"
+ "OPERATIONS\n"
+ "foo = ANY y WHERE y=1 THEN x:=y END\n"
+ "END";
String expected = "---- MODULE test ----\n" +
"VARIABLES x\n" +
"Invariant1 == x = 1\n" +
"Init == x = 1\n" +
"\n" +
"foo == \\E y \\in {1} : x' = y\n" +
"\n" +
"Next == \\/ foo\n" +
"====";
compare(expected, machine);
}
@Test
public void testAnyMember() throws Exception {
String machine = "MACHINE test\n"
+ "VARIABLES x\n"
+ "INVARIANT x = 1\n"
+ "INITIALISATION x := 1\n"
+ "OPERATIONS\n"
+ "foo = ANY y WHERE y:{1} THEN x:=y END\n"
+ "END";
String expected = "---- MODULE test ----\n" +
"VARIABLES x\n" +
"Invariant1 == x = 1\n" +
"Init == x = 1\n" +
"\n" +
"foo == \\E y \\in {1} : x' = y\n" +
"\n" +
"Next == \\/ foo\n" +
"====";
compare(expected, machine);
}
@Ignore // TODO: improve type restrictor
@Test
public void testAnyNestedEqualInIf() throws Exception {
String machine = "MACHINE test\n"
+ "CONSTANTS B\n"
+ "PROPERTIES B:BOOL\n"
+ "VARIABLES x\n"
+ "INVARIANT x = 1\n"
+ "INITIALISATION x := 1\n"
+ "OPERATIONS\n"
+ "foo = ANY y WHERE IF B=TRUE THEN y=1 ELSE y=1 END THEN x:=y END\n"
+ "END";
String expected = "---- MODULE test ----\n" +
"VARIABLES x\n" +
"Invariant1 == x = 1\n" +
"Init == x = 1\n" +
"\n" +
"foo == \\E y \\in {1} : x' = y\n" +
"\n" +
"Next == \\/ foo\n" +
"====";
compare(expected, machine);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment