From: Rico Tzschichholz Date: Thu, 17 Oct 2019 07:51:21 +0000 (+0200) Subject: tests: Extent "post-condition" virtual method test to increase coverage X-Git-Tag: 0.44.10~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfa0199562d5eb7208ac50d732237ab8afe4d035;p=thirdparty%2Fvala.git tests: Extent "post-condition" virtual method test to increase coverage --- 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);