* commit '8245277ad3':
Remove test for unsupported complex or _Complex by itself
More C99 complex fixes, plus Python tests
Restore _Complex as standalone type
Small corrections for handling C99 _Complex
Properly handle C99 complex types even in C++ mode
Conflicts:
Examples/test-suite/python/complextest_runme.py
47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
import complextest
|
|
|
|
a = complex(-1, 2)
|
|
|
|
if complextest.Conj(a) != a.conjugate():
|
|
raise RuntimeError("bad complex mapping")
|
|
|
|
if complextest.Conjf(a) != a.conjugate():
|
|
raise RuntimeError("bad complex mapping")
|
|
|
|
if complextest.Conj2(a) != a.conjugate():
|
|
raise RuntimeError("bad complex mapping")
|
|
|
|
if complextest.Conjf2(a) != a.conjugate():
|
|
raise RuntimeError("bad complex mapping")
|
|
|
|
if 'Conj3' in dir(complextest):
|
|
if complextest.Conj3(a) != a.conjugate():
|
|
raise RuntimeError("bad complex mapping")
|
|
|
|
if 'Conjf3' in dir(complextest):
|
|
if complextest.Conjf3(a) != a.conjugate():
|
|
raise RuntimeError("bad complex mapping")
|
|
|
|
if 'Conj4' in dir(complextest):
|
|
if complextest.Conj4(a) != a.conjugate():
|
|
raise RuntimeError("bad complex mapping")
|
|
|
|
if 'Conj5' in dir(complextest):
|
|
if complextest.Conj5(a) != a.conjugate():
|
|
raise RuntimeError("bad complex mapping")
|
|
|
|
if 'CopyHalf' in dir(complextest):
|
|
|
|
v = (complex(1, 2), complex(2, 3), complex(4, 3), 1)
|
|
|
|
if len(complextest.CopyHalf(v)) != 2:
|
|
raise RuntimeError("CopyHalf failed")
|
|
|
|
if len(complextest.CopyHalfRef(v)) != 2:
|
|
raise RuntimeError("CopyHalfRef failed")
|
|
|
|
p = complextest.ComplexPair()
|
|
p.z1 = complex(0, 1)
|
|
p.z2 = complex(0, -1)
|
|
if complextest.Conj(p.z2) != p.z1:
|
|
raise RuntimeError("bad complex mapping")
|