diff options
Diffstat (limited to 'tests/recursive_functions.sh')
| -rw-r--r-- | tests/recursive_functions.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/recursive_functions.sh b/tests/recursive_functions.sh new file mode 100644 index 0000000..709cfbe --- /dev/null +++ b/tests/recursive_functions.sh @@ -0,0 +1,15 @@ +test_exit_code 0 <<'EOF' +#include "../../helpers.h" + +int fib(int n) { + if (n <= 1) { + return 1; + } else { + return fib(n - 1) + fib(n - 2); + } +} + +int main() { + ASSERT_EQ(89, fib(10)); +} +EOF |
