31 lines
493 B
Python
31 lines
493 B
Python
import pytest
|
|
|
|
from .helpers import Suite
|
|
|
|
@pytest.mark.slow_integration_test
|
|
def test_fib():
|
|
code_py = """
|
|
def helper(n: i32, a: i32, b: i32) -> i32:
|
|
if n < 1:
|
|
return a + b
|
|
|
|
return helper(n - 1, a + b, a)
|
|
|
|
def fib(n: i32) -> i32:
|
|
if n == 0:
|
|
return 0
|
|
|
|
if n == 1:
|
|
return 1
|
|
|
|
return helper(n - 1, 0, 1)
|
|
|
|
@exported
|
|
def testEntry() -> i32:
|
|
return fib(40)
|
|
"""
|
|
|
|
result = Suite(code_py).run_code()
|
|
|
|
assert 102334155 == result.returned_value
|