mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add test for recursion
This commit is contained in:
parent
7ed1e3ff0b
commit
073e3b2eab
1 changed files with 11 additions and 0 deletions
|
@ -112,6 +112,17 @@ class TestYJIT < Test::Unit::TestCase
|
|||
RUBY
|
||||
end
|
||||
|
||||
def test_recursion
|
||||
assert_compiles(<<~'RUBY', insns: %i[opt_le opt_minus opt_plus], stdout: '34')
|
||||
def fib(n)
|
||||
return n if n <= 1
|
||||
fib(n-1) + fib(n-2)
|
||||
end
|
||||
|
||||
fib(9)
|
||||
RUBY
|
||||
end
|
||||
|
||||
def assert_compiles(test_script, insns: [], min_calls: 1, stdout: nil, exits: {})
|
||||
reset_stats = <<~RUBY
|
||||
YJIT.runtime_stats
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue