From a2b04d603976cc54ab40d981b4c2866b58c9945e Mon Sep 17 00:00:00 2001 From: Nada Amin Date: Tue, 5 Aug 2014 11:03:55 +0200 Subject: Tests for non-terminating computations. Already passing. --- Test/dafny0/ComputationsLoop.dfy | 13 +++++++++++++ Test/dafny0/ComputationsLoop.dfy.expect | 9 +++++++++ Test/dafny0/ComputationsLoop2.dfy | 17 +++++++++++++++++ Test/dafny0/ComputationsLoop2.dfy.expect | 13 +++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 Test/dafny0/ComputationsLoop.dfy create mode 100644 Test/dafny0/ComputationsLoop.dfy.expect create mode 100644 Test/dafny0/ComputationsLoop2.dfy create mode 100644 Test/dafny0/ComputationsLoop2.dfy.expect diff --git a/Test/dafny0/ComputationsLoop.dfy b/Test/dafny0/ComputationsLoop.dfy new file mode 100644 index 00000000..b89455a2 --- /dev/null +++ b/Test/dafny0/ComputationsLoop.dfy @@ -0,0 +1,13 @@ +// RUN: %dafny /compile:0 /print:"%t.print" /dprint:"%t.dprint" "%s" > "%t" +// RUN: %diff "%s.expect" "%t" + +function KeepDoin'It(x: nat): nat + decreases x; +{ + KeepDoin'It(x + 1) +} + +lemma Test(r: nat) +{ + assert KeepDoin'It(20) == r; +} \ No newline at end of file diff --git a/Test/dafny0/ComputationsLoop.dfy.expect b/Test/dafny0/ComputationsLoop.dfy.expect new file mode 100644 index 00000000..d9d48024 --- /dev/null +++ b/Test/dafny0/ComputationsLoop.dfy.expect @@ -0,0 +1,9 @@ +ComputationsLoop.dfy(7,3): Error: failure to decrease termination measure +Execution trace: + (0,0): anon0 + (0,0): anon3_Else +ComputationsLoop.dfy(12,26): Error: assertion violation +Execution trace: + (0,0): anon0 + +Dafny program verifier finished with 1 verified, 2 errors diff --git a/Test/dafny0/ComputationsLoop2.dfy b/Test/dafny0/ComputationsLoop2.dfy new file mode 100644 index 00000000..d03d7c79 --- /dev/null +++ b/Test/dafny0/ComputationsLoop2.dfy @@ -0,0 +1,17 @@ +// RUN: %dafny /compile:0 /print:"%t.print" /dprint:"%t.dprint" "%s" > "%t" +// RUN: %diff "%s.expect" "%t" + +function KeepDoin'It(x: nat): nat +{ + KeepDoin'ItToo(x + 1) +} + +function KeepDoin'ItToo(x: nat): nat +{ + KeepDoin'It(x + 1) +} + +lemma Test(r: nat) +{ + assert KeepDoin'It(20) == r; +} \ No newline at end of file diff --git a/Test/dafny0/ComputationsLoop2.dfy.expect b/Test/dafny0/ComputationsLoop2.dfy.expect new file mode 100644 index 00000000..0a45e6d0 --- /dev/null +++ b/Test/dafny0/ComputationsLoop2.dfy.expect @@ -0,0 +1,13 @@ +ComputationsLoop2.dfy(6,3): Error: cannot prove termination; try supplying a decreases clause +Execution trace: + (0,0): anon0 + (0,0): anon3_Else +ComputationsLoop2.dfy(11,3): Error: cannot prove termination; try supplying a decreases clause +Execution trace: + (0,0): anon0 + (0,0): anon3_Else +ComputationsLoop2.dfy(16,26): Error: assertion violation +Execution trace: + (0,0): anon0 + +Dafny program verifier finished with 1 verified, 3 errors -- cgit v1.2.3