summaryrefslogtreecommitdiff
path: root/Chalice/tests/predicates/test8.chalice
diff options
context:
space:
mode:
authorGravatar stefanheule <unknown>2012-02-25 03:33:46 -0800
committerGravatar stefanheule <unknown>2012-02-25 03:33:46 -0800
commit43e00a07c7b28d7f51081b4cac736af0f3481600 (patch)
tree6f207575ed3b5da6517d4726f460bcaf46300fb3 /Chalice/tests/predicates/test8.chalice
parente3662fe7db0f677d3497cc81286e93516f09ba73 (diff)
Chalice: New test case for predicates.
Diffstat (limited to 'Chalice/tests/predicates/test8.chalice')
-rw-r--r--Chalice/tests/predicates/test8.chalice55
1 files changed, 55 insertions, 0 deletions
diff --git a/Chalice/tests/predicates/test8.chalice b/Chalice/tests/predicates/test8.chalice
new file mode 100644
index 00000000..e824f161
--- /dev/null
+++ b/Chalice/tests/predicates/test8.chalice
@@ -0,0 +1,55 @@
+// fold/unfold in various combinations
+class FUFU
+{
+ var value:int;
+ var next:FUFU;
+
+ predicate inv { acc(value) }
+
+ predicate tinv { acc(value) && acc(next) && (next!=null ==> next.tinv) }
+
+ function get():int
+ requires tinv;
+ { unfolding tinv in value }
+
+ method fufu()
+ requires acc(value);
+ {
+ fold inv;
+ unfold inv;
+ fold inv;
+ unfold inv;
+ }
+
+ method fuf()
+ requires acc(value);
+ {
+ fold inv;
+ unfold inv;
+ fold inv;
+ }
+
+ method uf()
+ requires inv;
+ {
+ unfold inv;
+ fold inv;
+ }
+
+ method fu()
+ requires acc(value);
+ {
+ fold inv;
+ unfold inv;
+ }
+
+ method t()
+ requires tinv && unfolding tinv in next!=null;
+ ensures tinv && unfolding tinv in next!=null;
+ {
+ unfold tinv;
+ unfold next.tinv;
+ fold next.tinv;
+ fold tinv;
+ }
+} \ No newline at end of file