fixes and more cases, as usual
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7768 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
39f173c12a
commit
535ac34ba3
9 changed files with 139 additions and 7 deletions
84
SWIG/Examples/test-suite/python/li_std_set_runme.py
Normal file
84
SWIG/Examples/test-suite/python/li_std_set_runme.py
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
from li_std_set import *
|
||||
|
||||
s = set_string()
|
||||
|
||||
s.append("a")
|
||||
s.append("b")
|
||||
s.append("c")
|
||||
|
||||
sum = ""
|
||||
for i in s:
|
||||
sum += i
|
||||
|
||||
if sum != "abc":
|
||||
raise RuntimeError
|
||||
|
||||
i = s.__iter__()
|
||||
if i.next() != "a":
|
||||
raise RuntimeError
|
||||
if i.next() != "b":
|
||||
raise RuntimeError
|
||||
if i.next() != "c":
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
b = s.begin()
|
||||
e = s.end()
|
||||
sum = ""
|
||||
while (b != e):
|
||||
sum += b.next()
|
||||
if sum != "abc":
|
||||
raise RuntimeError
|
||||
|
||||
b = s.rbegin()
|
||||
e = s.rend()
|
||||
sum = ""
|
||||
while (b != e):
|
||||
sum += b.next()
|
||||
|
||||
if sum != "cba":
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
|
||||
si = set_int()
|
||||
|
||||
si.append(1)
|
||||
si.append(2)
|
||||
si.append(3)
|
||||
i = si.__iter__()
|
||||
|
||||
if i.next() != 1:
|
||||
raise RuntimeError
|
||||
if i.next() != 2:
|
||||
raise RuntimeError
|
||||
if i.next() != 3:
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
|
||||
|
||||
i = s.begin()
|
||||
i.next()
|
||||
s.erase(i)
|
||||
|
||||
b = s.begin()
|
||||
e = s.end()
|
||||
sum = ""
|
||||
while (b != e):
|
||||
sum += b.next()
|
||||
if sum != "ac":
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
b = s.begin()
|
||||
e = s.end()
|
||||
if e - b != 2:
|
||||
raise RuntimeError
|
||||
|
||||
m = b + 1
|
||||
if m.value() != "c":
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue