summaryrefslogtreecommitdiff
path: root/testing/cffi0
diff options
context:
space:
mode:
authorguillaumesottas <guillaumesottas@Guillaumes-MacBook-Pro.local>2019-03-26 13:09:18 -0600
committerguillaumesottas <guillaumesottas@Guillaumes-MacBook-Pro.local>2019-03-26 13:09:18 -0600
commit23f4b0b03bb5acf8c4770979d45dceda3e056fe4 (patch)
treeaadad91539e1baa7974211ebabe5fa55547ff78e /testing/cffi0
parent21e166d3a7641bda5821f23c3d6cc349585d1697 (diff)
downloadcffi-23f4b0b03bb5acf8c4770979d45dceda3e056fe4.tar.gz
add support for long/long long C integer constant suffixes, and support
for base 2 integer constant as well.
Diffstat (limited to 'testing/cffi0')
-rw-r--r--testing/cffi0/test_parsing.py39
1 files changed, 36 insertions, 3 deletions
diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py
index c06c4b6..0255d70 100644
--- a/testing/cffi0/test_parsing.py
+++ b/testing/cffi0/test_parsing.py
@@ -470,6 +470,39 @@ def test_error_invalid_syntax_for_cdef():
def test_unsigned_int_suffix_for_constant():
ffi = FFI()
ffi.cdef("""enum e {
- enumerator_0=0x00,
- enumerator_1=0x01u,
- enumerator_1=0x01U};""")
+ bin_0=0b10,
+ bin_1=0b10u,
+ bin_2=0b10U,
+ bin_3=0b10l,
+ bin_4=0b10L,
+ bin_5=0b10ll,
+ bin_6=0b10LL,
+ oct_0=010,
+ oct_1=010u,
+ oct_2=010U,
+ oct_3=010l,
+ oct_4=010L,
+ oct_5=010ll,
+ oct_6=010LL,
+ dec_0=10,
+ dec_1=10u,
+ dec_2=10U,
+ dec_3=10l,
+ dec_4=10L,
+ dec_5=10ll,
+ dec_6=10LL,
+ hex_0=0x10,
+ hex_1=0x10u,
+ hex_2=0x10U,
+ hex_3=0x10l,
+ hex_4=0x10L,
+ hex_5=0x10ll,
+ hex_6=0x10LL,};""")
+ needs_dlopen_none()
+ C = ffi.dlopen(None)
+ for base, expected_result in (('bin', 2), ('oct', 8), ('dec', 10), ('hex', 16)):
+ for index in range(7):
+ try:
+ assert getattr(C, '{base}_{index}'.format(base=base, index=index)) == expected_result
+ except AssertionError as e:
+ raise e