diff options
author | Rustan Leino <unknown> | 2014-07-08 14:35:52 -0700 |
---|---|---|
committer | Rustan Leino <unknown> | 2014-07-08 14:35:52 -0700 |
commit | f0b0ac64dc1d45e87c4eec869991ed86d8439f7f (patch) | |
tree | 3c95b6c5121e5c746cf7bdb740071ca8114d2b23 /Test/dafny0/FunctionSpecifications.dfy | |
parent | 61aa8c356946a60a1e68934a07faba89b95ff1ce (diff) | |
parent | 79eae1e70e52bde8acfbfb2a09a0560c7319b224 (diff) |
Merge
Diffstat (limited to 'Test/dafny0/FunctionSpecifications.dfy')
-rw-r--r-- | Test/dafny0/FunctionSpecifications.dfy | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Test/dafny0/FunctionSpecifications.dfy b/Test/dafny0/FunctionSpecifications.dfy index f78f1cc1..caf8a681 100644 --- a/Test/dafny0/FunctionSpecifications.dfy +++ b/Test/dafny0/FunctionSpecifications.dfy @@ -97,7 +97,7 @@ function IncC(i: nat): int /////////////////////////////////////////////////////////////
// Test basic function hiding
-function {:opaque} secret(x:int, y:int) : int
+function {:opaque} secret(x:int, y:int) : int
requires 0 <= x < 5;
requires 0 <= y < 5;
ensures secret(x, y) < 10;
@@ -107,7 +107,7 @@ method test_secret() {
assert secret(2, 3) >= 5; // Should fail because secret's body is hidden
reveal_secret();
- assert secret(2, 3) == 5; // Should pass now that the body is "visible"
+ assert secret(2, 3) == 5; // Should pass now that the body is "visible"
assert secret(4, 1) == 7; // Make sure it catches incorrect applications as well
}
@@ -132,7 +132,7 @@ method test_recursive_f() }
// Check that opaque doesn't interfere with ensures checking
-function {:opaque} bad_ensures(x:int, y:int):int
+function {:opaque} bad_ensures(x:int, y:int):int
requires x >= 0 && y >= 0;
ensures bad_ensures(x, y) > 0;
{
@@ -172,7 +172,7 @@ method n() assert g(0) == g(0) + 1;
}
-// Check that using the reveal_ lemma to prove the well-definedness of a function
+// Check that using the reveal_ lemma to prove the well-definedness of a function
// in a lower SCC does not cause a soundness problem
function A(): int
@@ -188,4 +188,14 @@ function {:opaque} B(): int A()
}
-
+method m_noreveal()
+ ensures false;
+{
+ assert f(0) == f(0) + 1;
+}
+
+method n_noreveal()
+ ensures false;
+{
+ assert g(0) == g(0) + 1;
+}
|