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



commit 84e6a6753ab71c96b168d9dc15e5486150f48694
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 2ed899e7d..261bda9a8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -210,6 +210,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]