[vala/0.48] tests: Add "pre/post-increment" tests to increase coverage



commit 9e9a2102c8c66df6eb5216573314243b34b95e06
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Jul 14 14:13:51 2020 +0200

    tests: Add "pre/post-increment" tests to increase coverage

 tests/Makefile.am                          |  1 +
 tests/control-flow/pre-post-increment.vala | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a2ac4958d..d20cb1862 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -219,6 +219,7 @@ TESTS = \
        control-flow/missing-break.test \
        control-flow/missing-return.test \
        control-flow/nested-conditional.vala \
+       control-flow/pre-post-increment.vala \
        control-flow/switch.vala \
        control-flow/sideeffects.vala \
        control-flow/unassigned-captured-local-variable.test \
diff --git a/tests/control-flow/pre-post-increment.vala b/tests/control-flow/pre-post-increment.vala
new file mode 100644
index 000000000..e0bf28bcb
--- /dev/null
+++ b/tests/control-flow/pre-post-increment.vala
@@ -0,0 +1,21 @@
+void main () {
+       {
+               int i = 0;
+               i = i++ + 1;
+               assert (i == 1);
+       }
+       {
+               int i = 0;
+               assert (i++ == 0);
+       }
+       {
+               int i = 0;
+               i = ++i + 1;
+               assert (i == 2);
+       }
+       {
+               int i = 0;
+               assert (++i == 1);
+       }
+}
+


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