Merge branch 'master' into gsoc2009-matevz

parser.y still to be fixed up

Conflicts:
	Doc/Devel/engineering.html
	Examples/Makefile.in
	Lib/allegrocl/allegrocl.swg
	Lib/csharp/csharp.swg
	Lib/csharp/enums.swg
	Lib/csharp/enumsimple.swg
	Lib/csharp/enumtypesafe.swg
	Lib/java/java.swg
	Lib/python/pydocs.swg
	Lib/r/rtype.swg
	Source/Include/swigwarn.h
	Source/Modules/octave.cxx
	Source/Modules/python.cxx
	Source/Modules/ruby.cxx
	Source/Swig/scanner.c
	Source/Swig/stype.c
	Source/Swig/swig.h
	configure.ac
This commit is contained in:
William S Fulton 2013-01-28 07:01:37 +00:00
commit e805d5f925
45 changed files with 54298 additions and 20093 deletions

View file

@ -31,40 +31,43 @@ PY2TO3 = 2to3 -x import
CPP_TEST_CASES += \
argcargvtest \
python_autodoc \
python_append \
callback \
complextest \
director_stl \
director_wstring \
file_test \
iadd \
inout \
input \
inplaceadd \
implicittest \
inout \
inplaceadd \
input \
kwargs_feature \
li_cstring \
li_cwstring \
li_factory \
li_implicit \
li_std_vectora \
li_std_vector_extra \
li_std_containers_int \
li_std_map_member \
li_std_multimap \
li_std_pair_extra \
li_std_set \
li_std_stream \
li_std_string_extra \
li_std_vectora \
li_std_vector_extra \
li_std_wstream \
li_std_wstring \
primitive_types \
python_abstractbase \
python_kwargs \
python_append \
python_director \
python_nondynamic \
python_overload_simple_cast \
python_richcompare \
simutry \
std_containers \
swigobject \
template_matrix \
simutry
template_matrix
# li_std_carray
# director_profile
@ -74,7 +77,8 @@ C_TEST_CASES += \
file_test \
li_cstring \
li_cwstring \
python_nondynamic
python_nondynamic \
python_varargs_typemap
#
# This test only works with modern C compilers
@ -84,6 +88,19 @@ C_TEST_CASES += \
include $(srcdir)/../common.mk
BUILTIN_BROKEN = \
default_constructor.cpptest \
director_exception.cpptest \
exception_order.cpptest \
li_std_string_extra.cpptest \
li_std_wstring.cpptest \
python_abstractbase.cpptest \
threads_exception.cpptest
BUILTIN_NOT_BROKEN = $(filter-out $(BUILTIN_BROKEN),$(NOT_BROKEN_TEST_CASES))
builtin-check : $(BUILTIN_NOT_BROKEN)
# Overridden variables here
LIBS = -L.
VALGRIND_OPT += --suppressions=pythonswig.supp
@ -117,7 +134,7 @@ VALGRIND_OPT += --suppressions=pythonswig.supp
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.py (or _runme3.py for Python 3) appended after the testcase name.
run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)
run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)
py2_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX)
py3_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX)

View file

@ -2,16 +2,16 @@ from argcargvtest import *
largs=['hi','hola','hello']
if mainc(largs) != 3:
raise RuntimeError, "bad main typemap"
raise RuntimeError("bad main typemap")
targs=('hi','hola')
if mainv(targs,1) != 'hola':
print mainv(targs,1)
raise RuntimeError, "bad main typemap"
print(mainv(targs,1))
raise RuntimeError("bad main typemap")
targs=('hi', 'hola')
if mainv(targs,1) != 'hola':
raise RuntimeError, "bad main typemap"
raise RuntimeError("bad main typemap")
try:
error = 0
@ -20,7 +20,7 @@ try:
except TypeError:
pass
if error:
raise RuntimeError, "bad main typemap"
raise RuntimeError("bad main typemap")

View file

@ -0,0 +1,176 @@
from autodoc import *
def check(got, expected):
if expected != got:
raise RuntimeError("\n" + "Expected: [" + str(expected) + "]\n" + "Got : [" + str(got) + "]")
check(A.__doc__, "Proxy of C++ A class")
check(A.funk.__doc__, "just a string")
check(A.func0.__doc__, "func0(self, arg2, hello) -> int")
check(A.func1.__doc__, "func1(A self, short arg2, Tuple hello) -> int")
check(A.func2.__doc__, "\n"
" func2(self, arg2, hello) -> int\n"
"\n"
" Parameters:\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"\n"
" "
)
check(A.func3.__doc__, "\n"
" func3(A self, short arg2, Tuple hello) -> int\n"
"\n"
" Parameters:\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"\n"
" "
)
check(A.func0default.__doc__, "\n"
" func0default(self, e, arg3, hello, f=2) -> int\n"
" func0default(self, e, arg3, hello) -> int\n"
" "
)
check(A.func1default.__doc__, "\n"
" func1default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
" func1default(A self, A e, short arg3, Tuple hello) -> int\n"
" "
)
check(A.func2default.__doc__, "\n"
" func2default(self, e, arg3, hello, f=2) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
" func2default(self, e, arg3, hello) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
"\n"
" "
)
check(A.func3default.__doc__, "\n"
" func3default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
" func3default(A self, A e, short arg3, Tuple hello) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
"\n"
" "
)
check(A.func0static.__doc__, "\n"
" func0static(e, arg2, hello, f=2) -> int\n"
" func0static(e, arg2, hello) -> int\n"
" "
)
check(A.func1static.__doc__, "\n"
" func1static(A e, short arg2, Tuple hello, double f=2) -> int\n"
" func1static(A e, short arg2, Tuple hello) -> int\n"
" "
)
check(A.func2static.__doc__, "\n"
" func2static(e, arg2, hello, f=2) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
" func2static(e, arg2, hello) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"\n"
" "
)
check(A.func3static.__doc__, "\n"
" func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
" func3static(A e, short arg2, Tuple hello) -> int\n"
"\n"
" Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"\n"
" "
)
check(A.variable_a.__doc__, "A_variable_a_get(self) -> int")
check(A.variable_b.__doc__, "A_variable_b_get(A self) -> int")
check(A.variable_c.__doc__, "\n"
"A_variable_c_get(self) -> int\n"
"\n"
"Parameters:\n"
" self: A *\n"
"\n"
)
check(A.variable_d.__doc__, "\n"
"A_variable_d_get(A self) -> int\n"
"\n"
"Parameters:\n"
" self: A *\n"
"\n"
)
check(B.__doc__, "Proxy of C++ B class")
check(C.__init__.__doc__, "__init__(self, a, b, h) -> C")
check(D.__init__.__doc__, "__init__(D self, int a, int b, Hola h) -> D")
check(E.__init__.__doc__, "\n"
" __init__(self, a, b, h) -> E\n"
"\n"
" Parameters:\n"
" a: special comment for parameter a\n"
" b: another special comment for parameter b\n"
" h: enum Hola\n"
"\n"
" "
)
check(F.__init__.__doc__, "\n"
" __init__(F self, int a, int b, Hola h) -> F\n"
"\n"
" Parameters:\n"
" a: special comment for parameter a\n"
" b: another special comment for parameter b\n"
" h: enum Hola\n"
"\n"
" "
)
check(B.funk.__doc__, "funk(B self, int c, int d) -> int")
check(funk.__doc__, "funk(A e, short arg2, int c, int d) -> int")
check(funkdefaults.__doc__, "\n"
" funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\n"
" funkdefaults(A e, short arg2, int c, int d) -> int\n"
" "
)
check(func_input.__doc__, "func_input(int * INPUT) -> int")
check(func_output.__doc__, "func_output() -> int")
check(func_inout.__doc__, "func_inout(int * INOUT) -> int")
check(banana.__doc__, "banana(S a, S b, int c, Integer d)")

View file

@ -0,0 +1,36 @@
from char_binary import *
t = Test()
if t.strlen('hile') != 4:
print t.strlen('hile')
raise RuntimeError, "bad multi-arg typemap"
if t.strlen('hil\0') != 4:
raise RuntimeError, "bad multi-arg typemap"
#
# creating a raw char*
#
pc = new_pchar(5)
pchar_setitem(pc, 0, 'h')
pchar_setitem(pc, 1, 'o')
pchar_setitem(pc, 2, 'l')
pchar_setitem(pc, 3, 'a')
pchar_setitem(pc, 4, 0)
if t.strlen(pc) != 4:
raise RuntimeError, "bad multi-arg typemap"
cvar.var_pchar = pc
if cvar.var_pchar != "hola":
print cvar.var_pchar
raise RuntimeError, "bad pointer case"
cvar.var_namet = pc
#if cvar.var_namet != "hola\0":
if cvar.var_namet != "hola":
raise RuntimeError, "bad pointer case"
delete_pchar(pc)

View file

@ -0,0 +1,17 @@
from default_arg_values import *
d = Display()
if d.draw1() != 0:
raise RuntimeError
if d.draw1(12) != 12:
raise RuntimeError
p = createPtr(123);
if d.draw2() != 0:
raise RuntimeError
if d.draw2(p) != 123:
raise RuntimeError

View file

@ -1,3 +1,7 @@
# This test is expected to fail with -builtin option.
# It uses the old static syntax (e.g., dc.new_A() rather than dc.A()),
# which is not provided with the -builtin option.
import _default_constructor
dc = _default_constructor

View file

@ -0,0 +1,5 @@
from director_alternating import *
id = getBar().id()
if id != idFromGetBar():
raise RuntimeError, "Got wrong id: " + str(id)

View file

@ -66,11 +66,15 @@ except MyException, e:
if not ok:
raise RuntimeError
# This is expected to fail with -builtin option
# Throwing builtin classes as exceptions not supported
try:
raise Exception2()
except Exception2:
pass
# This is expected to fail with -builtin option
# Throwing builtin classes as exceptions not supported
try:
raise Exception1()
except Exception1:

View file

@ -12,11 +12,16 @@ class FooBar2(Bar):
def pang(self):
return "FooBar2::pang();"
class FooBar3(Bar):
def cheer(self):
return "FooBar3::cheer();"
b = Bar()
f = b.create()
fb = FooBar()
fb2 = FooBar2()
fb3 = FooBar3()
try:
@ -66,7 +71,7 @@ try:
except:
pass
if not protected:
raise RuntimeError,"Boo::ping is protected"
raise RuntimeError,"Foo::ping is protected"
protected=1
try:
@ -86,3 +91,39 @@ except:
pass
if not protected:
raise RuntimeError,"FooBar::pang is protected"
protected=1
try:
b.cheer()
protected=0
except:
pass
if not protected:
raise RuntimeError,"Bar::cheer is protected"
protected=1
try:
f.cheer()
protected=0
except:
pass
if not protected:
raise RuntimeError,"Foo::cheer is protected"
if fb3.cheer() != "FooBar3::cheer();":
raise RuntimeError, "bad fb3::cheer"
if fb2.callping() != "FooBar2::ping();":
raise RuntimeError, "bad fb2.callping"
if fb2.callcheer() != "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();":
raise RuntimeError, "bad fb2.callcheer"
if fb3.callping() != "Bar::ping();":
raise RuntimeError, "bad fb3.callping"
if fb3.callcheer() != "FooBar3::cheer();":
raise RuntimeError, "bad fb3.callcheer"

View file

@ -0,0 +1,10 @@
import enum_forward
f1 = enum_forward.get_enum1();
f1 = enum_forward.test_function1(f1);
f2 = enum_forward.get_enum2();
f2 = enum_forward.test_function2(f2);
f3 = enum_forward.get_enum3();
f3 = enum_forward.test_function3(f3);

View file

@ -1,5 +1,7 @@
from exception_order import *
# This test is expected to fail with -builtin option.
# Throwing builtin classes as exceptions not supported
a = A()

View file

@ -0,0 +1,40 @@
from global_namespace import *
k1 = Klass1()
k2 = Klass2()
k3 = Klass3()
k4 = Klass4()
k5 = Klass5()
k6 = Klass6()
k7 = Klass7()
KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7)
KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7)
k1 = getKlass1A()
k2 = getKlass2A()
k3 = getKlass3A()
k4 = getKlass4A()
k5 = getKlass5A()
k6 = getKlass6A()
k7 = getKlass7A()
KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7)
KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7)
k1 = getKlass1B()
k2 = getKlass2B()
k3 = getKlass3B()
k4 = getKlass4B()
k5 = getKlass5B()
k6 = getKlass6B()
k7 = getKlass7B()
KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7)
KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7)
XYZMethods.methodA(XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
XYZMethods.methodB(XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
TheEnumMethods.methodA(theenum1, theenum2, theenum3)
TheEnumMethods.methodA(theenum1, theenum2, theenum3)

View file

@ -1,5 +1,5 @@
from global_ns_arg import *
a = foo(1)
b = bar()
b = bar_fn()

View file

@ -11,3 +11,4 @@ if x != -37:
raise RuntimeError
grouping.cvar.test3 = 42
grouping.test3 = 42

View file

@ -0,0 +1,73 @@
from implicittest import *
def check(a, b):
if a != b:
raise RuntimeError(str(a) + " does not equal " + str(b))
#### Class ####
# No implicit conversion
check(1, A(1).get())
check(2, A(1.0).get())
check(3, A(B()).get())
check(4, A("hello").get())
check(1, get(1))
check(2, get(1.0))
check(3, get(B()))
# Explicit constructor:
try:
check(4, get("hello"))
raise RuntimeError
except TypeError:
pass
#### Template Class ####
# No implicit conversion
check(1, A_int(1).get())
check(2, A_int(1.0).get())
check(3, A_int(B()).get())
check(4, A_int("hello").get())
check(1, A_int.sget(1))
check(2, A_int.sget(1.0))
check(3, A_int.sget(B()))
# explicit constructor:
try:
check(4, A_int.sget("hello"))
raise RuntimeError
except TypeError:
pass
#### Global variable assignment ####
cvar.foo = Foo(1); check(cvar.foo.ii, 1)
cvar.foo = 1; check(cvar.foo.ii, 1)
cvar.foo = 1.0; check(cvar.foo.ii, 2)
cvar.foo = Foo("hello"); check(cvar.foo.ii, 3)
# explicit constructor:
try:
cvar.foo = "hello"
raise RuntimeError
except TypeError:
pass
#### Member variable assignment ####
# Note: also needs naturalvar
b = Bar(); check(b.f.ii, 0)
b.f = Foo("hello"); check(b.f.ii, 3)
b.f = 1; check(b.f.ii, 1)
b.f = 1.0; check(b.f.ii, 2)
# explicit constructor:
try:
b.f = "hello"
raise RuntimeError
except TypeError:
pass

View file

@ -0,0 +1,7 @@
import import_stl_b
import import_stl_a
v_new = import_stl_b.process_vector([1,2,3])
if v_new != (1,2,3,4):
raise RuntimeError, v_new

View file

@ -0,0 +1,67 @@
from kwargs_feature import *
class MyFoo(Foo):
def __init__(self, a , b = 0):
Foo.__init__(self, a, b)
# Simple class
f1 = MyFoo(2)
f = Foo(b=2,a=1)
if f.foo(b=1,a=2) != 3:
raise RuntimeError
if Foo_statfoo(b=2) != 3:
raise RuntimeError
if f.efoo(b=2) != 3:
raise RuntimeError
if Foo_sfoo(b=2) != 3:
raise RuntimeError
# Templated class
b = BarInt(b=2,a=1)
if b.bar(b=1,a=2) != 3:
raise RuntimeError
if BarInt_statbar(b=2) != 3:
raise RuntimeError
if b.ebar(b=2) != 3:
raise RuntimeError
if BarInt_sbar(b=2) != 3:
raise RuntimeError
# Functions
if templatedfunction(b=2) != 3:
raise RuntimeError
if foo(a=1,b=2) != 3:
raise RuntimeError
if foo(b=2) != 3:
raise RuntimeError
#Funtions with keywords
if foo_kw(_from=2) != 4:
raise RuntimeError
if foo_nu(_from=2, arg2=3) != 2:
raise RuntimeError
if foo_mm(min=2) != 4:
raise RuntimeError
if foo_mm(max=3) != 4:
raise RuntimeError

View file

@ -0,0 +1,30 @@
from li_boost_shared_ptr_template import *
b = BaseINTEGER()
d = DerivedINTEGER()
if b.bar() != 1:
raise RuntimeError
if d.bar() != 2:
raise RuntimeError
if bar_getter(b) != 1:
raise RuntimeError
# Fix reverted in rev 12953
#if bar_getter(d) != 2:
# raise RuntimeError
b = BaseDefaultInt()
d = DerivedDefaultInt()
d2 = DerivedDefaultInt2()
if b.bar2() != 3:
raise RuntimeError
if d.bar2() != 4:
raise RuntimeError
if d2.bar2() != 4:
raise RuntimeError
if bar2_getter(b) != 3:
raise RuntimeError
# Fix reverted in rev 12953
#if bar2_getter(d) != 4:
# raise RuntimeError
#if bar2_getter(d2) != 4:
# raise RuntimeError

View file

@ -0,0 +1,265 @@
# Check std::vector and std::list behaves the same as Python iterable types (list)
from li_std_containers_int import *
def failed(a, b, msg):
raise RuntimeError, msg + " " + str(list(a)) + " " + str(list(b))
def compare_sequences(a, b):
if len(a) != len(b):
failed(a, b, "different sizes")
for i in range(len(a)):
if a[i] != b[i]:
failed(a, b, "elements are different")
def compare_containers(pythonlist, swigvector, swiglist):
compare_sequences(pythonlist, swigvector)
compare_sequences(pythonlist, swiglist)
# Check std::vector and std::list assignment behaves same as Python list assignment including exceptions
def container_insert_step(i, j, step, newval):
ps = range(6)
iv = vector_int(ps)
il = list_int(ps)
# Python slice
try:
if step == None:
if j == None:
ps[i] = newval
else:
ps[i:j] = newval
else:
if j == None:
ps[i::step] = newval
else:
ps[i:j:step] = newval
ps_error = None
except ValueError, e:
ps_error = e
except IndexError, e:
ps_error = e
# std::vector<int>
try:
if step == None:
if j == None:
iv[i] = newval
else:
iv[i:j] = newval
else:
if j == None:
iv[i::step] = newval
else:
iv[i:j:step] = newval
iv_error = None
except ValueError, e:
iv_error = e
except IndexError, e:
iv_error = e
# std::list<int>
try:
if step == None:
if j == None:
il[i] = newval
else:
il[i:j] = newval
else:
if j == None:
il[i::step] = newval
else:
il[i:j:step] = newval
il_error = None
except ValueError, e:
il_error = e
except IndexError, e:
il_error = e
if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
raise RuntimeError, "ValueError exception not consistently thrown: " + str(ps_error) + " " + str(iv_error) + " " + str(il_error)
compare_containers(ps, iv, il)
# Check std::vector and std::list delete behaves same as Python list delete including exceptions
def container_delete_step(i, j, step):
ps = range(6)
iv = vector_int(ps)
il = list_int(ps)
# Python slice
try:
if step == None:
if j == None:
del ps[i]
else:
del ps[i:j]
else:
if j == None:
del ps[i::step]
else:
del ps[i:j:step]
ps_error = None
except ValueError, e:
ps_error = e
except IndexError, e:
ps_error = e
# std::vector<int>
try:
if step == None:
if j == None:
del iv[i]
else:
del iv[i:j]
else:
if j == None:
del iv[i::step]
else:
del iv[i:j:step]
iv_error = None
except ValueError, e:
iv_error = e
except IndexError, e:
iv_error = e
# std::list<int>
try:
if step == None:
if j == None:
del il[i]
else:
del il[i:j]
else:
if j == None:
del il[i::step]
else:
del il[i:j:step]
il_error = None
except ValueError, e:
il_error = e
except IndexError, e:
il_error = e
if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
raise RuntimeError, "ValueError exception not consistently thrown: " + str(ps_error) + " " + str(iv_error) + " " + str(il_error)
compare_containers(ps, iv, il)
ps = [0,1,2,3,4,5]
iv = vector_int(ps)
il = list_int(ps)
# slices
compare_containers(ps[0:0], iv[0:0], il[0:0])
compare_containers(ps[1:1], iv[1:1], il[1:1])
compare_containers(ps[1:3], iv[1:3], il[1:3])
compare_containers(ps[2:4], iv[2:4], il[2:4])
compare_containers(ps[0:3], iv[0:3], il[0:3])
compare_containers(ps[3:6], iv[3:6], il[3:6])
compare_containers(ps[3:10], iv[3:10], il[3:10]) # beyond end of range
# before beginning of range (negative indexing)
compare_containers(ps[-1:7], iv[-1:7], il[-1:7])
compare_containers(ps[-2:7], iv[-2:7], il[-2:7])
compare_containers(ps[-5:7], iv[-5:7], il[-5:7])
compare_containers(ps[-6:7], iv[-6:7], il[-6:7])
# before beginning of range (negative indexing, negative index is > container size)
compare_containers(ps[-7:7], iv[-7:7], il[-7:7])
compare_containers(ps[-100:7], iv[-100:7], il[-100:7])
compare_containers(ps[3:], iv[3:], il[3:])
compare_containers(ps[:3], iv[:3], il[:3])
compare_containers(ps[:], iv[:], il[:])
compare_containers(ps[-3:], iv[-3:], il[-3:])
compare_containers(ps[-7:], iv[-7:], il[-7:])
compare_containers(ps[:-1], iv[:-1], il[:-1])
compare_containers(ps[:-7], iv[:-7], il[:-7])
# step slicing
compare_containers(ps[1:5:1], iv[1:5:1], il[1:5:1])
compare_containers(ps[1:5:2], iv[1:5:2], il[1:5:2])
compare_containers(ps[1:5:3], iv[1:5:3], il[1:5:3])
compare_containers(ps[1:5:4], iv[1:5:4], il[1:5:4])
compare_containers(ps[1:6:5], iv[1:6:5], il[1:6:5])
compare_containers(ps[1:7:5], iv[1:7:5], il[1:7:5])
compare_containers(ps[-1:7:1], iv[-1:7:1], il[-1:7:1])
compare_containers(ps[-1:7:2], iv[-1:7:2], il[-1:7:2])
compare_containers(ps[-6:7:2], iv[-6:7:2], il[-6:7:2])
compare_containers(ps[-100:7:2], iv[-100:7:2], il[-100:7:2])
compare_containers(ps[::1], iv[::1], il[::1])
compare_containers(ps[::2], iv[::2], il[::2])
compare_containers(ps[::-1], iv[::-1], il[::-1])
compare_containers(ps[6::-1], iv[6::-1], il[6::-1])
compare_containers(ps[:-3:-1], iv[:-3:-1], il[:-3:-1])
compare_containers(ps[:-6:-1], iv[:-6:-1], il[:-6:-1])
compare_containers(ps[:-7:-1], iv[:-7:-1], il[:-7:-1])
compare_containers(ps[:-8:-1], iv[:-8:-1], il[:-8:-1])
compare_containers(ps[:-100:-1], iv[:-100:-1], il[:-100:-1])
compare_containers(ps[4:6:-1], iv[4:6:-1], il[4:6:-1])
compare_containers(ps[4:5:-1], iv[4:5:-1], il[4:5:-1])
compare_containers(ps[4:4:-1], iv[4:4:-1], il[4:4:-1])
compare_containers(ps[4:3:-1], iv[4:3:-1], il[4:3:-1])
compare_containers(ps[4:2:-1], iv[4:2:-1], il[4:2:-1])
compare_containers(ps[100:104:-1], iv[100:104:-1], il[100:104:-1])
compare_containers(ps[104:100:-1], iv[104:100:-1], il[104:100:-1])
compare_containers(ps[-100:-104:-1], iv[-100:-104:-1], il[-100:-104:-1])
compare_containers(ps[-104:-100:-1], iv[-104:-100:-1], il[-104:-100:-1])
compare_containers(ps[::-2], iv[::-2], il[::-2])
compare_containers(ps[::-3], iv[::-3], il[::-3])
compare_containers(ps[::-4], iv[::-4], il[::-4])
compare_containers(ps[::-5], iv[::-5], il[::-5])
# insert sequences (growing, shrinking and staying same size)
for start in [-102, -100, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 100, 102]:
# single element set/replace
container_insert_step(start, None, None, 111)
for end in [-102, -100, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 100, 102]:
container_insert_step(start, end, None, [111, 222, 333, 444, 555, 666, 777])
container_insert_step(start, end, None, [111, 222, 333, 444, 555, 666])
container_insert_step(start, end, None, [111, 222, 333, 444, 555])
container_insert_step(start, end, None, [111, 222, 333, 444])
container_insert_step(start, end, None, [111, 222, 333])
container_insert_step(start, end, None, [111, 222])
container_insert_step(start, end, None, [111])
container_insert_step(start, end, None, [])
# delete sequences (growing, shrinking and staying same size)
for start in [-102, -100, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 100, 102]:
# single element delete
container_delete_step(start, None, None)
for end in [-102, -100, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 100, 102]:
container_delete_step(start, end, None)
for step in range(-7,7):
container_delete_step(start, end, step)
ps = range(6)
iv = vector_int(ps)
il = list_int(ps)
del ps[:]; del iv[:]; del il[:]
compare_containers(ps, iv, il)
for end in range(7):
for step in range(-7,7):
for start in range(7):
container_insert_step(start, end, step, [111, 222, 333, 444, 555, 666, 777])
container_insert_step(start, end, step, [111, 222, 333, 444, 555, 666])
container_insert_step(start, end, step, [111, 222, 333, 444, 555])
container_insert_step(start, end, step, [111, 222, 333, 444])
container_insert_step(start, end, step, [111, 222, 333])
container_insert_step(start, end, step, [111, 222])
container_insert_step(start, end, step, [111])
container_insert_step(start, end, step, [])
try:
x = iv[::0]
raise RuntimeError("Zero step not caught")
except ValueError:
pass

View file

@ -0,0 +1,9 @@
from li_std_except_as_class import *
# std::domain_error hierarchy
try: test_domain_error()
except domain_error: pass
try: test_domain_error()
except logic_error: pass
try: test_domain_error()
except exception: pass

Some files were not shown because too many files have changed in this diff Show more