diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-03-01 14:16:14 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-03-01 14:16:14 +0100 |
commit | d1bebfd19662d51fff3a99a16dd6fa66aa73c031 (patch) | |
tree | e9a0aa1141e1f7fada90b6daa973444ccbef61ac | |
parent | 0c02043d1a7e8e2bf386bcbf09ec53cad7c58fc7 (diff) | |
download | vala-d1bebfd19662d51fff3a99a16dd6fa66aa73c031.tar.gz |
tests: Extent "post-condition" method test to increase coverage
-rw-r--r-- | tests/methods/prepostconditions.vala | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/methods/prepostconditions.vala b/tests/methods/prepostconditions.vala index aeae32a9f..f7c4eaf68 100644 --- a/tests/methods/prepostconditions.vala +++ b/tests/methods/prepostconditions.vala @@ -1,5 +1,9 @@ class Foo { public bool ensured = false; + public bool required = false; + + public Foo () requires (required = true) { + } public void foo () ensures (ensured = true) { } @@ -7,11 +11,23 @@ class Foo { public string bar () ensures (result.length >= 3) { return "bar"; } + + public void foo_pre (int i) requires (i > 23) { + assert (i == 42); + } + + public int bar_pre (int i) requires (i > 42) { + assert (i == 4711); + return i; + } } void main () { var foo = new Foo(); + assert(foo.required); foo.foo(); assert(foo.ensured); assert(foo.bar () == "bar"); + foo.foo_pre (42); + assert(foo.bar_pre (4711) == 4711); } |