From abfe9c32f0b33274511014dd4f498702bbcf0d7e Mon Sep 17 00:00:00 2001 From: qunyanm Date: Thu, 11 Feb 2016 15:18:34 -0800 Subject: Fix issue 133. The return type for some compare operators was wrongly typed as int instead of bool. --- Test/dafny4/Bug133.dfy | 18 ++++++++++++++++++ Test/dafny4/Bug133.dfy.expect | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 Test/dafny4/Bug133.dfy create mode 100644 Test/dafny4/Bug133.dfy.expect (limited to 'Test') diff --git a/Test/dafny4/Bug133.dfy b/Test/dafny4/Bug133.dfy new file mode 100644 index 00000000..f7da133e --- /dev/null +++ b/Test/dafny4/Bug133.dfy @@ -0,0 +1,18 @@ +// RUN: %dafny /noNLarith /compile:0 "%s" > "%t" +// RUN: %diff "%s.expect" "%t" + +module Math__div_def_i { + function my_div_pos(x:int, d:int) : int + requires d > 0; + decreases if x < 0 then (d - x) else x; + { + if x < 0 then + -1 + my_div_pos(x+d, d) + else if x < d then + 0 + else + 1 + my_div_pos(x-d, d) + } +} + + diff --git a/Test/dafny4/Bug133.dfy.expect b/Test/dafny4/Bug133.dfy.expect new file mode 100644 index 00000000..c0c48e2b --- /dev/null +++ b/Test/dafny4/Bug133.dfy.expect @@ -0,0 +1,2 @@ + +Dafny program verifier finished with 1 verified, 0 errors -- cgit v1.2.3