From 7ca183cbf67fea0ed17ce004d750cd922daf136b Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Thu, 17 Oct 2019 09:51:21 +0200 Subject: [PATCH] tests: Extent "post-condition" virtual method test to increase coverage --- tests/methods/prepostconditions.vala | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/methods/prepostconditions.vala b/tests/methods/prepostconditions.vala index 0ae57e054..d7474df75 100644 --- a/tests/methods/prepostconditions.vala +++ b/tests/methods/prepostconditions.vala @@ -41,6 +41,24 @@ class Foo { assert_not_reached (); } } + + public virtual int manam (int i) ensures (result > 23) { + switch (i) { + case 67: + return i; + default: + assert_not_reached (); + } + } + + public virtual int manam_pre (int i) requires (i > 23) { + switch (i) { + case 231: + return i; + default: + assert_not_reached (); + } + } } void main () { @@ -53,6 +71,8 @@ void main () { assert(foo.bar_pre (4711) == 4711); assert (foo.faz (42) == 42); assert (foo.faz_pre (4711) == 4711); + assert (foo.manam (67) == 67); + assert (foo.manam_pre (231) == 231); var foo2 = new Foo.post (); assert (foo2.ensured); -- 2.47.2