GitLab will be upgraded on June 2nd 2020 at 2.00 pm (AEDT) to 3.00 pm (AEDT) due to Critical Security Patch Availability. During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to local Gitlab admin team.

Commit 05e7b1cc authored by John Zhang's avatar John Zhang

forgot this file

parent b5606cac
from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.rlib import rmu_fast as rmu
from util import fncptr_from_rpy_func, fncptr_from_py_script, call_and_check
from util import fncptr_from_rpy_func, fncptr_from_py_script, may_spawn_proc
import ctypes
@may_spawn_proc
def test_fibonacci():
from perftarget.fibonacci import fib
fnc, (db, bdlgen) = fncptr_from_rpy_func(fib, [rffi.ULONGLONG], rffi.ULONGLONG)
bdlgen.mu.current_thread_as_mu_thread(rmu.null(rmu.MuCPtr))
def check(f):
assert f == 6765
call_and_check(fnc, (rffi.cast(rffi.ULONGLONG, 20), ), check)
fnc(rffi.cast(rffi.ULONGLONG, 20)) == 6765
@may_spawn_proc
def test_fibonacci_iterative():
def fib_iter(n):
if n <= 1:
......@@ -32,7 +31,4 @@ def test_fibonacci_iterative():
fnc, (db, bdlgen) = fncptr_from_rpy_func(fib_iter, [rffi.ULONGLONG], rffi.ULONGLONG)
bdlgen.mu.current_thread_as_mu_thread(rmu.null(rmu.MuCPtr))
def check(f):
assert f == 6765
call_and_check(fnc, (rffi.cast(rffi.ULONGLONG, 20),), check)
\ No newline at end of file
assert fnc(rffi.cast(rffi.ULONGLONG, 20))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment