move iterator classes to pyiterator and add/test std_carray.i class
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8010 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c873fc6207
commit
984ecc3d4f
7 changed files with 529 additions and 333 deletions
8
Examples/test-suite/python/li_std_carray.i
Normal file
8
Examples/test-suite/python/li_std_carray.i
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
%module li_std_carray
|
||||
|
||||
%include <std_carray.i>
|
||||
|
||||
%template(Vector3) std::carray<double, 3>;
|
||||
|
||||
%template(Matrix3) std::carray<std::carray<double, 3>, 3>;
|
||||
|
||||
47
Examples/test-suite/python/li_std_carray_runme.py
Normal file
47
Examples/test-suite/python/li_std_carray_runme.py
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
from li_std_carray import *
|
||||
|
||||
|
||||
v3 = Vector3()
|
||||
|
||||
da = Vector3((1,2,3))
|
||||
print da
|
||||
|
||||
for i in range(0,len(v3)):
|
||||
v3[i] = i
|
||||
|
||||
i = 0
|
||||
for d in v3:
|
||||
if d != i:
|
||||
raise RuntimeError
|
||||
i += 1
|
||||
|
||||
|
||||
m3 = Matrix3()
|
||||
|
||||
for i in range(0,len(m3)):
|
||||
v3 = m3[i]
|
||||
print v3
|
||||
for j in range(0,len(v3)):
|
||||
v3[j] = i + j
|
||||
|
||||
i = 0
|
||||
for v3 in m3:
|
||||
j = 0
|
||||
for d in v3:
|
||||
if d != i + j:
|
||||
raise RuntimeError
|
||||
j += 1
|
||||
pass
|
||||
i += 1
|
||||
pass
|
||||
|
||||
for i in range(0,len(m3)):
|
||||
for j in range(0,len(m3)):
|
||||
if m3[i][j] != i + j:
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
print m3
|
||||
print m3[0]
|
||||
|
||||
da = Vector3((1,2,3))
|
||||
Loading…
Add table
Add a link
Reference in a new issue