Johan B.W. de Vries 906b15c93c Large cleanup to the tests
They are now better organized and easier to extend, I hope.
2022-09-19 11:16:34 +02:00

31 lines
494 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