Recursive factorial function for testing recursive scenarios
| 10 | |
| 11 | // Recursive factorial function for testing recursive scenarios |
| 12 | int recursive_factorial(int n) { |
| 13 | CTRACK; |
| 14 | if (n <= 1) { |
| 15 | test_helpers::sleep_ms(5); // Small work at base case |
| 16 | return 1; |
| 17 | } |
| 18 | test_helpers::sleep_ms(5); // Work at each level |
| 19 | return n * recursive_factorial(n - 1); |
| 20 | } |
| 21 | |
| 22 | // Recursive fibonacci for testing deep recursion with branching |
| 23 | int recursive_fibonacci(int n) { |
no test coverage detected