cffi_tests.cffi0.test_vgen:test_varargs
def test_varargs():
ffi = FFI()
ffi.cdef("int foo(int x, ...);")
lib = ffi.verify("""
int foo(int x, ...) {
va_list vargs;
va_start(vargs, x);
x -= va_arg(vargs, int);
x -= va_arg(vargs, int);
va_end(vargs);
return x;
}
""")
> assert lib.foo(50, ffi.cast("int", 5), ffi.cast("int", 3)) == 42
E AssertionError: assert 50 == 42
E + where 50 = <cdata 'int(*)(int, ...)' 0x10af57f70>(50, <cdata 'int' 5>, <cdata 'int' 3>)
E + where <cdata 'int(*)(int, ...)' 0x10af57f70> = <module ''>.foo
E + and <cdata 'int' 5> = <bound method FFI.cast of <extra_tests.cffi_tests.cffi0.test_verify.FFI object at 0x00000003b871d910>>('int', 5)
E + where <bound method FFI.cast of <extra_tests.cffi_tests.cffi0.test_verify.FFI object at 0x00000003b871d910>> = <extra_tests.cffi_tests.cffi0.test_verify.FFI object at 0x00000003b871d910>.cast
E + and <cdata 'int' 3> = <bound method FFI.cast of <extra_tests.cffi_tests.cffi0.test_verify.FFI object at 0x00000003b871d910>>('int', 3)
E + where <bound method FFI.cast of <extra_tests.cffi_tests.cffi0.test_verify.FFI object at 0x00000003b871d910>> = <extra_tests.cffi_tests.cffi0.test_verify.FFI object at 0x00000003b871d910>.cast
../build/extra_tests/cffi_tests/cffi0/test_verify.py:1051: AssertionError
builder: pypy-c-jit-macos-arm64 build #1295+
test: cffi_tests.cffi0.test_vgen:test_varargs