diff options
author | Rustan Leino <leino@microsoft.com> | 2011-07-11 19:09:41 -0700 |
---|---|---|
committer | Rustan Leino <leino@microsoft.com> | 2011-07-11 19:09:41 -0700 |
commit | 59eff583615e198bd7381adda7be9c1527c2f199 (patch) | |
tree | 9ccf8116e3740e04c18a9b76fa030fd5deff6b51 /Test/dafny0 | |
parent | cb20c2a781055190994851bb375828db642fa271 (diff) | |
parent | 4ba34f910f6d89b2f379f9fd79eab35d366abc08 (diff) |
Merge
Diffstat (limited to 'Test/dafny0')
-rw-r--r-- | Test/dafny0/Answer | 2 | ||||
-rw-r--r-- | Test/dafny0/Basics.dfy | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/Test/dafny0/Answer b/Test/dafny0/Answer index a29c64fa..7a972f22 100644 --- a/Test/dafny0/Answer +++ b/Test/dafny0/Answer @@ -657,7 +657,7 @@ Execution trace: (0,0): anon8
(0,0): anon14_Then
-Dafny program verifier finished with 16 verified, 11 errors
+Dafny program verifier finished with 19 verified, 11 errors
-------------------- ControlStructures.dfy --------------------
ControlStructures.dfy(5,3): Error: missing case in case statement: Blue
diff --git a/Test/dafny0/Basics.dfy b/Test/dafny0/Basics.dfy index 1ae5b9c4..6aa1e34d 100644 --- a/Test/dafny0/Basics.dfy +++ b/Test/dafny0/Basics.dfy @@ -171,3 +171,17 @@ method SwapEm(a: int, b: int) returns (x: int, y: int) {
x, y := b, a;
}
+
+function method abs(a:int): int
+{
+ if a <= 0 then -a else a
+}
+// test of verifier using euclidean division.
+method EuclideanTest(a: int, b: int)
+ requires b != 0;
+{
+ var q, r := a / b, a % b;
+ assert 0 <= r < abs(b);
+ assert a == b * q + r;
+ assert (a/b) * b + a % b == a;
+}
\ No newline at end of file |