add complex test
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5693 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ee9e4bce5e
commit
cff86e376c
2 changed files with 37 additions and 0 deletions
31
SWIG/Examples/test-suite/python/complextest.i
Normal file
31
SWIG/Examples/test-suite/python/complextest.i
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
%module complextest
|
||||
|
||||
%include <complex.i>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
%inline
|
||||
{
|
||||
std::complex<double> Conj(const std::complex<double>& a)
|
||||
{
|
||||
return std::conj(a);
|
||||
}
|
||||
|
||||
std::complex<float> Conjf(const std::complex<float>& a)
|
||||
{
|
||||
return std::conj(a);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
%inline
|
||||
{
|
||||
complex Conj(complex a)
|
||||
{
|
||||
return conj(a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
6
SWIG/Examples/test-suite/python/complextest_runme.py
Normal file
6
SWIG/Examples/test-suite/python/complextest_runme.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import complextest
|
||||
|
||||
a = complex(1,2)
|
||||
|
||||
if complextest.Conj(a) != a.conjugate():
|
||||
raise RuntimeError, "bad complex mapping"
|
||||
Loading…
Add table
Add a link
Reference in a new issue