diff options
author | Rustan Leino <leino@microsoft.com> | 2012-02-19 00:18:00 -0800 |
---|---|---|
committer | Rustan Leino <leino@microsoft.com> | 2012-02-19 00:18:00 -0800 |
commit | ba75a2d0b67ce5c330abd1903a6942a9b385d361 (patch) | |
tree | f77ac15c01adc43eb052f1b29dfa402eb7c87832 /Test/dafny0/Refinement.dfy | |
parent | 5b6de79e16850e70a9ab1a37ba45245275c3fd20 (diff) |
Dafny: make sure assume->assert transformation gives rise to a check
Diffstat (limited to 'Test/dafny0/Refinement.dfy')
-rw-r--r-- | Test/dafny0/Refinement.dfy | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Test/dafny0/Refinement.dfy b/Test/dafny0/Refinement.dfy index c24ed555..da7f0ac2 100644 --- a/Test/dafny0/Refinement.dfy +++ b/Test/dafny0/Refinement.dfy @@ -166,3 +166,27 @@ module Client imports Concrete { } } } + +module IncorrectConcrete refines Abstract { + class MyNumber { + var a: int; + var b: int; + predicate Valid + { + N == 2*a - b + } + constructor Init() + { // error: postcondition violation + a := b; + } + method Inc() + { // error: postcondition violation + if (*) { a := a + 1; } else { b := b - 1; } + } + method Get() returns (n: int) + { + var k := a - b; + assert ...; // error: assertion violation + } + } +} |