diff options
author | Mathias Hasselmann <mathias.hasselmann@gmx.de> | 2007-08-20 21:30:39 +0000 |
---|---|---|
committer | Mathias Hasselmann <hasselmm@src.gnome.org> | 2007-08-20 21:30:39 +0000 |
commit | 62bccb3fee57b7057643373e658ae6157f928f17 (patch) | |
tree | b0e66c214ab1735d4b3fd68ab90ae5974310efbf /tests/test-027.vala | |
parent | 078c5eddfdb5d9e13987e2241a0070cde0b40ad7 (diff) | |
download | vala-62bccb3fee57b7057643373e658ae6157f928f17.tar.gz |
Add test for prefix increments in while loops: do { } while (++i < x);
2007-08-20 Mathias Hasselmann <mathias.hasselmann@gmx.de>
* tests/test-027.*: Add test for prefix increments
in while loops: do { } while (++i < x);
svn path=/trunk/; revision=490
Diffstat (limited to 'tests/test-027.vala')
-rw-r--r-- | tests/test-027.vala | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/test-027.vala b/tests/test-027.vala index e01bdd482..b539c4d4b 100644 --- a/tests/test-027.vala +++ b/tests/test-027.vala @@ -47,14 +47,32 @@ class Maman.Bar { stdout.printf (" %d", foo + 2); } - static int main (string[] args) { + static void test_postfix_and_prefix_expressions () { stdout.printf ("Postfix and Prefix Expression Test: 1"); var bar = new Bar (); bar.run (); stdout.printf (" 18\n"); - + } + + static void test_prefix_increment_in_loop () { + stdout.printf ("Prefix Increment in Loop Test: "); + + int i = 0, j = 0; + + do { + stdout.printf (" %d", i); + j = j + 1; + } while (++i < 10 && j < 15); + + stdout.printf (" %d\n", i); + } + + static int main (string[] args) { + test_postfix_and_prefix_expressions (); + test_prefix_increment_in_loop (); + return 0; } } |