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.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.6% of users enabled 2FA.

Commit 04711fe7 authored by John Zhang's avatar John Zhang
Browse files

fix result type of function pointers

parent 4b638cbf
from util import fncptr_from_c_script
import ctypes
def test_add():
fn, _ = fncptr_from_c_script("test_add.c", "test_fnc")
fn, _ = fncptr_from_c_script("test_add.c", "test_fnc", restype=ctypes.c_uint8)
assert fn() == 9
def test_sub():
fn, _ = fncptr_from_c_script("test_sub.c", "test_fnc")
fn, _ = fncptr_from_c_script("test_sub.c", "test_fnc", restype=ctypes.c_uint8)
assert fn() == 11
def test_mul():
fn, _ = fncptr_from_c_script("test_mul.c", "test_fnc")
fn, _ = fncptr_from_c_script("test_mul.c", "test_fnc", restype=ctypes.c_uint8)
assert fn() == 0xf6
def test_sdiv():
fn, _ = fncptr_from_c_script("test_sdiv.c", "test_fnc")
fn, _ = fncptr_from_c_script("test_sdiv.c", "test_fnc", restype=ctypes.c_uint8)
assert fn() == 0xf4
def test_urem():
fn, _ = fncptr_from_c_script("test_urem.c", "test_fnc")
fn, _ = fncptr_from_c_script("test_urem.c", "test_fnc", restype=ctypes.c_uint8)
assert fn() == 5
def test_shl():
fn, _ = fncptr_from_c_script("test_shl.c", "test_fnc")
fn, _ = fncptr_from_c_script("test_shl.c", "test_fnc", restype=ctypes.c_uint64)
assert fn() == 0x7e707560c92d5400
def test_lshr():
fn, _ = fncptr_from_c_script("test_lshr.c", "test_fnc")
fn, _ = fncptr_from_c_script("test_lshr.c", "test_fnc", restype=ctypes.c_uint64)
assert fn() == 0x2367e707560c92
def test_and():
fn, _ = fncptr_from_c_script("test_and.c", "test_fnc")
fn, _ = fncptr_from_c_script("test_and.c", "test_fnc", restype=ctypes.c_uint64)
assert fn() == 0x8588901c10004b14
def test_xor():
fn, _ = fncptr_from_c_script("test_xor.c", "test_fnc")
fn, _ = fncptr_from_c_script("test_xor.c", "test_fnc", restype=ctypes.c_uint64)
assert fn() == 0x58376ec3e83fa0e1
from util import fncptr_from_c_script
import ctypes
def test_eq_int():
fn, _ = fncptr_from_c_script("test_eq_int.c", "test_fnc")
......@@ -17,21 +18,21 @@ def test_ne_ref():
assert fn() == 1
def test_sge():
fn, _ = fncptr_from_c_script("test_sge.c", "test_fnc")
fn, _ = fncptr_from_c_script("test_sge.c", "test_fnc", restype=ctypes.c_uint8)
assert fn() == 1
def test_sgt():
fn, _ = fncptr_from_c_script("test_sgt.c", "test_fnc")
fn, _ = fncptr_from_c_script("test_sgt.c", "test_fnc", restype=ctypes.c_uint8)
assert fn() == 0
def test_sle():
fn, _ = fncptr_from_c_script("test_sle.c", "test_fnc")
fn, _ = fncptr_from_c_script("test_sle.c", "test_fnc", restype=ctypes.c_uint8)
assert fn() == 1
def test_slt():
fn, _ = fncptr_from_c_script("test_slt.c", "test_fnc")
fn, _ = fncptr_from_c_script("test_slt.c", "test_fnc", restype=ctypes.c_uint8)
assert fn() == 0
def test_ult():
fn, _ = fncptr_from_c_script("test_ult.c", "test_fnc")
fn, _ = fncptr_from_c_script("test_ult.c", "test_fnc", restype=ctypes.c_uint8)
assert fn() == 0
from util import fncptr_from_c_script
import ctypes
def test_trunc():
fn, _ = fncptr_from_c_script("test_trunc.c", "test_fnc")
fn, _ = fncptr_from_c_script("test_trunc.c", "test_fnc", restype=ctypes.c_uint32)
assert fn() == 0x58324b55
......
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