WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

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

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