summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorTom Krauss <thomas.p.krauss@gmail.com>2017-03-27 08:27:52 -0500
committerTom Krauss <thomas.p.krauss@gmail.com>2017-03-27 08:27:52 -0500
commit94dcdb3d831b70d1c0f1cc2223895f0115fd6c76 (patch)
tree88b6703b6ed186c89bdcee0b8ce340b2f472c32a /testing
parent10c4d141bb0393d3bea52a29f3068bedbb4bb2de (diff)
downloadcffi-94dcdb3d831b70d1c0f1cc2223895f0115fd6c76.tar.gz
tests pass. Had to #include <complex.h> - might want to make that optional
Diffstat (limited to 'testing')
-rw-r--r--testing/cffi0/test_verify.py5
-rw-r--r--testing/cffi1/test_new_ffi_1.py2
-rw-r--r--testing/cffi1/test_realize_c_type.py8
-rw-r--r--testing/cffi1/test_verify1.py2
4 files changed, 13 insertions, 4 deletions
diff --git a/testing/cffi0/test_verify.py b/testing/cffi0/test_verify.py
index 25430bd..53c3f3f 100644
--- a/testing/cffi0/test_verify.py
+++ b/testing/cffi0/test_verify.py
@@ -241,14 +241,15 @@ def test_primitive_category():
F = tp.is_float_type()
I = tp.is_integer_type()
assert C == (typename in ('char', 'wchar_t'))
- assert F == (typename in ('float', 'double', 'long double'))
+ assert F == (typename in ('float', 'double', 'long double', 'float _Complex', 'double _Complex'))
assert I + F + C == 1 # one and only one of them is true
def test_all_integer_and_float_types():
typenames = []
for typename in all_primitive_types:
if (all_primitive_types[typename] == 'c' or
- typename == '_Bool' or typename == 'long double'):
+ typename == '_Bool' or typename == 'long double'
+ or '_Complex' in typename): # omit _Complex since ffi does not yet support
pass
else:
typenames.append(typename)
diff --git a/testing/cffi1/test_new_ffi_1.py b/testing/cffi1/test_new_ffi_1.py
index a1856a6..6e42571 100644
--- a/testing/cffi1/test_new_ffi_1.py
+++ b/testing/cffi1/test_new_ffi_1.py
@@ -1704,6 +1704,8 @@ class TestNewFFI1:
"ptrdiff_t",
"size_t",
"ssize_t",
+ 'double _Complex',
+ 'float _Complex',
])
for name in PRIMITIVE_TO_INDEX:
x = ffi.sizeof(name)
diff --git a/testing/cffi1/test_realize_c_type.py b/testing/cffi1/test_realize_c_type.py
index 40b1e9b..bddb38c 100644
--- a/testing/cffi1/test_realize_c_type.py
+++ b/testing/cffi1/test_realize_c_type.py
@@ -45,8 +45,14 @@ def test_funcptr_rewrite_args():
def test_all_primitives():
for name in cffi_opcode.PRIMITIVE_TO_INDEX:
- check(name, name)
+ if '_Complex' not in name:
+ check(name, name)
+def test_complex_primitives():
+ py.test.xfail("ffi does not support complex yet")
+ for name in cffi_opcode.PRIMITIVE_TO_INDEX:
+ if '_Complex' in name:
+ check(name, name)
def check_func(input, expected_output=None):
import _cffi_backend
diff --git a/testing/cffi1/test_verify1.py b/testing/cffi1/test_verify1.py
index aaeb244..72ddc49 100644
--- a/testing/cffi1/test_verify1.py
+++ b/testing/cffi1/test_verify1.py
@@ -221,7 +221,7 @@ def test_primitive_category():
F = tp.is_float_type()
I = tp.is_integer_type()
assert C == (typename in ('char', 'wchar_t'))
- assert F == (typename in ('float', 'double', 'long double'))
+ assert F == (typename in ('float', 'double', 'long double', 'float _Complex', 'double _Complex'))
assert I + F + C == 1 # one and only one of them is true
def test_all_integer_and_float_types():