merge revisions 11243-11872 from trunk to gsoc2009-matevz

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@12162 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-07-20 21:58:41 +00:00
commit ab1cd03979
387 changed files with 12383 additions and 4412 deletions

View file

@ -49,7 +49,6 @@ CPP_TEST_CASES += \
li_implicit \
li_std_vectora \
li_std_vector_extra \
li_std_map \
li_std_multimap \
li_std_pair_extra \
li_std_set \
@ -89,6 +88,9 @@ include $(srcdir)/../common.mk
LIBS = -L.
VALGRIND_OPT += --suppressions=pythonswig.supp
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests
%.cpptest:
$(setup)
@ -122,28 +124,27 @@ py3_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX)
ifeq (,$(PY3))
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
$(run_python);)\
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(run_python);\
fi
else
run_testcase = \
if [ -f $(py2_runme) ]; then ( \
$(MAKE) -f $(srcdir)/Makefile $(py3_runme) && \
$(run_python);) \
elif [ -f $(py3_runme) ]; then ( \
$(run_python);) \
fi;
if [ -f $(py2_runme) ]; then \
$(MAKE) -f $(srcdir)/Makefile $(py3_runme) && $(run_python); \
elif [ -f $(py3_runme) ]; then \
$(run_python); \
fi
endif
# Clean: remove the generated .py file
%.clean:
@rm -f hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
@rm -f $*.py;
@#We only remove the _runme3.py if it is generated by 2to3 from a _runme.py.
@if [ -f $(py2_runme) ]; then (rm -f $(py3_runme) $(py3_runme).bak;) fi;
@if [ -f $(py2_runme) ]; then rm -f $(py3_runme) $(py3_runme).bak; fi
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile python_clean
rm -f hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
cvsignore:
@echo '*wrap* *.pyc *.so *.dll *.exp *.lib'
@ -166,3 +167,4 @@ hugemod:
$(MAKE) hugemod_b.cpptest
sh -c "time $(PYTHON) $(hugemod_runme)"
sh -c "time $(PYTHON) $(hugemod_runme)"

View file

@ -43,7 +43,7 @@ b = launder(a)
try:
b.pong()
except TypeError, e:
if str(e) == "Swig director type mismatch in output value of type 'std::string'":
if str(e) == "SWIG director type mismatch in output value of type 'std::string'":
ok = 1
else:
print "Unexpected error message: %s" % str(e)

View file

@ -5,3 +5,15 @@ _enums.bar2(1)
_enums.bar3(1)
_enums.bar1(1)
if _enums.cvar.enumInstance != 2:
raise RuntimeError
if _enums.cvar.Slap != 10:
raise RuntimeError
if _enums.cvar.My != 11:
raise RuntimeError
if _enums.cvar.Thigh != 12:
raise RuntimeError

View file

@ -0,0 +1,4 @@
import extern_c
extern_c.RealFunction(2)

View file

@ -0,0 +1,10 @@
from li_cdata import *
s = "ABC abc"
m = malloc(256)
memmove(m, s)
ss = cdata(m, 7)
if ss != "ABC abc":
raise "failed"

View file

@ -154,3 +154,23 @@ if extractInt(vi[0]) != 11:
if extractInt(vi[1]) != 22:
raise RuntimeError
# vector const pointer checks
csp = makeConstShortPtr(111)
error = 0
try:
vcs = ConstShortPtrVector((csp, dp)) # check vector<const unsigned short *> does not accept double * element
error = 1
except:
pass
if error:
raise RuntimeError
vcs = ConstShortPtrVector((csp, makeConstShortPtr(222)))
if extractConstShort(vcs[0]) != 111:
raise RuntimeError
if extractConstShort(vcs[1]) != 222:
raise RuntimeError

View file

@ -0,0 +1,6 @@
import memberin_extend_c
t = memberin_extend_c.Person()
t.name = "Fred Bloggs"
if t.name != "FRED BLOGGS":
raise RuntimeError("name wrong")

View file

@ -0,0 +1,13 @@
from nested_workaround import *
inner = Inner(5)
outer = Outer()
newInner = outer.doubleInnerValue(inner)
if newInner.getValue() != 10:
raise RuntimeError
outer = Outer()
inner = outer.createInner(3)
newInner = outer.doubleInnerValue(inner)
if outer.getInnerValue(newInner) != 6:
raise RuntimeError

View file

@ -1,8 +1,8 @@
from overload_template_fast import *
f = foo()
a = max(3,4)
b = max(3.4,5.2)
a = maximum(3,4)
b = maximum(3.4,5.2)
# mix 1
if (mix1("hi") != 101):

View file

@ -1,8 +1,8 @@
from overload_template import *
f = foo()
a = max(3,4)
b = max(3.4,5.2)
a = maximum(3,4)
b = maximum(3.4,5.2)
# mix 1
if (mix1("hi") != 101):

View file

@ -0,0 +1,16 @@
import special_variable_macros
name = special_variable_macros.Name()
if special_variable_macros.testFred(name) != "none":
raise "test failed"
if special_variable_macros.testJack(name) != "$specialname":
raise "test failed"
if special_variable_macros.testJill(name) != "jilly":
raise "test failed"
if special_variable_macros.testMary(name) != "SWIGTYPE_p_NameWrap":
raise "test failed"
if special_variable_macros.testJim(name) != "multiname num":
raise "test failed"
if special_variable_macros.testJohn(special_variable_macros.PairIntBool(10, False)) != 123:
raise "test failed"

View file

@ -0,0 +1,20 @@
from struct_initialization import *
if cvar.instanceC1.x != 10:
raise RuntimeError
if cvar.instanceD1.x != 10:
raise RuntimeError
if cvar.instanceD2.x != 20:
raise RuntimeError
if cvar.instanceD3.x != 30:
raise RuntimeError
if cvar.instanceE1.x != 1:
raise RuntimeError
if cvar.instanceF1.x != 1:
raise RuntimeError

View file

@ -1,4 +1,3 @@
import string
from template_typedef_cplx2 import *
from template_typedef_import import *

View file

@ -2,6 +2,6 @@ import wrapmacro
a = 2
b = -1
wrapmacro.max(a,b)
wrapmacro.max(a/7.0, -b*256)
wrapmacro.maximum(a,b)
wrapmacro.maximum(a/7.0, -b*256)
wrapmacro.GUINT16_SWAP_LE_BE_CONSTANT(1)