Skip to content

Commit

Permalink
Add two more small tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maximecb authored and k0kubun committed Aug 25, 2022
1 parent 54e2f17 commit 07a8498
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions bootstraptest/test_yjit_new_backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,41 @@ def foo(n)
end
foo(3)
}














# Microbenchmark with a loop, opt_lt
assert_equal '55', %q{
def foo(n)
i = 0
s = 0
while i < n do
i += 1
s += i
end
s
end
foo(10)
}

# Small recursive microbenchmark
assert_equal '21', %q{
def fib(n)
if n < 2
return n
end
return fib(n-1) + fib(n-2)
end
fib(8)
}

0 comments on commit 07a8498

Please sign in to comment.