]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Extend "pre-post increment" test to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 3 Mar 2021 16:59:54 +0000 (17:59 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 13 Mar 2021 20:22:57 +0000 (21:22 +0100)
tests/control-flow/pre-post-increment.vala

index e0bf28bcb19e1dc2a5f0b014f50c0876303c7bf8..cb4d31423c00abea9e5680b5fc828248ae18cfbe 100644 (file)
@@ -17,5 +17,25 @@ void main () {
                int i = 0;
                assert (++i == 1);
        }
+       {
+               int i = 1;
+               i -= i++ % 2;
+               assert (i == 1);
+       }
+       {
+               int i = 1;
+               i -= ++i % 2;
+               assert (i == 2);
+       }
+       {
+               int i = 1;
+               i += i++ % 2;
+               assert (i == 3);
+       }
+       {
+               int i = 1;
+               i += ++i % 2;
+               assert (i == 2);
+       }
 }