From b08be4c99545e73c302d7e2396e6f9d236de3c8f Mon Sep 17 00:00:00 2001 From: Minero Aoki Date: Fri, 8 May 2009 10:40:51 +0000 Subject: [PATCH] r4744@macbookpro: aamine | 2009-05-06 14:52:16 +0900 test increment in return expression. git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4179 1b9489fe-b721-0410-924e-b54b9192deb8 --- test/inc.cb | 8 ++++++++ test/test_cbc.sh | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/test/inc.cb b/test/inc.cb index a149065..b0f55b9 100644 --- a/test/inc.cb +++ b/test/inc.cb @@ -17,7 +17,15 @@ main(int argc, char **argv) j = i++; printf(";%d", j); // 3 printf(";%d", i); // 4 + printf(";%d", inc(i)); // 5 + printf(";%d", inc(i)); // 5 puts(""); return 0; } + +static int +inc(int i) +{ + return ++i; +} diff --git a/test/test_cbc.sh b/test/test_cbc.sh index e931678..97c7490 100644 --- a/test/test_cbc.sh +++ b/test/test_cbc.sh @@ -94,7 +94,7 @@ test_09_cmp() { test_10_assign() { assert_out "1;2;2;3;4;5;6;7;8;8;9;10;11;777;S;12" ./assign assert_out "3;4;3;12;4;1;1;7;5;1;4;e;H;76;75;1;3;6;82;81" ./opassign - assert_out "0;1;2;2;3;3;4" ./inc + assert_out "0;1;2;2;3;3;4;5;5" ./inc assert_out "4;3;2;2;1;1;0" ./dec assert_compile_success textwrite.cb }