diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2020-07-14 14:13:51 +0200 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2020-07-15 07:57:27 +0200 |
commit | 9e9a2102c8c66df6eb5216573314243b34b95e06 (patch) | |
tree | 43b898a17a81d70cd2d402bd465ac07add4cf57d | |
parent | e0da25c55274e7af0e68350a9f267e926464b500 (diff) | |
download | vala-9e9a2102c8c66df6eb5216573314243b34b95e06.tar.gz |
tests: Add "pre/post-increment" tests to increase coverage
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/control-flow/pre-post-increment.vala | 21 |
2 files changed, 22 insertions, 0 deletions
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); + } +} + |