We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 102c48c commit 97a478fCopy full SHA for 97a478f
test/ruby/test_zjit.rb
@@ -348,6 +348,31 @@ def test(n)
348
}
349
end
350
351
+ def test_recursive_fact
352
+ assert_compiles '[1, 6, 720]', %q{
353
+ def fact(n)
354
+ if n == 0
355
+ return 1
356
+ end
357
+ return n * fact(n-1)
358
359
+ [fact(0), fact(3), fact(6)]
360
+ }
361
362
+
363
+ # FIXME: currently produces the wrong value
364
+ #def test_recursive_fib
365
+ # assert_compiles '[0, 2, 3]', %q{
366
+ # def fib(n)
367
+ # if n < 2
368
+ # return n
369
+ # end
370
+ # return fib(n-1) + fib(n-2)
371
372
+ # [fib(0), fib(3), fib(4)]
373
+ # }
374
+ #end
375
376
private
377
378
# Assert that every method call in `test_script` can be compiled by ZJIT
0 commit comments