swig/Examples/test-suite/python/complextest_runme.py
Vadim Zeitlin ec565f74cf Extend C# complex support to member variables of this type
Define csvar{in,out} typemaps needed to support properties of complex type and
apply the existing cstype and csin ones to them as well.

Add unit test verifying that this works as expected in C# and, also, in
Python, even though no changes were needed there.
2017-04-01 23:51:45 +02:00

23 lines
475 B
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"
v = (complex(1, 2), complex(2, 3), complex(4, 3), 1)
try:
complextest.Copy_h(v)
except:
pass
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"