pypy/module/_cffi_backend/test/test_recompiler.py::AppTestRecompiler::()::test_macro_check_value
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x00000140328d5de0>
def test_macro_check_value(self):
# the value '-0x80000000' in C sources does not have a clear meaning
# to me; it appears to have a different effect than '-2147483648'...
# Moreover, on 32-bits, -2147483648 is actually equal to
# -2147483648U, which in turn is equal to 2147483648U and so positive.
import sys
vals = ['42', '-42', '0x80000000', '-2147483648',
'0', '9223372036854775809ULL',
'-9223372036854775807LL']
if sys.maxsize <= 2**32:
vals.remove('-2147483648')
cdef_lines = ['#define FOO_%d_%d %s' % (i, j, vals[i])
for i in range(len(vals))
for j in range(len(vals))]
verify_lines = ['#define FOO_%d_%d %s' % (i, j, vals[j]) # [j], not [i]
for i in range(len(vals))
for j in range(len(vals))]
ffi, lib = self.prepare(
'\n'.join(cdef_lines),
'test_macro_check_value_ok',
'\n'.join(verify_lines))
for j in range(len(vals)):
c_got = int(vals[j].replace('U', '').replace('L', ''), 0)
c_compiler_msg = str(c_got)
if c_got > 0:
c_compiler_msg += ' (0x%x)' % (c_got,)
#
for i in range(len(vals)):
attrname = 'FOO_%d_%d' % (i, j)
if i == j:
x = getattr(lib, attrname)
assert x == c_got
else:
> e = raises(ffi.error, getattr, lib, attrname)
E (application-level) AssertionError: DID NOT RAISE
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\test\test_recompiler.py:220]:38: AssertionError
---------- Captured stdout call ----------
generating d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c
_CFFI_test_macro_check_value_ok.c
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(658): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(659): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(721): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(722): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(784): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(785): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(822): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(831): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(840): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(847): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(848): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(849): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(858): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(867): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(876): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(910): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(911): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(973): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(974): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(1036): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.c(1037): warning C4146: unary minus operator applied to unsigned type, result still unsigned
Creating library d:\systemtemp\pytest\usession-main-3291\recompiler\Release\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.pypy-73.lib and object d:\systemtemp\pytest\usession-main-3291\recompiler\Release\systemtemp\pytest\usession-main-3291\recompiler\_CFFI_test_macro_check_value_ok.pypy-73.exp
Generating code
Finished generating code
builder: own-win-x86-64 build #2235
test: pypy/module/_cffi_backend/test/test_recompiler/py/AppTestRecompiler/()/test_macro_check_value