From 72af0dedf9e18911da65b9a5c4906689e868d9fc Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Mon, 8 Jun 2026 17:10:31 +0800 Subject: [legacy] Add functional and performance test suites --- rcc-legacy/tests/functional/42_index_func_ret.sy | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 rcc-legacy/tests/functional/42_index_func_ret.sy (limited to 'rcc-legacy/tests/functional/42_index_func_ret.sy') diff --git a/rcc-legacy/tests/functional/42_index_func_ret.sy b/rcc-legacy/tests/functional/42_index_func_ret.sy new file mode 100644 index 0000000..136d6eb --- /dev/null +++ b/rcc-legacy/tests/functional/42_index_func_ret.sy @@ -0,0 +1,24 @@ +// Use return value of a function as array's index +int _getMaxOfAll(int result[], int size) { + int maxNum; + maxNum = -999999; + size = size - 1; + while(size > -1) { + if (result[size] > maxNum) { + maxNum = result[size]; + } + size = size - 1; + } + return maxNum; +} + +int main() { + int result[3]; + result[0] = -2; + result[1] = 2; + result[2] = -7; + int x; + x = result[_getMaxOfAll(result, 3)]; + putint(x); + return 0; +} -- cgit v1.2.3