aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/test_recursive_functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_recursive_functions.sh')
-rw-r--r--tests/test_recursive_functions.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_recursive_functions.sh b/tests/test_recursive_functions.sh
new file mode 100644
index 0000000..f9f0ee5
--- /dev/null
+++ b/tests/test_recursive_functions.sh
@@ -0,0 +1,14 @@
+test_exit_code 89 <<'EOF'
+int fib(int n) {
+ if (n <= 1) {
+ return 1;
+ } else {
+ return fib(n - 1) + fib(n - 2);
+ }
+}
+
+int main() {
+ return fib(10);
+}
+EOF
+