예제 #1
0
def test_enum():
    from re_python_pysrc import ffi
    assert ffi.integer_const("BB") == 1
    e = ffi.cast("enum foo_e", 2)
    assert ffi.string(e) == "CC"
예제 #2
0
def test_function_with_varargs():
    import _cffi_backend
    from re_python_pysrc import ffi
    lib = ffi.dlopen(extmod, 0)
    assert lib.add43(45, ffi.cast("int", -5)) == 45
    assert type(lib.add43) is _cffi_backend.FFI.CData
예제 #3
0
def test_opaque_struct():
    from re_python_pysrc import ffi
    ffi.cast("struct foo_s *", 0)
    py.test.raises(TypeError, ffi.new, "struct foo_s *")
예제 #4
0
 def test_enum(self):
     self.fix_path()
     from re_python_pysrc import ffi
     assert ffi.integer_const("BB") == 1
     e = ffi.cast("enum foo_e", 2)
     assert ffi.string(e) == "CC"
예제 #5
0
 def test_opaque_struct(self):
     self.fix_path()
     from re_python_pysrc import ffi
     ffi.cast("struct foo_s *", 0)
     raises(TypeError, ffi.new, "struct foo_s *")
def test_opaque_struct():
    from re_python_pysrc import ffi
    ffi.cast("struct foo_s *", 0)
    py.test.raises(TypeError, ffi.new, "struct foo_s *")
def test_function_with_varargs():
    import _cffi_backend
    from re_python_pysrc import ffi
    lib = ffi.dlopen(extmod, 0)
    assert lib.add43(45, ffi.cast("int", -5)) == 45
    assert type(lib.add43) is _cffi_backend.FFI.CData