Exemplo n.º 1
0
def test_mutability():
    ty = ts.function(ts.int_, (ts.float_,))
    ty.args
    try:
        ty.args = [1, 2]
    except AttributeError as e:
        pass
    else:
        raise Exception("Expected: AttributeError: Cannot set attribute 'args' of type ...")
Exemplo n.º 2
0
def test_mutability():
    ty = ts.function(ts.int_, (ts.float_,))
    ty.args
    try:
        ty.args = [1, 2]
    except AttributeError as e:
        pass
    else:
        raise Exception(
            "Expected: AttributeError: Cannot set attribute 'args' of type ...")
Exemplo n.º 3
0
def test_functions():
    functype1 = ts.function(ts.int_, (ts.float_,))
    functype2 = ts.function(ts.int_, (ts.float_,))
    functype3 = ts.function(ts.int_, (ts.float_,), is_vararg=False)
    functype4 = ts.function(ts.int_, (ts.float_,), name="hello")
    functype5 = ts.function(ts.int_, (ts.float_,), name="hello", is_vararg=False)
    functype6 = ts.function(ts.int_, (ts.float_,), name="hello", is_vararg=True)

    assert functype1 is functype2
    assert functype1 is functype3
    assert functype1 is not functype4
    assert functype1 is not functype5
    assert functype1 is not functype6

    assert functype4 is functype5
    assert functype4 is not functype6
Exemplo n.º 4
0
def test_functions():
    functype1 = ts.function(ts.int_, (ts.float_,))
    functype2 = ts.function(ts.int_, (ts.float_,))
    functype3 = ts.function(ts.int_, (ts.float_,), is_vararg=False)
    functype4 = ts.function(ts.int_, (ts.float_,), name="hello")
    functype5 = ts.function(ts.int_, (ts.float_,), name="hello", is_vararg=False)
    functype6 = ts.function(ts.int_, (ts.float_,), name="hello", is_vararg=True)

    assert functype1 is functype2
    assert functype1 is functype3
    assert functype1 is not functype4
    assert functype1 is not functype5
    assert functype1 is not functype6

    assert functype4 is functype5
    assert functype4 is not functype6
Exemplo n.º 5
0
def test_ctypes_functions(): # TODO: unifiy with test_llvm_functions
    functype = ts.function(ts.int_, (ts.float_,))
    cfunctype = cts.function(cts.int_, (cts.float_,))
    assert ct(functype) == cfunctype
Exemplo n.º 6
0
def test_llvm_functions():
    functype = ts.function(ts.int_, (ts.float_,))
    lfunctype = lts.function(lts.int_, (lts.float_,))
    assert llvmt(functype) == lfunctype
Exemplo n.º 7
0
def test_functions():
    functype = ts.function(ts.int_, (ts.float_, ))
    assert str(functype) == "int (*)(float32)", functype
    functype = ts.function(ts.int_, (ts.float_, ), "hello")
    assert str(functype) == "int (*hello)(float32)", functype
Exemplo n.º 8
0
def test_functions():
    functype = ts.function(ts.int_, (ts.float_,))
    assert str(functype) == "int (*)(float32)", functype
    functype = ts.function(ts.int_, (ts.float_,), "hello")
    assert str(functype) == "int (*hello)(float32)", functype
Exemplo n.º 9
0
def test_llvm_functions():
    functype = ts.function(ts.int_, (ts.float_, ))
    lfunctype = lts.function(lts.int_, (lts.float_, ))
    assert llvmt(functype) == lfunctype
Exemplo n.º 10
0
def test_ctypes_functions():  # TODO: unifiy with test_llvm_functions
    functype = ts.function(ts.int_, (ts.float_, ))
    cfunctype = cts.function(cts.int_, (cts.float_, ))
    assert ct(functype) == cfunctype