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



commit 5ae9d6b888f988dc83ba8b99d3447dc5b70f6baa
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 8cda2904c..42cad8968 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/switch-enum.vala \
        control-flow/sideeffects.vala \
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]