[vala/staging] tests: Extent "post-condition" virtual method test to increase coverage



commit 7ca183cbf67fea0ed17ce004d750cd922daf136b
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Oct 17 09:51:21 2019 +0200

    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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]