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
|
|
@ -163,6 +163,7 @@ CPP_TEST_CASES += \
|
|||
li_cdata \
|
||||
li_cpointer \
|
||||
li_std_deque \
|
||||
li_std_except \
|
||||
li_std_pair \
|
||||
li_std_string \
|
||||
li_std_vector \
|
||||
|
|
|
|||
21
SWIG/Examples/test-suite/li_std_except.i
Normal file
21
SWIG/Examples/test-suite/li_std_except.i
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
%module li_std_except
|
||||
|
||||
%include <std_except.i>
|
||||
|
||||
|
||||
%inline %{
|
||||
struct E1 : public std::exception
|
||||
{
|
||||
};
|
||||
|
||||
struct E2
|
||||
{
|
||||
};
|
||||
|
||||
struct Test {
|
||||
int foo1() throw(std::bad_exception) { return 0; }
|
||||
int foo2() throw(std::logic_error) { return 0; }
|
||||
int foo3() throw(E1) { return 0; }
|
||||
int foo4() throw(E2) { return 0; }
|
||||
};
|
||||
%}
|
||||
|
|
@ -485,3 +485,4 @@ clientdata_prop_a.py
|
|||
clientdata_prop_b.py
|
||||
imports_a.py
|
||||
imports_b.py
|
||||
li_std_set.py
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ CPP_TEST_CASES += \
|
|||
li_cstring \
|
||||
li_cwstring \
|
||||
li_implicit \
|
||||
li_std_except \
|
||||
li_std_vectora \
|
||||
li_std_map \
|
||||
li_std_set \
|
||||
li_std_stream \
|
||||
li_std_wstream \
|
||||
li_std_wstring \
|
||||
|
|
|
|||
|
|
@ -3,11 +3,9 @@ a = inplaceadd.A(7)
|
|||
|
||||
a += 5
|
||||
if a.val != 12:
|
||||
print a.val
|
||||
raise RuntimeError
|
||||
|
||||
if a.thisown != 1:
|
||||
raise RuntimeError
|
||||
|
||||
a -= 5
|
||||
if a.val != 7:
|
||||
raise RuntimeError
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%module li_std_map
|
||||
%module("templatereduce") li_std_map
|
||||
|
||||
%include std_pair.i
|
||||
%include std_map.i
|
||||
|
|
|
|||
|
|
@ -11,7 +11,19 @@ if 1:
|
|||
m[1] = a1
|
||||
m[2] = a2
|
||||
|
||||
li_std_map.p_identa(p1)
|
||||
li_std_map.m_identa(m)
|
||||
pp1 = li_std_map.p_identa(p1)
|
||||
mm = li_std_map.m_identa(m)
|
||||
|
||||
|
||||
|
||||
m = li_std_map.mapA()
|
||||
m[1] = a1
|
||||
m[2] = a2
|
||||
for i in m:
|
||||
if m[i[0]].this != i[1].this:
|
||||
print m[i[0]].this, i[1].this
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
15
SWIG/Examples/test-suite/python/li_std_set.i
Normal file
15
SWIG/Examples/test-suite/python/li_std_set.i
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
%module li_std_set
|
||||
|
||||
%include <std_string.i>
|
||||
%include <std_set.i>
|
||||
%include <std_multiset.i>
|
||||
%include <std_vector.i>
|
||||
|
||||
%template(set_string) std::set<std::string>;
|
||||
%template(set_int) std::multiset<int>;
|
||||
|
||||
|
||||
%template(v_int) std::vector<int>;
|
||||
|
||||
|
||||
|
||||
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