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

fix result type of function pointers

parent 4b638cbf
Pipeline #143 failed with stage
in 12 minutes and 2 seconds
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