summaryrefslogtreecommitdiff
path: root/trunk/Examples/test-suite/python
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2010-06-02 20:53:17 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2010-06-02 20:53:17 +0000
commit2824b0cbb66e715490e1ef13250bd675d87b32d9 (patch)
treec3bc8d54c6d73f2b7ce08cac34172dbc9f5e5b95 /trunk/Examples/test-suite/python
parent289cfef4b4766ff266f3b1bdda8ca3a952e5a047 (diff)
downloadswig-2.0.0.tar.gz
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/tags/rel-2.0.0@12089 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'trunk/Examples/test-suite/python')
-rw-r--r--trunk/Examples/test-suite/python/Makefile.in170
-rw-r--r--trunk/Examples/test-suite/python/README8
-rw-r--r--trunk/Examples/test-suite/python/abstract_access_runme.py6
-rw-r--r--trunk/Examples/test-suite/python/abstract_typedef2_runme.py8
-rw-r--r--trunk/Examples/test-suite/python/abstract_typedef_runme.py11
-rw-r--r--trunk/Examples/test-suite/python/abstract_virtual_runme.py6
-rw-r--r--trunk/Examples/test-suite/python/argcargvtest_runme.py27
-rw-r--r--trunk/Examples/test-suite/python/array_member_runme.py21
-rw-r--r--trunk/Examples/test-suite/python/arrays_global_runme.py20
-rw-r--r--trunk/Examples/test-suite/python/callback_runme.py31
-rw-r--r--trunk/Examples/test-suite/python/class_ignore_runme.py6
-rw-r--r--trunk/Examples/test-suite/python/class_scope_weird_runme.py6
-rw-r--r--trunk/Examples/test-suite/python/compactdefaultargs_runme.py20
-rw-r--r--trunk/Examples/test-suite/python/complextest_runme.py17
-rw-r--r--trunk/Examples/test-suite/python/constover_runme.py38
-rw-r--r--trunk/Examples/test-suite/python/constructor_copy_runme.py38
-rw-r--r--trunk/Examples/test-suite/python/constructor_rename_runme.py3
-rw-r--r--trunk/Examples/test-suite/python/contract_runme.py143
-rw-r--r--trunk/Examples/test-suite/python/cpp_enum_runme.py23
-rw-r--r--trunk/Examples/test-suite/python/cpp_namespace_runme.py45
-rw-r--r--trunk/Examples/test-suite/python/cpp_static_runme.py7
-rw-r--r--trunk/Examples/test-suite/python/default_args_runme.py64
-rw-r--r--trunk/Examples/test-suite/python/default_constructor_runme.py111
-rw-r--r--trunk/Examples/test-suite/python/director_abstract_runme.py68
-rw-r--r--trunk/Examples/test-suite/python/director_basic_runme.py98
-rw-r--r--trunk/Examples/test-suite/python/director_classic_runme.py142
-rw-r--r--trunk/Examples/test-suite/python/director_default_runme.py9
-rw-r--r--trunk/Examples/test-suite/python/director_detect_runme.py36
-rw-r--r--trunk/Examples/test-suite/python/director_enum_runme.py12
-rw-r--r--trunk/Examples/test-suite/python/director_exception_runme.py77
-rw-r--r--trunk/Examples/test-suite/python/director_extend_runme.py20
-rw-r--r--trunk/Examples/test-suite/python/director_finalizer_runme.py48
-rw-r--r--trunk/Examples/test-suite/python/director_frob_runme.py7
-rw-r--r--trunk/Examples/test-suite/python/director_nested_runme.py63
-rw-r--r--trunk/Examples/test-suite/python/director_profile_runme.py41
-rw-r--r--trunk/Examples/test-suite/python/director_protected_runme.py88
-rw-r--r--trunk/Examples/test-suite/python/director_stl_runme.py39
-rw-r--r--trunk/Examples/test-suite/python/director_string_runme.py29
-rw-r--r--trunk/Examples/test-suite/python/director_thread_runme.py18
-rw-r--r--trunk/Examples/test-suite/python/director_unroll_runme.py19
-rw-r--r--trunk/Examples/test-suite/python/director_wstring_runme.py28
-rw-r--r--trunk/Examples/test-suite/python/disown_runme.py25
-rw-r--r--trunk/Examples/test-suite/python/dynamic_cast_runme.py12
-rw-r--r--trunk/Examples/test-suite/python/empty_runme.py1
-rw-r--r--trunk/Examples/test-suite/python/enum_template_runme.py7
-rw-r--r--trunk/Examples/test-suite/python/enums_runme.py19
-rw-r--r--trunk/Examples/test-suite/python/exception_order_runme.py41
-rw-r--r--trunk/Examples/test-suite/python/extend_placement_runme.py46
-rw-r--r--trunk/Examples/test-suite/python/extend_template_ns_runme.py7
-rw-r--r--trunk/Examples/test-suite/python/extend_template_runme.py8
-rw-r--r--trunk/Examples/test-suite/python/extend_variable_runme.py4
-rw-r--r--trunk/Examples/test-suite/python/extern_c_runme.py4
-rw-r--r--trunk/Examples/test-suite/python/file_test_runme.py10
-rw-r--r--trunk/Examples/test-suite/python/friends_runme.py28
-rw-r--r--trunk/Examples/test-suite/python/fvirtual_runme.py9
-rw-r--r--trunk/Examples/test-suite/python/global_ns_arg_runme.py5
-rw-r--r--trunk/Examples/test-suite/python/grouping_runme.py13
-rw-r--r--trunk/Examples/test-suite/python/hugemod.pl55
-rwxr-xr-xtrunk/Examples/test-suite/python/iadd_runme.py9
-rw-r--r--trunk/Examples/test-suite/python/import_nomodule_runme.py8
-rw-r--r--trunk/Examples/test-suite/python/imports_runme.py17
-rw-r--r--trunk/Examples/test-suite/python/inctest_runme.py32
-rw-r--r--trunk/Examples/test-suite/python/inherit_missing_runme.py19
-rw-r--r--trunk/Examples/test-suite/python/inout_runme.py22
-rw-r--r--trunk/Examples/test-suite/python/inplaceadd_runme.py20
-rw-r--r--trunk/Examples/test-suite/python/input_runme.py20
-rw-r--r--trunk/Examples/test-suite/python/keyword_rename_runme.py4
-rw-r--r--trunk/Examples/test-suite/python/langobj_runme.py13
-rw-r--r--trunk/Examples/test-suite/python/li_attribute_runme.py74
-rw-r--r--trunk/Examples/test-suite/python/li_boost_shared_ptr_bits_runme.py31
-rw-r--r--trunk/Examples/test-suite/python/li_boost_shared_ptr_runme.py544
-rw-r--r--trunk/Examples/test-suite/python/li_carrays_runme.py9
-rw-r--r--trunk/Examples/test-suite/python/li_cdata_runme.py10
-rw-r--r--trunk/Examples/test-suite/python/li_cmalloc_runme.py14
-rw-r--r--trunk/Examples/test-suite/python/li_cpointer_runme.py10
-rw-r--r--trunk/Examples/test-suite/python/li_cstring_runme.py32
-rw-r--r--trunk/Examples/test-suite/python/li_cwstring_runme.py29
-rw-r--r--trunk/Examples/test-suite/python/li_factory_runme.py11
-rw-r--r--trunk/Examples/test-suite/python/li_implicit_runme.py17
-rw-r--r--trunk/Examples/test-suite/python/li_std_carray_runme.py41
-rw-r--r--trunk/Examples/test-suite/python/li_std_map_runme.py58
-rw-r--r--trunk/Examples/test-suite/python/li_std_pair_extra_runme.py59
-rw-r--r--trunk/Examples/test-suite/python/li_std_set_runme.py96
-rw-r--r--trunk/Examples/test-suite/python/li_std_stream_runme.py14
-rw-r--r--trunk/Examples/test-suite/python/li_std_string_extra_runme.py132
-rw-r--r--trunk/Examples/test-suite/python/li_std_vector_extra_runme.py176
-rw-r--r--trunk/Examples/test-suite/python/li_std_vector_ptr_runme.py8
-rw-r--r--trunk/Examples/test-suite/python/li_std_wstream_runme.py13
-rw-r--r--trunk/Examples/test-suite/python/li_std_wstring_runme.py76
-rw-r--r--trunk/Examples/test-suite/python/member_pointer_runme.py43
-rw-r--r--trunk/Examples/test-suite/python/memberin_extend_c_runme.py6
-rw-r--r--trunk/Examples/test-suite/python/minherit_runme.py71
-rw-r--r--trunk/Examples/test-suite/python/mod_runme.py6
-rw-r--r--trunk/Examples/test-suite/python/multi_import_runme.py18
-rw-r--r--trunk/Examples/test-suite/python/namespace_class_runme.py34
-rw-r--r--trunk/Examples/test-suite/python/namespace_typemap_runme.py82
-rw-r--r--trunk/Examples/test-suite/python/namespace_virtual_method_runme.py3
-rw-r--r--trunk/Examples/test-suite/python/naturalvar_runme.py12
-rw-r--r--trunk/Examples/test-suite/python/nested_workaround_runme.py13
-rw-r--r--trunk/Examples/test-suite/python/operbool_runme.py4
-rwxr-xr-xtrunk/Examples/test-suite/python/overload_complicated_runme.py47
-rw-r--r--trunk/Examples/test-suite/python/overload_copy_runme.py3
-rw-r--r--trunk/Examples/test-suite/python/overload_extend_runme.py14
-rw-r--r--trunk/Examples/test-suite/python/overload_extendc_runme.py22
-rw-r--r--trunk/Examples/test-suite/python/overload_rename_runme.py8
-rw-r--r--trunk/Examples/test-suite/python/overload_simple_runme.py102
-rw-r--r--trunk/Examples/test-suite/python/overload_subtype_runme.py11
-rw-r--r--trunk/Examples/test-suite/python/overload_template_fast_runme.py145
-rw-r--r--trunk/Examples/test-suite/python/overload_template_runme.py145
-rw-r--r--trunk/Examples/test-suite/python/preproc_runme.py14
-rw-r--r--trunk/Examples/test-suite/python/primitive_ref_runme.py40
-rw-r--r--trunk/Examples/test-suite/python/primitive_types_runme.py353
-rw-r--r--trunk/Examples/test-suite/python/profiletest_runme.py32
-rw-r--r--trunk/Examples/test-suite/python/profiletestc_runme.py54
-rw-r--r--trunk/Examples/test-suite/python/python_abstractbase_runme3.py8
-rw-r--r--trunk/Examples/test-suite/python/python_append_runme.py4
-rw-r--r--trunk/Examples/test-suite/python/python_kwargs_runme.py67
-rw-r--r--trunk/Examples/test-suite/python/python_nondynamic_runme.py39
-rw-r--r--trunk/Examples/test-suite/python/python_overload_simple_cast_runme.py192
-rw-r--r--trunk/Examples/test-suite/python/python_pybuf_runme3.py42
-rw-r--r--trunk/Examples/test-suite/python/pythonswig.supp463
-rw-r--r--trunk/Examples/test-suite/python/refcount_runme.py32
-rw-r--r--trunk/Examples/test-suite/python/reference_global_vars_runme.py74
-rw-r--r--trunk/Examples/test-suite/python/rename_scope_runme.py12
-rw-r--r--trunk/Examples/test-suite/python/rename_strip_encoder_runme.py6
-rw-r--r--trunk/Examples/test-suite/python/ret_by_value_runme.py8
-rw-r--r--trunk/Examples/test-suite/python/return_const_value_runme.py12
-rw-r--r--trunk/Examples/test-suite/python/smart_pointer_extend_runme.py34
-rw-r--r--trunk/Examples/test-suite/python/smart_pointer_member_runme.py30
-rw-r--r--trunk/Examples/test-suite/python/smart_pointer_multi_runme.py15
-rw-r--r--trunk/Examples/test-suite/python/smart_pointer_multi_typedef_runme.py15
-rw-r--r--trunk/Examples/test-suite/python/smart_pointer_not_runme.py42
-rw-r--r--trunk/Examples/test-suite/python/smart_pointer_overload_runme.py21
-rw-r--r--trunk/Examples/test-suite/python/smart_pointer_rename_runme.py13
-rw-r--r--trunk/Examples/test-suite/python/smart_pointer_simple_runme.py13
-rw-r--r--trunk/Examples/test-suite/python/smart_pointer_templatevariables_runme.py17
-rw-r--r--trunk/Examples/test-suite/python/smart_pointer_typedef_runme.py13
-rw-r--r--trunk/Examples/test-suite/python/sneaky1_runme.py5
-rw-r--r--trunk/Examples/test-suite/python/special_variable_macros_runme.py16
-rw-r--r--trunk/Examples/test-suite/python/static_const_member_2_runme.py16
-rw-r--r--trunk/Examples/test-suite/python/std_containers_runme.py119
-rw-r--r--trunk/Examples/test-suite/python/struct_initialization_runme.py20
-rw-r--r--trunk/Examples/test-suite/python/struct_rename_runme.py3
-rw-r--r--trunk/Examples/test-suite/python/struct_value_runme.py9
-rw-r--r--trunk/Examples/test-suite/python/swigobject_runme.py34
-rw-r--r--trunk/Examples/test-suite/python/template_construct_runme.py1
-rw-r--r--trunk/Examples/test-suite/python/template_default_arg_runme.py98
-rw-r--r--trunk/Examples/test-suite/python/template_extend1_runme.py10
-rw-r--r--trunk/Examples/test-suite/python/template_extend2_runme.py10
-rw-r--r--trunk/Examples/test-suite/python/template_inherit_runme.py53
-rw-r--r--trunk/Examples/test-suite/python/template_matrix_runme.py6
-rw-r--r--trunk/Examples/test-suite/python/template_ns4_runme.py5
-rw-r--r--trunk/Examples/test-suite/python/template_ns_runme.py17
-rw-r--r--trunk/Examples/test-suite/python/template_opaque_runme.py6
-rw-r--r--trunk/Examples/test-suite/python/template_ref_type_runme.py5
-rw-r--r--trunk/Examples/test-suite/python/template_rename_runme.py12
-rw-r--r--trunk/Examples/test-suite/python/template_static_runme.py3
-rw-r--r--trunk/Examples/test-suite/python/template_tbase_template_runme.py5
-rw-r--r--trunk/Examples/test-suite/python/template_type_namespace_runme.py5
-rw-r--r--trunk/Examples/test-suite/python/template_typedef_cplx2_runme.py94
-rw-r--r--trunk/Examples/test-suite/python/template_typedef_cplx3_runme.py34
-rw-r--r--trunk/Examples/test-suite/python/template_typedef_cplx4_runme.py34
-rw-r--r--trunk/Examples/test-suite/python/template_typedef_cplx_runme.py87
-rw-r--r--trunk/Examples/test-suite/python/template_typedef_import_runme.py34
-rw-r--r--trunk/Examples/test-suite/python/template_typedef_runme.py46
-rwxr-xr-xtrunk/Examples/test-suite/python/threads_exception_runme.py36
-rw-r--r--trunk/Examples/test-suite/python/typedef_class_runme.py7
-rw-r--r--trunk/Examples/test-suite/python/typedef_inherit_runme.py23
-rw-r--r--trunk/Examples/test-suite/python/typedef_scope_runme.py12
-rw-r--r--trunk/Examples/test-suite/python/typemap_delete_runme.py5
-rw-r--r--trunk/Examples/test-suite/python/typemap_namespace_runme.py8
-rw-r--r--trunk/Examples/test-suite/python/typemap_ns_using_runme.py4
-rw-r--r--trunk/Examples/test-suite/python/typemap_out_optimal_runme.py5
-rw-r--r--trunk/Examples/test-suite/python/typemap_qualifier_strip_runme.py54
-rw-r--r--trunk/Examples/test-suite/python/typename_runme.py12
-rw-r--r--trunk/Examples/test-suite/python/types_directive_runme.py12
-rw-r--r--trunk/Examples/test-suite/python/unions_runme.py51
-rw-r--r--trunk/Examples/test-suite/python/using1_runme.py4
-rw-r--r--trunk/Examples/test-suite/python/using2_runme.py4
-rw-r--r--trunk/Examples/test-suite/python/using_composition_runme.py34
-rw-r--r--trunk/Examples/test-suite/python/using_extend_runme.py21
-rw-r--r--trunk/Examples/test-suite/python/using_inherit_runme.py49
-rw-r--r--trunk/Examples/test-suite/python/using_private_runme.py13
-rw-r--r--trunk/Examples/test-suite/python/using_protected_runme.py7
-rw-r--r--trunk/Examples/test-suite/python/varargs_runme.py18
-rw-r--r--trunk/Examples/test-suite/python/virtual_derivation_runme.py8
-rw-r--r--trunk/Examples/test-suite/python/virtual_poly_runme.py38
-rw-r--r--trunk/Examples/test-suite/python/voidtest_runme.py29
-rw-r--r--trunk/Examples/test-suite/python/wrapmacro_runme.py7
189 files changed, 7285 insertions, 0 deletions
diff --git a/trunk/Examples/test-suite/python/Makefile.in b/trunk/Examples/test-suite/python/Makefile.in
new file mode 100644
index 000000000..4938ddc27
--- /dev/null
+++ b/trunk/Examples/test-suite/python/Makefile.in
@@ -0,0 +1,170 @@
+#######################################################################
+# Makefile for python test-suite
+#######################################################################
+
+ifeq (,$(PY3))
+ PYBIN = @PYTHON@
+else
+ PYBIN = @PYTHON3@
+endif
+
+LANGUAGE = python
+PYTHON = $(PYBIN)
+
+#*_runme.py for Python 2.x, *_runme3.py for Python 3.x
+PY2SCRIPTSUFFIX = _runme.py
+PY3SCRIPTSUFFIX = _runme3.py
+
+ifeq (,$(PY3))
+ SCRIPTSUFFIX = $(PY2SCRIPTSUFFIX)
+else
+ SCRIPTSUFFIX = $(PY3SCRIPTSUFFIX)
+endif
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
+
+
+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 \
+ li_cstring \
+ li_cwstring \
+ li_factory \
+ li_implicit \
+ li_std_vectora \
+ li_std_vector_extra \
+ li_std_multimap \
+ li_std_pair_extra \
+ li_std_set \
+ li_std_stream \
+ li_std_string_extra \
+ li_std_wstream \
+ li_std_wstring \
+ primitive_types \
+ python_abstractbase \
+ python_kwargs \
+ python_nondynamic \
+ python_overload_simple_cast \
+ std_containers \
+ swigobject \
+ template_matrix \
+ simutry
+
+# li_std_carray
+# director_profile
+# python_pybuf
+
+C_TEST_CASES += \
+ file_test \
+ li_cstring \
+ li_cwstring \
+ python_nondynamic
+
+#
+# This test only works with modern C compilers
+#
+#C_TEST_CASES += \
+# complextest
+
+include $(srcdir)/../common.mk
+
+# Overridden variables here
+LIBS = -L.
+VALGRIND_OPT += --suppressions=pythonswig.supp
+
+# Custom tests - tests with additional commandline options
+# none!
+
+# Rules for the different types of tests
+%.cpptest:
+ $(setup)
+ +$(swig_and_compile_cpp)
+ $(run_testcase)
+
+%.ctest:
+ $(setup)
+ +$(swig_and_compile_c)
+ $(run_testcase)
+
+%.multicpptest:
+ $(setup)
+ +$(swig_and_compile_multi_cpp)
+ $(run_testcase)
+
+
+# Call 2to3 to generate Python 3.x test from the Python 2.x's *_runme.py file
+%$(PY3SCRIPTSUFFIX): %$(PY2SCRIPTSUFFIX)
+ cp $< $@
+ $(PY2TO3) -w $@ >/dev/null 2>&1
+
+
+# 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)
+
+py2_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX)
+py3_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX)
+
+ifeq (,$(PY3))
+run_testcase = \
+ 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
+endif
+
+# Clean: remove the generated .py file
+%.clean:
+ @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
+
+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'
+ @echo Makefile
+ @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.py; done
+ @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.py CVS/Entries ; then echo $${i}_runme.py; fi; done
+ @echo clientdata_prop_a.py
+ @echo clientdata_prop_b.py
+ @echo imports_a.py
+ @echo imports_b.py
+ @echo mod_a.py mod_b.py
+ @echo hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
+ @echo template_typedef_import.py
+
+hugemod_runme = hugemod$(SCRIPTPREFIX)
+
+hugemod:
+ perl hugemod.pl $(hugemod_runme)
+ $(MAKE) hugemod_a.cpptest
+ $(MAKE) hugemod_b.cpptest
+ sh -c "time $(PYTHON) $(hugemod_runme)"
+ sh -c "time $(PYTHON) $(hugemod_runme)"
+
diff --git a/trunk/Examples/test-suite/python/README b/trunk/Examples/test-suite/python/README
new file mode 100644
index 000000000..71db759b5
--- /dev/null
+++ b/trunk/Examples/test-suite/python/README
@@ -0,0 +1,8 @@
+See ../README for common README file.
+
+Any testcases which have _runme.py (or _runme3.py for Python 3) appended after the testcase name will be detected and run.
+
+If you intend to write a testcase for both Python 2.x and 3.x, do *not* directly put the _runme3.py in this directory. Just write Python 2.x's _runme.py testcase and it will be automatically converted to Python 3 code during test.
+
+You can run make with PY3=y to run test case with Python 3.x, eg.
+ $ make voidtest.cpptest PY3=y
diff --git a/trunk/Examples/test-suite/python/abstract_access_runme.py b/trunk/Examples/test-suite/python/abstract_access_runme.py
new file mode 100644
index 000000000..55638e40e
--- /dev/null
+++ b/trunk/Examples/test-suite/python/abstract_access_runme.py
@@ -0,0 +1,6 @@
+import abstract_access
+
+d = abstract_access.D()
+if d.do_x() != 1:
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/abstract_typedef2_runme.py b/trunk/Examples/test-suite/python/abstract_typedef2_runme.py
new file mode 100644
index 000000000..2a11d1944
--- /dev/null
+++ b/trunk/Examples/test-suite/python/abstract_typedef2_runme.py
@@ -0,0 +1,8 @@
+from abstract_typedef2 import *
+
+a = A_UF()
+
+
+
+
+
diff --git a/trunk/Examples/test-suite/python/abstract_typedef_runme.py b/trunk/Examples/test-suite/python/abstract_typedef_runme.py
new file mode 100644
index 000000000..15d70aa42
--- /dev/null
+++ b/trunk/Examples/test-suite/python/abstract_typedef_runme.py
@@ -0,0 +1,11 @@
+from abstract_typedef import *
+e = Engine()
+
+a = A()
+
+
+if a.write(e) != 1:
+ raise RuntimeError
+
+
+
diff --git a/trunk/Examples/test-suite/python/abstract_virtual_runme.py b/trunk/Examples/test-suite/python/abstract_virtual_runme.py
new file mode 100644
index 000000000..9cd0b7c44
--- /dev/null
+++ b/trunk/Examples/test-suite/python/abstract_virtual_runme.py
@@ -0,0 +1,6 @@
+from abstract_virtual import *
+
+
+d = D()
+
+e = E()
diff --git a/trunk/Examples/test-suite/python/argcargvtest_runme.py b/trunk/Examples/test-suite/python/argcargvtest_runme.py
new file mode 100644
index 000000000..584a19f6e
--- /dev/null
+++ b/trunk/Examples/test-suite/python/argcargvtest_runme.py
@@ -0,0 +1,27 @@
+from argcargvtest import *
+
+largs=['hi','hola','hello']
+if mainc(largs) != 3:
+ raise RuntimeError, "bad main typemap"
+
+targs=('hi','hola')
+if mainv(targs,1) != 'hola':
+ print mainv(targs,1)
+ raise RuntimeError, "bad main typemap"
+
+targs=('hi', 'hola')
+if mainv(targs,1) != 'hola':
+ raise RuntimeError, "bad main typemap"
+
+try:
+ error = 0
+ mainv('hello',1)
+ error = 1
+except TypeError:
+ pass
+if error:
+ raise RuntimeError, "bad main typemap"
+
+
+
+initializeApp(largs)
diff --git a/trunk/Examples/test-suite/python/array_member_runme.py b/trunk/Examples/test-suite/python/array_member_runme.py
new file mode 100644
index 000000000..95cf03b44
--- /dev/null
+++ b/trunk/Examples/test-suite/python/array_member_runme.py
@@ -0,0 +1,21 @@
+from array_member import *
+
+f = Foo()
+f.data = cvar.global_data
+
+for i in range(0,8):
+ if get_value(f.data,i) != get_value(cvar.global_data,i):
+ raise RuntimeError, "Bad array assignment"
+
+
+for i in range(0,8):
+ set_value(f.data,i,-i)
+
+cvar.global_data = f.data
+
+for i in range(0,8):
+ if get_value(f.data,i) != get_value(cvar.global_data,i):
+ raise RuntimeError, "Bad array assignment"
+
+
+
diff --git a/trunk/Examples/test-suite/python/arrays_global_runme.py b/trunk/Examples/test-suite/python/arrays_global_runme.py
new file mode 100644
index 000000000..ab7fd6a41
--- /dev/null
+++ b/trunk/Examples/test-suite/python/arrays_global_runme.py
@@ -0,0 +1,20 @@
+import arrays_global
+
+arrays_global.cvar.array_i = arrays_global.cvar.array_const_i
+
+from arrays_global import *
+
+BeginString_FIX44a
+cvar.BeginString_FIX44b
+BeginString_FIX44c
+cvar.BeginString_FIX44d
+cvar.BeginString_FIX44d
+cvar.BeginString_FIX44b ="12"'\0'"45"
+cvar.BeginString_FIX44b
+cvar.BeginString_FIX44d
+cvar.BeginString_FIX44e
+BeginString_FIX44f
+
+test_a("hello","hi","chello","chi")
+
+test_b("1234567","hi")
diff --git a/trunk/Examples/test-suite/python/callback_runme.py b/trunk/Examples/test-suite/python/callback_runme.py
new file mode 100644
index 000000000..b2bbb2d0f
--- /dev/null
+++ b/trunk/Examples/test-suite/python/callback_runme.py
@@ -0,0 +1,31 @@
+import _callback
+from callback import *
+
+if foo(2) != 2:
+ raise RuntimeError
+
+if A_bar(2) != 4:
+ raise RuntimeError
+
+if foobar(3, _callback.foo) != foo(3):
+ raise RuntimeError
+
+if foobar(3, foo) != foo(3):
+ raise RuntimeError
+
+if foobar(3, A_bar) != A_bar(3):
+ raise RuntimeError
+
+if foobar(3, foof) != foof(3):
+ raise RuntimeError
+
+if foobar_i(3, foo_i) != foo_i(3):
+ raise RuntimeError
+
+
+if foobar_d(3.5, foo_d) != foo_d(3.5):
+ raise RuntimeError
+
+a = A()
+if foobarm(3, a, A.foom_cb_ptr) != a.foom(3):
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/class_ignore_runme.py b/trunk/Examples/test-suite/python/class_ignore_runme.py
new file mode 100644
index 000000000..782fc07e1
--- /dev/null
+++ b/trunk/Examples/test-suite/python/class_ignore_runme.py
@@ -0,0 +1,6 @@
+import class_ignore
+
+a = class_ignore.Bar()
+
+if class_ignore.do_blah(a) != "Bar::blah":
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/class_scope_weird_runme.py b/trunk/Examples/test-suite/python/class_scope_weird_runme.py
new file mode 100644
index 000000000..5c91d441f
--- /dev/null
+++ b/trunk/Examples/test-suite/python/class_scope_weird_runme.py
@@ -0,0 +1,6 @@
+import class_scope_weird
+
+f = class_scope_weird.Foo()
+g = class_scope_weird.Foo(3)
+if f.bar(3) != 3:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/compactdefaultargs_runme.py b/trunk/Examples/test-suite/python/compactdefaultargs_runme.py
new file mode 100644
index 000000000..ff865714c
--- /dev/null
+++ b/trunk/Examples/test-suite/python/compactdefaultargs_runme.py
@@ -0,0 +1,20 @@
+from compactdefaultargs import *
+
+defaults1 = Defaults1(1000)
+defaults1 = Defaults1()
+
+if defaults1.ret(10.0) != 10.0:
+ raise RuntimeError
+
+if defaults1.ret() != -1.0:
+ raise RuntimeError
+
+defaults2 = Defaults2(1000)
+defaults2 = Defaults2()
+
+if defaults2.ret(10.0) != 10.0:
+ raise RuntimeError
+
+if defaults2.ret() != -1.0:
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/complextest_runme.py b/trunk/Examples/test-suite/python/complextest_runme.py
new file mode 100644
index 000000000..cc2463a39
--- /dev/null
+++ b/trunk/Examples/test-suite/python/complextest_runme.py
@@ -0,0 +1,17 @@
+import complextest
+
+a = complex(-1,2)
+
+if complextest.Conj(a) != a.conjugate():
+ raise RuntimeError, "bad complex mapping"
+
+if complextest.Conjf(a) != a.conjugate():
+ raise RuntimeError, "bad complex mapping"
+
+
+v = (complex(1,2), complex(2,3), complex(4,3), 1)
+
+try:
+ complextest.Copy_h(v)
+except:
+ pass
diff --git a/trunk/Examples/test-suite/python/constover_runme.py b/trunk/Examples/test-suite/python/constover_runme.py
new file mode 100644
index 000000000..5c5419706
--- /dev/null
+++ b/trunk/Examples/test-suite/python/constover_runme.py
@@ -0,0 +1,38 @@
+import constover
+import sys
+error = 0
+
+p = constover.test("test")
+if p != "test":
+ print "test failed!"
+ error = 1
+
+p = constover.test_pconst("test")
+if p != "test_pconst":
+ print "test_pconst failed!"
+ error = 1
+
+f = constover.Foo()
+p = f.test("test")
+if p != "test":
+ print "member-test failed!"
+ error = 1
+
+p = f.test_pconst("test")
+if p != "test_pconst":
+ print "member-test_pconst failed!"
+ error = 1
+
+p = f.test_constm("test")
+if p != "test_constmethod":
+ print "member-test_constm failed!"
+ error = 1
+
+p = f.test_pconstm("test")
+if p != "test_pconstmethod":
+ print "member-test_pconstm failed!"
+ error = 1
+
+sys.exit(error)
+
+
diff --git a/trunk/Examples/test-suite/python/constructor_copy_runme.py b/trunk/Examples/test-suite/python/constructor_copy_runme.py
new file mode 100644
index 000000000..431d3232f
--- /dev/null
+++ b/trunk/Examples/test-suite/python/constructor_copy_runme.py
@@ -0,0 +1,38 @@
+from constructor_copy import *
+
+f1 = Foo1(3);
+f11 = Foo1(f1);
+
+
+if f1.x != f11.x:
+ raise RuntimeError
+
+
+f8 = Foo8()
+try:
+ f81 = Foo8(f8)
+ good = 0
+except:
+ good = 1
+
+if not good:
+ raise RuntimeError
+
+
+bi = Bari(5)
+bc = Bari(bi)
+
+if (bi.x != bc.x):
+ raise RuntimeError
+
+
+bd = Bard(5)
+try:
+ bc = Bard(bd)
+ good = 0
+except:
+ good = 1
+
+if not good:
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/constructor_rename_runme.py b/trunk/Examples/test-suite/python/constructor_rename_runme.py
new file mode 100644
index 000000000..cf3f88b81
--- /dev/null
+++ b/trunk/Examples/test-suite/python/constructor_rename_runme.py
@@ -0,0 +1,3 @@
+from constructor_rename import *
+
+x = RenamedConstructor()
diff --git a/trunk/Examples/test-suite/python/contract_runme.py b/trunk/Examples/test-suite/python/contract_runme.py
new file mode 100644
index 000000000..905bf1196
--- /dev/null
+++ b/trunk/Examples/test-suite/python/contract_runme.py
@@ -0,0 +1,143 @@
+import contract
+
+contract.test_preassert(1,2)
+try:
+ contract.test_preassert(-1)
+ print "Failed! Preassertions are broken"
+except:
+ pass
+
+contract.test_postassert(3)
+try:
+ contract.test_postassert(-3)
+ print "Failed! Postassertions are broken"
+except:
+ pass
+
+contract.test_prepost(2,3)
+contract.test_prepost(5,-4)
+try:
+ contract.test_prepost(-3,4)
+ print "Failed! Preassertions are broken"
+except:
+ pass
+
+try:
+ contract.test_prepost(4,-10)
+ print "Failed! Postassertions are broken"
+
+except:
+ pass
+
+f = contract.Foo()
+f.test_preassert(4,5)
+try:
+ f.test_preassert(-2,3)
+ print "Failed! Method preassertion."
+except:
+ pass
+
+f.test_postassert(4)
+try:
+ f.test_postassert(-4)
+ print "Failed! Method postassertion"
+except:
+ pass
+
+f.test_prepost(3,4)
+f.test_prepost(4,-3)
+try:
+ f.test_prepost(-4,2)
+ print "Failed! Method preassertion."
+except:
+ pass
+
+try:
+ f.test_prepost(4,-10)
+ print "Failed! Method postassertion."
+except:
+ pass
+
+contract.Foo_stest_prepost(4,0)
+try:
+ contract.Foo_stest_prepost(-4,2)
+ print "Failed! Static method preassertion"
+except:
+ pass
+
+try:
+ contract.Foo_stest_prepost(4,-10)
+ print "Failed! Static method posteassertion"
+except:
+ pass
+
+b = contract.Bar()
+try:
+ b.test_prepost(2,-4)
+ print "Failed! Inherited preassertion."
+except:
+ pass
+
+
+d = contract.D()
+try:
+ d.foo(-1,1,1,1,1)
+ print "Failed! Inherited preassertion (D)."
+except:
+ pass
+try:
+ d.foo(1,-1,1,1,1)
+ print "Failed! Inherited preassertion (D)."
+except:
+ pass
+try:
+ d.foo(1,1,-1,1,1)
+ print "Failed! Inherited preassertion (D)."
+except:
+ pass
+try:
+ d.foo(1,1,1,-1,1)
+ print "Failed! Inherited preassertion (D)."
+except:
+ pass
+try:
+ d.foo(1,1,1,1,-1)
+ print "Failed! Inherited preassertion (D)."
+except:
+ pass
+
+
+try:
+ d.bar(-1,1,1,1,1)
+ print "Failed! Inherited preassertion (D)."
+except:
+ pass
+try:
+ d.bar(1,-1,1,1,1)
+ print "Failed! Inherited preassertion (D)."
+except:
+ pass
+try:
+ d.bar(1,1,-1,1,1)
+ print "Failed! Inherited preassertion (D)."
+except:
+ pass
+try:
+ d.bar(1,1,1,-1,1)
+ print "Failed! Inherited preassertion (D)."
+except:
+ pass
+try:
+ d.bar(1,1,1,1,-1)
+ print "Failed! Inherited preassertion (D)."
+except:
+ pass
+
+#Namespace
+my = contract.myClass(1)
+try:
+ my = contract.myClass(0)
+ print "Failed! constructor preassertion"
+except:
+ pass
+
diff --git a/trunk/Examples/test-suite/python/cpp_enum_runme.py b/trunk/Examples/test-suite/python/cpp_enum_runme.py
new file mode 100644
index 000000000..0054ae281
--- /dev/null
+++ b/trunk/Examples/test-suite/python/cpp_enum_runme.py
@@ -0,0 +1,23 @@
+import cpp_enum
+
+f = cpp_enum.Foo()
+
+if f.hola != f.Hello:
+ print f.hola
+ raise RuntimeError
+
+f.hola = f.Hi
+if f.hola != f.Hi:
+ print f.hola
+ raise RuntimeError
+
+f.hola = f.Hello
+
+if f.hola != f.Hello:
+ print f.hola
+ raise RuntimeError
+
+cpp_enum.cvar.hi = cpp_enum.Hello
+if cpp_enum.cvar.hi != cpp_enum.Hello:
+ print cpp_enum.cvar.hi
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/cpp_namespace_runme.py b/trunk/Examples/test-suite/python/cpp_namespace_runme.py
new file mode 100644
index 000000000..a454774f5
--- /dev/null
+++ b/trunk/Examples/test-suite/python/cpp_namespace_runme.py
@@ -0,0 +1,45 @@
+# Note: This example assumes that namespaces are flattened
+import cpp_namespace
+
+n = cpp_namespace.fact(4)
+if n != 24:
+ raise RuntimeError("Bad return value!")
+
+if cpp_namespace.cvar.Foo != 42:
+ raise RuntimeError("Bad variable value!")
+
+t = cpp_namespace.Test()
+if t.method() != "Test::method":
+ raise RuntimeError("Bad method return value!")
+
+if cpp_namespace.do_method(t) != "Test::method":
+ raise RuntimeError("Bad return value!")
+
+if cpp_namespace.do_method2(t) != "Test::method":
+ raise RuntimeError("Bad return value!")
+
+cpp_namespace.weird("hello", 4)
+
+del t
+
+t2 = cpp_namespace.Test2()
+t3 = cpp_namespace.Test3()
+t4 = cpp_namespace.Test4()
+t5 = cpp_namespace.Test5()
+
+if cpp_namespace.foo3(42) != 42:
+ raise RuntimeError("Bad return value!")
+
+if cpp_namespace.do_method3(t2,40) != "Test2::method":
+ raise RuntimeError("Bad return value!")
+
+if cpp_namespace.do_method3(t3,40) != "Test3::method":
+ raise RuntimeError("Bad return value!")
+
+if cpp_namespace.do_method3(t4,40) != "Test4::method":
+ raise RuntimeError("Bad return value!")
+
+if cpp_namespace.do_method3(t5,40) != "Test5::method":
+ raise RuntimeError("Bad return value!")
+
+
diff --git a/trunk/Examples/test-suite/python/cpp_static_runme.py b/trunk/Examples/test-suite/python/cpp_static_runme.py
new file mode 100644
index 000000000..ef8623359
--- /dev/null
+++ b/trunk/Examples/test-suite/python/cpp_static_runme.py
@@ -0,0 +1,7 @@
+#!/usr/bin/evn python
+from cpp_static import *
+StaticFunctionTest.static_func()
+StaticFunctionTest.static_func_2(1)
+StaticFunctionTest.static_func_3(1,2)
+StaticMemberTest.static_int = 10
+assert StaticMemberTest.static_int == 10
diff --git a/trunk/Examples/test-suite/python/default_args_runme.py b/trunk/Examples/test-suite/python/default_args_runme.py
new file mode 100644
index 000000000..091a92376
--- /dev/null
+++ b/trunk/Examples/test-suite/python/default_args_runme.py
@@ -0,0 +1,64 @@
+import default_args
+
+
+if default_args.Statics_staticMethod() != 60:
+ raise RuntimeError
+
+if default_args.cfunc1(1) != 2:
+ raise RuntimeError
+
+if default_args.cfunc2(1) != 3:
+ raise RuntimeError
+
+if default_args.cfunc3(1) != 4:
+ raise RuntimeError
+
+
+f = default_args.Foo()
+
+f.newname()
+f.newname(1)
+
+
+try:
+ f = default_args.Foo(1)
+ error = 1
+except:
+ error = 0
+if error: raise RuntimeError,"Foo::Foo ignore is not working"
+
+try:
+ f = default_args.Foo(1,2)
+ error = 1
+except:
+ error = 0
+if error: raise RuntimeError,"Foo::Foo ignore is not working"
+
+try:
+ f = default_args.Foo(1,2,3)
+ error = 1
+except:
+ error = 0
+if error: raise RuntimeError,"Foo::Foo ignore is not working"
+
+try:
+ m = f.meth(1)
+ error = 1
+except:
+ error = 0
+if error: raise RuntimeError,"Foo::meth ignore is not working"
+
+try:
+ m = f.meth(1,2)
+ error = 1
+except:
+ error = 0
+if error: raise RuntimeError,"Foo::meth ignore is not working"
+
+try:
+ m = f.meth(1,2,3)
+ error = 1
+except:
+ error = 0
+if error: raise RuntimeError,"Foo::meth ignore is not working"
+
diff --git a/trunk/Examples/test-suite/python/default_constructor_runme.py b/trunk/Examples/test-suite/python/default_constructor_runme.py
new file mode 100644
index 000000000..334eaa8af
--- /dev/null
+++ b/trunk/Examples/test-suite/python/default_constructor_runme.py
@@ -0,0 +1,111 @@
+import _default_constructor
+
+dc = _default_constructor
+
+a = dc.new_A()
+dc.delete_A(a)
+
+aa = dc.new_AA()
+dc.delete_AA(aa)
+
+try:
+ b = dc.new_B()
+ print "Whoa. new_BB created."
+except:
+ pass
+
+del_b = dc.delete_B
+
+try:
+ bb = dc.new_BB();
+ print "Whoa. new_BB created."
+except:
+ pass
+
+del_bb = dc.delete_BB
+
+try:
+ c = dc.new_C()
+ print "Whoa. new_C created."
+except:
+ pass
+
+del_c = dc.delete_C
+
+cc = dc.new_CC()
+dc.delete_CC(cc)
+
+try:
+ d = dc.new_D();
+ print "Whoa. new_D created"
+except:
+ pass
+
+del_d = dc.delete_D
+
+try:
+ dd = dc.new_DD()
+ print "Whoa. new_DD created"
+except:
+ pass
+
+dd = dc.delete_DD
+
+try:
+ ad = dc.new_AD()
+ print "Whoa. new_AD created"
+except:
+ pass
+
+del_ad = dc.delete_AD
+
+e = dc.new_E()
+dc.delete_E(e)
+
+ee = dc.new_EE()
+dc.delete_EE(ee)
+
+try:
+ eb = dc.new_EB()
+ print "Whoa. new_EB created"
+except:
+ pass
+
+del_eb = dc.delete_EB
+
+f = dc.new_F()
+
+try:
+ del_f = dc.delete_F
+ print "Whoa. delete_F created"
+except AttributeError:
+ pass
+
+dc.F_destroy(f)
+
+ff = dc.new_FFF()
+try:
+ del_ff = dc.delete_FFF
+ print "Whoa. delete_FFF created"
+except AttributeError:
+ pass
+
+dc.F_destroy(ff)
+
+g = dc.new_G()
+
+try:
+ del_g = dc.delete_G
+ print "Whoa. delete_G created"
+except AttributeError:
+ pass
+
+dc.G_destroy(g)
+
+gg = dc.new_GG()
+dc.delete_GG(gg)
+
+
+import default_constructor
+hh = default_constructor.HH(1,1)
+
diff --git a/trunk/Examples/test-suite/python/director_abstract_runme.py b/trunk/Examples/test-suite/python/director_abstract_runme.py
new file mode 100644
index 000000000..7d92d10ff
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_abstract_runme.py
@@ -0,0 +1,68 @@
+import director_abstract
+
+class MyFoo(director_abstract.Foo):
+ def __init__(self):
+ director_abstract.Foo.__init__(self)
+ def ping(self):
+ return "MyFoo::ping()"
+
+
+a = MyFoo()
+
+if a.ping() != "MyFoo::ping()":
+ raise RuntimeError, a.ping()
+
+if a.pong() != "Foo::pong();MyFoo::ping()":
+ raise RuntimeError, a.pong()
+
+
+class MyExample1(director_abstract.Example1):
+ def Color(self, r, g, b):
+ return r
+
+class MyExample2(director_abstract.Example2):
+ def Color(self, r, g, b):
+ return g
+
+class MyExample3(director_abstract.Example3_i):
+ def Color(self, r, g, b):
+ return b
+
+me1 = MyExample1()
+if director_abstract.Example1_get_color(me1, 1,2,3) != 1:
+ raise RuntimeError
+
+me2 = MyExample2(1,2)
+if MyExample2.get_color(me2, 1,2,3) != 2:
+ raise RuntimeError
+
+me3 = MyExample3()
+if MyExample3.get_color(me3, 1,2,3) != 3:
+ raise RuntimeError
+
+error = 1
+try:
+ me1 = director_abstract.Example1()
+except:
+ error = 0
+if (error): raise RuntimeError
+
+error = 1
+try:
+ me2 = director_abstract.Example2()
+except:
+ error = 0
+if (error): raise RuntimeError
+
+error = 1
+try:
+ me3 = director_abstract.Example3_i()
+except:
+ error = 0
+if (error): raise RuntimeError
+
+
+try:
+ f = director_abstract.A.f
+except:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/director_basic_runme.py b/trunk/Examples/test-suite/python/director_basic_runme.py
new file mode 100644
index 000000000..541139814
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_basic_runme.py
@@ -0,0 +1,98 @@
+import director_basic
+
+class PyFoo(director_basic.Foo):
+ def ping(self):
+ return "PyFoo::ping()"
+
+
+a = PyFoo()
+
+if a.ping() != "PyFoo::ping()":
+ raise RuntimeError, a.ping()
+
+if a.pong() != "Foo::pong();PyFoo::ping()":
+ raise RuntimeError, a.pong()
+
+b = director_basic.Foo()
+
+if b.ping() != "Foo::ping()":
+ raise RuntimeError, b.ping()
+
+if b.pong() != "Foo::pong();Foo::ping()":
+ raise RuntimeError, b.pong()
+
+a = director_basic.A1(1)
+
+if a.rg(2) != 2:
+ raise RuntimeError
+
+
+
+class PyClass(director_basic.MyClass):
+ def method(self, vptr):
+ self.cmethod = 7
+ pass
+
+ def vmethod(self, b):
+ b.x = b.x + 31
+ return b
+
+
+b = director_basic.Bar(3)
+d = director_basic.MyClass()
+c = PyClass()
+
+cc = director_basic.MyClass_get_self(c)
+dd = director_basic.MyClass_get_self(d)
+
+bc = cc.cmethod(b)
+bd = dd.cmethod(b)
+
+cc.method(b)
+if c.cmethod != 7:
+ raise RuntimeError
+
+if bc.x != 34:
+ raise RuntimeError
+
+
+if bd.x != 16:
+ raise RuntimeError
+
+
+
+class PyMulti(director_basic.Foo, director_basic.MyClass):
+ def __init__(self):
+ director_basic.Foo.__init__(self)
+ director_basic.MyClass.__init__(self)
+ pass
+
+
+ def vmethod(self, b):
+ b.x = b.x + 31
+ return b
+
+
+ def ping(self):
+ return "PyFoo::ping()"
+
+a = 0
+for i in range(0,100):
+ pymult = PyMulti()
+ pymult.pong()
+ del pymult
+
+
+
+pymult = PyMulti()
+
+
+
+
+p1 = director_basic.Foo_get_self(pymult)
+p2 = director_basic.MyClass_get_self(pymult)
+
+p1.ping()
+p2.vmethod(bc)
+
+
diff --git a/trunk/Examples/test-suite/python/director_classic_runme.py b/trunk/Examples/test-suite/python/director_classic_runme.py
new file mode 100644
index 000000000..7e18a9a61
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_classic_runme.py
@@ -0,0 +1,142 @@
+from director_classic import *
+
+class TargetLangPerson(Person):
+ def __init__(self):
+ Person.__init__(self)
+ def id(self):
+ identifier = "TargetLangPerson"
+ return identifier
+
+class TargetLangChild(Child):
+ def __init__(self):
+ Child.__init__(self)
+ def id(self):
+ identifier = "TargetLangChild"
+ return identifier
+
+class TargetLangGrandChild(GrandChild):
+ def __init__(self):
+ GrandChild.__init__(self)
+ def id(self):
+ identifier = "TargetLangGrandChild"
+ return identifier
+
+# Semis - don't override id() in target language
+class TargetLangSemiPerson(Person):
+ def __init__(self):
+ Person.__init__(self)
+ # No id() override
+
+class TargetLangSemiChild(Child):
+ def __init__(self):
+ Child.__init__(self)
+ # No id() override
+
+class TargetLangSemiGrandChild(GrandChild):
+ def __init__(self):
+ GrandChild.__init__(self)
+ # No id() override
+
+# Orphans - don't override id() in C++
+class TargetLangOrphanPerson(OrphanPerson):
+ def __init__(self):
+ OrphanPerson.__init__(self)
+ def id(self):
+ identifier = "TargetLangOrphanPerson"
+ return identifier
+
+class TargetLangOrphanChild(OrphanChild):
+ def __init__(self):
+ Child.__init__(self)
+ def id(self):
+ identifier = "TargetLangOrphanChild"
+ return identifier
+
+
+def check(person, expected):
+
+ debug = 0
+ # Normal target language polymorphic call
+ ret = person.id()
+ if (debug):
+ print(ret)
+ if (ret != expected):
+ raise RuntimeError("Failed. Received: " + str(ret) + " Expected: " + expected)
+
+ # Polymorphic call from C++
+ caller = Caller()
+ caller.setCallback(person)
+ ret = caller.call()
+ if (debug):
+ print(ret)
+ if (ret != expected):
+ raise RuntimeError("Failed. Received: " + str(ret) + " Expected: " + expected)
+
+ # Polymorphic call of object created in target language and passed to C++ and back again
+ baseclass = caller.baseClass()
+ ret = baseclass.id()
+ if (debug):
+ print(ret)
+ if (ret != expected):
+ raise RuntimeError("Failed. Received: " + str(ret)+ " Expected: " + expected)
+
+ caller.resetCallback()
+ if (debug):
+ print("----------------------------------------")
+
+
+
+person = Person();
+check(person, "Person");
+del person
+
+person = Child();
+check(person, "Child");
+del person
+
+person = GrandChild();
+check(person, "GrandChild");
+del person
+
+person = TargetLangPerson();
+check(person, "TargetLangPerson");
+del person
+
+person = TargetLangChild();
+check(person, "TargetLangChild");
+del person
+
+person = TargetLangGrandChild();
+check(person, "TargetLangGrandChild");
+del person
+
+# Semis - don't override id() in target language
+person = TargetLangSemiPerson();
+check(person, "Person");
+del person
+
+person = TargetLangSemiChild();
+check(person, "Child");
+del person
+
+person = TargetLangSemiGrandChild();
+check(person, "GrandChild");
+del person
+
+# Orphans - don't override id() in C++
+person = OrphanPerson();
+check(person, "Person");
+del person
+
+person = OrphanChild();
+check(person, "Child");
+del person
+
+person = TargetLangOrphanPerson();
+check(person, "TargetLangOrphanPerson");
+del person
+
+person = TargetLangOrphanChild();
+check(person, "TargetLangOrphanChild");
+del person
+
diff --git a/trunk/Examples/test-suite/python/director_default_runme.py b/trunk/Examples/test-suite/python/director_default_runme.py
new file mode 100644
index 000000000..f3ac14972
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_default_runme.py
@@ -0,0 +1,9 @@
+from director_default import *
+
+
+f = Foo()
+f = Foo(1)
+
+
+f = Bar()
+f = Bar(1)
diff --git a/trunk/Examples/test-suite/python/director_detect_runme.py b/trunk/Examples/test-suite/python/director_detect_runme.py
new file mode 100644
index 000000000..a90cfe8b4
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_detect_runme.py
@@ -0,0 +1,36 @@
+import director_detect
+
+class MyBar(director_detect.Bar):
+ def __init__(self, val = 2):
+ director_detect.Bar.__init__(self)
+ self.val = val
+
+ def get_value(self):
+ self.val = self.val + 1
+ return self.val
+
+ def get_class(self):
+ self.val = self.val + 1
+ return director_detect.A()
+
+ def just_do_it(self):
+ self.val = self.val + 1
+
+ def clone(self):
+ return MyBar(self.val)
+ pass
+
+
+b = MyBar()
+
+f = b.baseclass()
+
+v = f.get_value()
+a = f.get_class()
+f.just_do_it()
+
+c = b.clone()
+vc = c.get_value()
+
+if (v != 3) or (b.val != 5) or (vc != 6):
+ raise RuntimeError,"Bad virtual detection"
diff --git a/trunk/Examples/test-suite/python/director_enum_runme.py b/trunk/Examples/test-suite/python/director_enum_runme.py
new file mode 100644
index 000000000..5692c88b8
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_enum_runme.py
@@ -0,0 +1,12 @@
+import director_enum
+
+class MyFoo(director_enum.Foo):
+ def say_hi(self, val):
+ return val
+
+
+b = director_enum.Foo()
+a = MyFoo()
+
+if a.say_hi(director_enum.hello) != b.say_hello(director_enum.hi):
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/director_exception_runme.py b/trunk/Examples/test-suite/python/director_exception_runme.py
new file mode 100644
index 000000000..82be1289b
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_exception_runme.py
@@ -0,0 +1,77 @@
+from director_exception import *
+
+class MyException(Exception):
+ def __init__(self, a, b):
+ self.msg = a + b
+
+class MyFoo(Foo):
+ def ping(self):
+ raise NotImplementedError, "MyFoo::ping() EXCEPTION"
+
+class MyFoo2(Foo):
+ def ping(self):
+ return True
+ pass # error: should return a string
+
+class MyFoo3(Foo):
+ def ping(self):
+ raise MyException("foo", "bar")
+
+# Check that the NotImplementedError raised by MyFoo.ping() is returned by
+# MyFoo.pong().
+ok = 0
+a = MyFoo()
+b = launder(a)
+try:
+ b.pong()
+except NotImplementedError, e:
+ if str(e) == "MyFoo::ping() EXCEPTION":
+ ok = 1
+ else:
+ print "Unexpected error message: %s" % str(e)
+except:
+ pass
+if not ok:
+ raise RuntimeError
+
+
+# Check that the director returns the appropriate TypeError if the return type
+# is wrong.
+ok = 0
+a = MyFoo2()
+b = launder(a)
+try:
+ b.pong()
+except TypeError, e:
+ if str(e) == "SWIG director type mismatch in output value of type 'std::string'":
+ ok = 1
+ else:
+ print "Unexpected error message: %s" % str(e)
+if not ok:
+ raise RuntimeError
+
+
+# Check that the director can return an exception which requires two arguments
+# to the constructor, without mangling it.
+ok = 0
+a = MyFoo3()
+b = launder(a)
+try:
+ b.pong()
+except MyException, e:
+ if e.msg == 'foobar':
+ ok = 1
+ else:
+ print "Unexpected error message: %s" % str(e)
+if not ok:
+ raise RuntimeError
+
+try:
+ raise Exception2()
+except Exception2:
+ pass
+
+try:
+ raise Exception1()
+except Exception1:
+ pass
diff --git a/trunk/Examples/test-suite/python/director_extend_runme.py b/trunk/Examples/test-suite/python/director_extend_runme.py
new file mode 100644
index 000000000..1ab58676a
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_extend_runme.py
@@ -0,0 +1,20 @@
+# Test case from bug #1506850
+#"When threading is enabled, the interpreter will infinitely wait on a mutex the second
+#time this type of extended method is called. Attached is an example
+#program that waits on the mutex to be unlocked."
+
+from director_extend import *
+
+class MyObject(SpObject):
+ def __init__(self):
+ SpObject.__init__(self)
+ return
+
+ def getFoo(self):
+ return 123
+
+m = MyObject()
+if m.dummy() != 666:
+ raise RuntimeError, "1st call"
+if m.dummy() != 666: # Locked system
+ raise RuntimeError, "2nd call"
diff --git a/trunk/Examples/test-suite/python/director_finalizer_runme.py b/trunk/Examples/test-suite/python/director_finalizer_runme.py
new file mode 100644
index 000000000..4cd1f573e
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_finalizer_runme.py
@@ -0,0 +1,48 @@
+from director_finalizer import *
+
+class MyFoo(Foo):
+ def __del__(self):
+ self.orStatus(2)
+ try: Foo.__del__(self)
+ except: pass
+
+
+resetStatus()
+
+a = MyFoo()
+del a
+
+if getStatus() != 3:
+ raise RuntimeError
+
+resetStatus()
+
+a = MyFoo()
+launder(a)
+
+if getStatus() != 0:
+ raise RuntimeError
+
+del a
+
+if getStatus() != 3:
+ raise RuntimeError
+
+resetStatus()
+
+a = MyFoo().__disown__()
+deleteFoo(a)
+
+if getStatus() != 3:
+ raise RuntimeError
+
+resetStatus()
+
+a = MyFoo().__disown__()
+deleteFoo(launder(a))
+
+if getStatus() != 3:
+ raise RuntimeError
+
+resetStatus()
+
diff --git a/trunk/Examples/test-suite/python/director_frob_runme.py b/trunk/Examples/test-suite/python/director_frob_runme.py
new file mode 100644
index 000000000..c2dd734cf
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_frob_runme.py
@@ -0,0 +1,7 @@
+from director_frob import *
+
+foo = Bravo();
+s = foo.abs_method();
+
+if s != "Bravo::abs_method()":
+ raise RuntimeError, s
diff --git a/trunk/Examples/test-suite/python/director_nested_runme.py b/trunk/Examples/test-suite/python/director_nested_runme.py
new file mode 100644
index 000000000..cff82f55b
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_nested_runme.py
@@ -0,0 +1,63 @@
+from director_nested import *
+
+
+class A(FooBar_int):
+ def do_step(self):
+ return "A::do_step;"
+
+ def get_value(self):
+ return "A::get_value"
+
+ pass
+
+
+a = A()
+if a.step() != "Bar::step;Foo::advance;Bar::do_advance;A::do_step;":
+ raise RuntimeError,"Bad A virtual resolution"
+
+
+class B(FooBar_int):
+ def do_advance(self):
+ return "B::do_advance;" + self.do_step()
+
+ def do_step(self):
+ return "B::do_step;"
+
+ def get_value(self):
+ return 1
+
+ pass
+
+
+b = B()
+
+if b.step() != "Bar::step;Foo::advance;B::do_advance;B::do_step;":
+ raise RuntimeError,"Bad B virtual resolution"
+
+
+
+class C(FooBar_int):
+ def do_advance(self):
+ return "C::do_advance;" + FooBar_int.do_advance(self)
+
+ def do_step(self):
+ return "C::do_step;"
+
+ def get_value(self):
+ return 2
+
+ def get_name(self):
+ return FooBar_int.get_name(self) + " hello"
+
+
+ pass
+
+cc = C()
+c = FooBar_int_get_self(cc)
+c.advance()
+
+if c.get_name() != "FooBar::get_name hello":
+ raise RuntimeError
+
+if c.name() != "FooBar::get_name hello":
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/director_profile_runme.py b/trunk/Examples/test-suite/python/director_profile_runme.py
new file mode 100644
index 000000000..2f67481f5
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_profile_runme.py
@@ -0,0 +1,41 @@
+import director_profile
+
+class MyB(director_profile.B):
+ def vfi(self, a):
+ return a+3
+
+
+
+a = director_profile.A()
+myb = MyB()
+b = director_profile.B.get_self(myb)
+
+
+fi = b.fi
+i = 50000
+a = 1
+while i:
+ a = fi(a) #1
+ a = fi(a) #2
+ a = fi(a) #3
+ a = fi(a) #4
+ a = fi(a) #5
+ a = fi(a) #6
+ a = fi(a) #7
+ a = fi(a) #8
+ a = fi(a) #9
+ a = fi(a) #10
+ a = fi(a) #1
+ a = fi(a) #2
+ a = fi(a) #3
+ a = fi(a) #4
+ a = fi(a) #5
+ a = fi(a) #6
+ a = fi(a) #7
+ a = fi(a) #8
+ a = fi(a) #9
+ a = fi(a) #20
+ i -= 1
+
+print a
+
diff --git a/trunk/Examples/test-suite/python/director_protected_runme.py b/trunk/Examples/test-suite/python/director_protected_runme.py
new file mode 100644
index 000000000..9d565a1b4
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_protected_runme.py
@@ -0,0 +1,88 @@
+from director_protected import *
+
+
+
+class FooBar(Bar):
+ def ping(self):
+ return "FooBar::ping();"
+
+class FooBar2(Bar):
+ def ping(self):
+ return "FooBar2::ping();"
+ def pang(self):
+ return "FooBar2::pang();"
+
+
+b = Bar()
+f = b.create()
+fb = FooBar()
+fb2 = FooBar2()
+
+
+try:
+ s = fb.used()
+ if s != "Foo::pang();Bar::pong();Foo::pong();FooBar::ping();":
+ raise RuntimeError
+ pass
+except:
+ raise RuntimeError, "bad FooBar::used"
+
+try:
+ s = fb2.used()
+ if s != "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();":
+ raise RuntimeError
+ pass
+except:
+ raise RuntimeError, "bad FooBar2::used"
+
+try:
+ s = b.pong()
+ if s != "Bar::pong();Foo::pong();Bar::ping();":
+ raise RuntimeError
+ pass
+except:
+ raise RuntimeError, "bad Bar::pong"
+
+try:
+ s = f.pong()
+ if s != "Bar::pong();Foo::pong();Bar::ping();":
+ raise RuntimeError
+ pass
+except:
+ raise RuntimeError," bad Foo::pong"
+
+try:
+ s = fb.pong()
+ if s != "Bar::pong();Foo::pong();FooBar::ping();":
+ raise RuntimeError
+ pass
+except:
+ raise RuntimeError," bad FooBar::pong"
+
+protected=1
+try:
+ b.ping()
+ protected=0
+except:
+ pass
+if not protected:
+ raise RuntimeError,"Boo::ping is protected"
+
+protected=1
+try:
+ f.ping()
+ protected=0
+except:
+ pass
+if not protected:
+ raise RuntimeError,"Foo::ping is protected"
+
+
+protected=1
+try:
+ f.pang()
+ protected=0
+except:
+ pass
+if not protected:
+ raise RuntimeError,"FooBar::pang is protected"
diff --git a/trunk/Examples/test-suite/python/director_stl_runme.py b/trunk/Examples/test-suite/python/director_stl_runme.py
new file mode 100644
index 000000000..aaea0362a
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_stl_runme.py
@@ -0,0 +1,39 @@
+import director_stl
+
+class MyFoo(director_stl.Foo):
+ def ping(self, s):
+ return "MyFoo::ping():" + s
+
+ def pident(self, arg):
+ return arg
+
+ def vident(self,v):
+ return v
+
+ def vidents(self,v):
+ return v
+
+ def vsecond(self,v1,v2):
+ return v2
+
+
+a = MyFoo()
+
+a.tping("hello")
+a.tpong("hello")
+
+p = (1,2)
+a.pident(p)
+v = (3,4)
+a.vident(v)
+
+a.tpident(p)
+a.tvident(v)
+
+v1 = (3,4)
+v2 = (5,6)
+a.tvsecond(v1,v2)
+
+vs=("hi", "hello")
+vs
+a.tvidents(vs)
diff --git a/trunk/Examples/test-suite/python/director_string_runme.py b/trunk/Examples/test-suite/python/director_string_runme.py
new file mode 100644
index 000000000..f2db416ca
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_string_runme.py
@@ -0,0 +1,29 @@
+from director_string import *
+
+class B(A):
+ def __init__(self,string):
+ A.__init__(self,string)
+
+ def get_first(self):
+ return A.get_first(self) + " world!"
+
+ def process_text(self, string):
+ A.process_text(self, string)
+ self.smem = "hello"
+
+
+
+b = B("hello")
+
+b.get(0)
+if b.get_first() != "hello world!":
+ print b.get_first()
+ raise RuntimeError
+
+
+b.call_process_func()
+
+if b.smem != "hello":
+ print smem
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/director_thread_runme.py b/trunk/Examples/test-suite/python/director_thread_runme.py
new file mode 100644
index 000000000..15a12ab80
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_thread_runme.py
@@ -0,0 +1,18 @@
+from director_thread import Foo
+
+class Derived(Foo) :
+ def __init__(self):
+ Foo.__init__(self)
+
+ def do_foo(self):
+ self.val = self.val - 1
+
+
+d = Derived()
+d.run()
+
+if d.val >= 0:
+ print d.val
+ raise RuntimeError
+
+d.stop()
diff --git a/trunk/Examples/test-suite/python/director_unroll_runme.py b/trunk/Examples/test-suite/python/director_unroll_runme.py
new file mode 100644
index 000000000..e2bc93779
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_unroll_runme.py
@@ -0,0 +1,19 @@
+import director_unroll
+
+class MyFoo(director_unroll.Foo):
+ def ping(self):
+ return "MyFoo::ping()"
+
+
+a = MyFoo()
+
+b = director_unroll.Bar()
+
+b.set(a)
+c = b.get()
+
+
+if not (a.this == c.this):
+ print a, c
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/director_wstring_runme.py b/trunk/Examples/test-suite/python/director_wstring_runme.py
new file mode 100644
index 000000000..f3f29de5e
--- /dev/null
+++ b/trunk/Examples/test-suite/python/director_wstring_runme.py
@@ -0,0 +1,28 @@
+from director_wstring import *
+
+class B(A):
+ def __init__(self,string):
+ A.__init__(self,string)
+
+ def get_first(self):
+ return A.get_first(self) + u" world!"
+
+ def process_text(self, string):
+ self.smem = u"hello"
+
+
+
+b = B(u"hello")
+
+b.get(0)
+if b.get_first() != u"hello world!":
+ print b.get_first()
+ raise RuntimeError
+
+
+b.call_process_func()
+
+if b.smem != u"hello":
+ print smem
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/disown_runme.py b/trunk/Examples/test-suite/python/disown_runme.py
new file mode 100644
index 000000000..b8cae077a
--- /dev/null
+++ b/trunk/Examples/test-suite/python/disown_runme.py
@@ -0,0 +1,25 @@
+from disown import *
+
+a = A()
+
+tmp = a.thisown
+
+a.thisown = 0
+if a.thisown:
+ raise RuntimeError
+
+a.thisown = 1
+if (not a.thisown):
+ raise RuntimeError
+
+a.thisown = tmp
+if (a.thisown != tmp):
+ raise RuntimeError
+
+
+b = B()
+
+b.acquire(a)
+
+if a.thisown:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/dynamic_cast_runme.py b/trunk/Examples/test-suite/python/dynamic_cast_runme.py
new file mode 100644
index 000000000..68b06db50
--- /dev/null
+++ b/trunk/Examples/test-suite/python/dynamic_cast_runme.py
@@ -0,0 +1,12 @@
+import dynamic_cast
+
+f = dynamic_cast.Foo()
+b = dynamic_cast.Bar()
+
+x = f.blah()
+y = b.blah()
+
+a = dynamic_cast.do_test(y)
+if a != "Bar::test":
+ print "Failed!!"
+
diff --git a/trunk/Examples/test-suite/python/empty_runme.py b/trunk/Examples/test-suite/python/empty_runme.py
new file mode 100644
index 000000000..7de5d15e5
--- /dev/null
+++ b/trunk/Examples/test-suite/python/empty_runme.py
@@ -0,0 +1 @@
+import empty
diff --git a/trunk/Examples/test-suite/python/enum_template_runme.py b/trunk/Examples/test-suite/python/enum_template_runme.py
new file mode 100644
index 000000000..6ad0a8060
--- /dev/null
+++ b/trunk/Examples/test-suite/python/enum_template_runme.py
@@ -0,0 +1,7 @@
+import enum_template
+if enum_template.MakeETest() != 1:
+ raise RuntimeError
+
+if enum_template.TakeETest(0) != None:
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/enums_runme.py b/trunk/Examples/test-suite/python/enums_runme.py
new file mode 100644
index 000000000..8d491baf4
--- /dev/null
+++ b/trunk/Examples/test-suite/python/enums_runme.py
@@ -0,0 +1,19 @@
+
+import _enums
+
+_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.Mine != 11:
+ raise RuntimeError
+
+if _enums.cvar.Thigh != 12:
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/exception_order_runme.py b/trunk/Examples/test-suite/python/exception_order_runme.py
new file mode 100644
index 000000000..0b0b1c08d
--- /dev/null
+++ b/trunk/Examples/test-suite/python/exception_order_runme.py
@@ -0,0 +1,41 @@
+from exception_order import *
+
+
+a = A()
+
+try:
+ a.foo()
+except E1,e:
+ pass
+except:
+ raise RuntimeError, "bad exception order"
+
+try:
+ a.bar()
+except E2,e:
+ pass
+except:
+ raise RuntimeError, "bad exception order"
+
+try:
+ a.foobar()
+except RuntimeError,e:
+ if e.args[0] != "postcatch unknown":
+ print "bad exception order",
+ raise RuntimeError, e.args
+
+
+
+try:
+ a.barfoo(1)
+except E1,e:
+ pass
+except:
+ raise RuntimeError, "bad exception order"
+
+try:
+ a.barfoo(2)
+except E2,e:
+ pass
+except:
+ raise RuntimeError, "bad exception order"
diff --git a/trunk/Examples/test-suite/python/extend_placement_runme.py b/trunk/Examples/test-suite/python/extend_placement_runme.py
new file mode 100644
index 000000000..97b7b1654
--- /dev/null
+++ b/trunk/Examples/test-suite/python/extend_placement_runme.py
@@ -0,0 +1,46 @@
+import extend_placement
+
+foo = extend_placement.Foo()
+foo = extend_placement.Foo(1)
+foo = extend_placement.Foo(1,1)
+foo.spam()
+foo.spam("hello")
+foo.spam(1)
+foo.spam(1,1)
+foo.spam(1,1,1)
+foo.spam(extend_placement.Foo())
+foo.spam(extend_placement.Foo(), 1.0)
+
+
+bar = extend_placement.Bar()
+bar = extend_placement.Bar(1)
+bar.spam()
+bar.spam("hello")
+bar.spam(1)
+bar.spam(1,1)
+bar.spam(1,1,1)
+bar.spam(extend_placement.Bar())
+bar.spam(extend_placement.Bar(), 1.0)
+
+
+foo = extend_placement.FooTi()
+foo = extend_placement.FooTi(1)
+foo = extend_placement.FooTi(1,1)
+foo.spam()
+foo.spam("hello")
+foo.spam(1)
+foo.spam(1,1)
+foo.spam(1,1,1)
+foo.spam(extend_placement.Foo())
+foo.spam(extend_placement.Foo(), 1.0)
+
+
+bar = extend_placement.BarTi()
+bar = extend_placement.BarTi(1)
+bar.spam()
+bar.spam("hello")
+bar.spam(1)
+bar.spam(1,1)
+bar.spam(1,1,1)
+bar.spam(extend_placement.Bar())
+bar.spam(extend_placement.Bar(), 1.0)
diff --git a/trunk/Examples/test-suite/python/extend_template_ns_runme.py b/trunk/Examples/test-suite/python/extend_template_ns_runme.py
new file mode 100644
index 000000000..5c5feac66
--- /dev/null
+++ b/trunk/Examples/test-suite/python/extend_template_ns_runme.py
@@ -0,0 +1,7 @@
+from extend_template_ns import *
+f = Foo_One()
+if f.test1(37) != 37:
+ raise RuntimeError
+
+if f.test2(42) != 42:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/extend_template_runme.py b/trunk/Examples/test-suite/python/extend_template_runme.py
new file mode 100644
index 000000000..be6e2fc98
--- /dev/null
+++ b/trunk/Examples/test-suite/python/extend_template_runme.py
@@ -0,0 +1,8 @@
+import extend_template
+
+f = extend_template.Foo_0()
+if f.test1(37) != 37:
+ raise RuntimeError
+
+if f.test2(42) != 42:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/extend_variable_runme.py b/trunk/Examples/test-suite/python/extend_variable_runme.py
new file mode 100644
index 000000000..6a6628cac
--- /dev/null
+++ b/trunk/Examples/test-suite/python/extend_variable_runme.py
@@ -0,0 +1,4 @@
+from extend_variable import *
+
+if Foo.Bar != 42:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/extern_c_runme.py b/trunk/Examples/test-suite/python/extern_c_runme.py
new file mode 100644
index 000000000..1a6d2aa12
--- /dev/null
+++ b/trunk/Examples/test-suite/python/extern_c_runme.py
@@ -0,0 +1,4 @@
+import extern_c
+
+extern_c.RealFunction(2)
+
diff --git a/trunk/Examples/test-suite/python/file_test_runme.py b/trunk/Examples/test-suite/python/file_test_runme.py
new file mode 100644
index 000000000..de4e2669e
--- /dev/null
+++ b/trunk/Examples/test-suite/python/file_test_runme.py
@@ -0,0 +1,10 @@
+import sys
+import file_test
+
+if sys.version_info < (3,0):
+ file_test.nfile(sys.stdout)
+
+cstdout = file_test.GetStdOut()
+
+file_test.nfile(cstdout)
+file_test.nfile_name("test.dat")
diff --git a/trunk/Examples/test-suite/python/friends_runme.py b/trunk/Examples/test-suite/python/friends_runme.py
new file mode 100644
index 000000000..04897655a
--- /dev/null
+++ b/trunk/Examples/test-suite/python/friends_runme.py
@@ -0,0 +1,28 @@
+import friends
+
+a = friends.A(2)
+
+if friends.get_val1(a) != 2: raise RuntimeError
+if friends.get_val2(a) != 4: raise RuntimeError
+if friends.get_val3(a) != 6: raise RuntimeError
+
+# nice overload working fine
+if friends.get_val1(1,2,3) != 1: raise RuntimeError
+
+b = friends.B(3)
+
+# David's case
+if friends.mix(a,b) != 5: raise RuntimeError
+
+di = friends.D_d(2)
+dd = friends.D_d(3.3)
+
+# incredible template overloading working just fine
+if friends.get_val1(di) != 2: raise RuntimeError
+if friends.get_val1(dd) != 3.3: raise RuntimeError
+
+friends.set(di, 4)
+friends.set(dd, 1.3)
+
+if friends.get_val1(di) != 4: raise RuntimeError
+if friends.get_val1(dd) != 1.3: raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/fvirtual_runme.py b/trunk/Examples/test-suite/python/fvirtual_runme.py
new file mode 100644
index 000000000..ada3313de
--- /dev/null
+++ b/trunk/Examples/test-suite/python/fvirtual_runme.py
@@ -0,0 +1,9 @@
+from fvirtual import *
+
+sw = NodeSwitch()
+n = Node()
+i = sw.addChild(n);
+
+if i != 2:
+ raise RuntimeError, "addChild"
+
diff --git a/trunk/Examples/test-suite/python/global_ns_arg_runme.py b/trunk/Examples/test-suite/python/global_ns_arg_runme.py
new file mode 100644
index 000000000..e597db5f8
--- /dev/null
+++ b/trunk/Examples/test-suite/python/global_ns_arg_runme.py
@@ -0,0 +1,5 @@
+from global_ns_arg import *
+
+a = foo(1)
+b = bar()
+
diff --git a/trunk/Examples/test-suite/python/grouping_runme.py b/trunk/Examples/test-suite/python/grouping_runme.py
new file mode 100644
index 000000000..13f8c8c92
--- /dev/null
+++ b/trunk/Examples/test-suite/python/grouping_runme.py
@@ -0,0 +1,13 @@
+import grouping
+
+x = grouping.test1(42)
+if x != 42:
+ raise RuntimeError
+
+grouping.test2(42)
+
+x = grouping.do_unary(37, grouping.NEGATE)
+if x != -37:
+ raise RuntimeError
+
+grouping.cvar.test3 = 42
diff --git a/trunk/Examples/test-suite/python/hugemod.pl b/trunk/Examples/test-suite/python/hugemod.pl
new file mode 100644
index 000000000..5420926e4
--- /dev/null
+++ b/trunk/Examples/test-suite/python/hugemod.pl
@@ -0,0 +1,55 @@
+#!/usr/bin/perl
+
+use strict;
+
+my $modsize = 399; #adjust it so you can have a smaller or bigger hugemod
+
+my $runme = shift @ARGV;
+
+open HEADER, ">hugemod.h" or die "error";
+open TEST, ">$runme" or die "error";
+open I1, ">hugemod_a.i" or die "error";
+open I2, ">hugemod_b.i" or die "error";
+
+print TEST "import hugemod_a\n";
+print TEST "import hugemod_b\n";
+
+print I1 "\%module hugemod_a;\n";
+print I1 "\%include \"hugemod.h\";\n";
+print I1 "\%{ #include \"hugemod.h\" \%}\n";
+
+print I2 "\%module hugemod_b;\n";
+print I2 "\%import \"hugemod.h\";\n";
+print I2 "\%{ #include \"hugemod.h\" \%}\n";
+print I2 "\%inline \%{\n";
+
+my $i;
+
+for ($i = 0; $i < $modsize; $i++) {
+ my $t = $i * 4;
+ print HEADER "class type$i { public: int a; };\n";
+ print I2 "class dtype$i : public type$i { public: int b; };\n";
+
+ print TEST "c = hugemod_a.type$i()\n";
+ print TEST "c.a = $t\n";
+ print TEST "if c.a != $t:\n";
+ print TEST " raise RuntimeError\n";
+
+ print TEST "c = hugemod_b.dtype$i()\n";
+ print TEST "c.a = $t\n";
+ print TEST "if c.a != $t:\n";
+ print TEST " raise RuntimeError\n";
+
+ $t = -$t;
+
+ print TEST "c.b = $t\n";
+ print TEST "if c.b != $t:\n";
+ print TEST " raise RuntimeError\n\n";
+}
+
+print I2 "\%}\n";
+
+close HEADER;
+close TEST;
+close I1;
+close I2;
diff --git a/trunk/Examples/test-suite/python/iadd_runme.py b/trunk/Examples/test-suite/python/iadd_runme.py
new file mode 100755
index 000000000..fbeb0ec3e
--- /dev/null
+++ b/trunk/Examples/test-suite/python/iadd_runme.py
@@ -0,0 +1,9 @@
+import iadd
+
+f = iadd.Foo()
+
+f.AsA.x = 3
+f.AsA += f.AsA
+
+if f.AsA.x != 6:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/import_nomodule_runme.py b/trunk/Examples/test-suite/python/import_nomodule_runme.py
new file mode 100644
index 000000000..ba0abfd9a
--- /dev/null
+++ b/trunk/Examples/test-suite/python/import_nomodule_runme.py
@@ -0,0 +1,8 @@
+from import_nomodule import *
+
+f = create_Foo()
+test1(f,42)
+delete_Foo(f)
+
+b = Bar()
+test1(b,37)
diff --git a/trunk/Examples/test-suite/python/imports_runme.py b/trunk/Examples/test-suite/python/imports_runme.py
new file mode 100644
index 000000000..50a3ab59f
--- /dev/null
+++ b/trunk/Examples/test-suite/python/imports_runme.py
@@ -0,0 +1,17 @@
+# This is the import runtime testcase.
+
+import imports_b
+import imports_a
+import sys
+
+x = imports_b.B()
+imports_a.A.hello(x)
+
+a = imports_a.A()
+
+c = imports_b.C()
+a1 = c.get_a(c)
+a2 = c.get_a_type(c)
+
+if a1.hello() != a2.hello():
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/inctest_runme.py b/trunk/Examples/test-suite/python/inctest_runme.py
new file mode 100644
index 000000000..e10f4544c
--- /dev/null
+++ b/trunk/Examples/test-suite/python/inctest_runme.py
@@ -0,0 +1,32 @@
+import inctest
+
+error = 0
+try:
+ a = inctest.A()
+except:
+ print "didn't find A"
+ print "therefore, I didn't include 'testdir/subdir1/hello.i'"
+ error = 1
+pass
+
+
+try:
+ b = inctest.B()
+except:
+ print "didn't find B"
+ print "therefore, I didn't include 'testdir/subdir2/hello.i'"
+ error = 1
+pass
+
+if error == 1:
+ raise RuntimeError
+
+# Check the import in subdirectory worked
+if inctest.importtest1(5) != 15:
+ print "import test 1 failed"
+ raise RuntimeError
+
+if inctest.importtest2("black") != "white":
+ print "import test 2 failed"
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/inherit_missing_runme.py b/trunk/Examples/test-suite/python/inherit_missing_runme.py
new file mode 100644
index 000000000..044c166fb
--- /dev/null
+++ b/trunk/Examples/test-suite/python/inherit_missing_runme.py
@@ -0,0 +1,19 @@
+import inherit_missing
+
+a = inherit_missing.new_Foo()
+b = inherit_missing.Bar()
+c = inherit_missing.Spam()
+
+x = inherit_missing.do_blah(a)
+if x != "Foo::blah":
+ print "Whoa! Bad return", x
+
+x = inherit_missing.do_blah(b)
+if x != "Bar::blah":
+ print "Whoa! Bad return", x
+
+x = inherit_missing.do_blah(c)
+if x != "Spam::blah":
+ print "Whoa! Bad return", x
+
+inherit_missing.delete_Foo(a)
diff --git a/trunk/Examples/test-suite/python/inout_runme.py b/trunk/Examples/test-suite/python/inout_runme.py
new file mode 100644
index 000000000..fb290f62f
--- /dev/null
+++ b/trunk/Examples/test-suite/python/inout_runme.py
@@ -0,0 +1,22 @@
+import inout
+
+a = inout.AddOne1(1)
+if a != 2:
+ raise RuntimeError
+
+a = inout.AddOne3(1,1,1)
+if a != [2,2,2]:
+ raise RuntimeError
+
+a = inout.AddOne1p((1,1))
+if a != (2,2):
+ raise RuntimeError
+
+a = inout.AddOne2p((1,1),1)
+if a != [(2,2),2]:
+ raise RuntimeError
+
+a = inout.AddOne3p(1,(1,1),1)
+if a != [2,(2,2),2]:
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/inplaceadd_runme.py b/trunk/Examples/test-suite/python/inplaceadd_runme.py
new file mode 100644
index 000000000..b703c56c7
--- /dev/null
+++ b/trunk/Examples/test-suite/python/inplaceadd_runme.py
@@ -0,0 +1,20 @@
+import inplaceadd
+a = inplaceadd.A(7)
+
+a += 5
+if a.val != 12:
+ print a.val
+ raise RuntimeError
+
+a -= 5
+if a.val != 7:
+ raise RuntimeError
+
+a *= 2
+
+if a.val != 14:
+ raise RuntimeError
+
+a += a
+if a.val != 28:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/input_runme.py b/trunk/Examples/test-suite/python/input_runme.py
new file mode 100644
index 000000000..f5ef6dc8b
--- /dev/null
+++ b/trunk/Examples/test-suite/python/input_runme.py
@@ -0,0 +1,20 @@
+from input import *
+
+f = Foo()
+if f.foo(2) != 4:
+ raise RuntimeError
+
+if f.foo(None)!= None:
+ raise RuntimeError
+
+if f.foo()!= None:
+ raise RuntimeError
+
+if sfoo("Hello") != "Hello world":
+ raise RuntimeError
+
+if sfoo(None) != None:
+ raise RuntimeError
+
+if sfoo() != None:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/keyword_rename_runme.py b/trunk/Examples/test-suite/python/keyword_rename_runme.py
new file mode 100644
index 000000000..5646ce7d6
--- /dev/null
+++ b/trunk/Examples/test-suite/python/keyword_rename_runme.py
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+import keyword_rename
+keyword_rename._in(1)
+keyword_rename._except(1)
diff --git a/trunk/Examples/test-suite/python/langobj_runme.py b/trunk/Examples/test-suite/python/langobj_runme.py
new file mode 100644
index 000000000..c10e19303
--- /dev/null
+++ b/trunk/Examples/test-suite/python/langobj_runme.py
@@ -0,0 +1,13 @@
+import sys
+from langobj import *
+
+
+x ="hello"
+rx = sys.getrefcount(x)
+v = identity(x)
+rv = sys.getrefcount(v)
+if v != x:
+ raise RuntimeError
+
+if rv - rx != 1:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/li_attribute_runme.py b/trunk/Examples/test-suite/python/li_attribute_runme.py
new file mode 100644
index 000000000..db40b9b2a
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_attribute_runme.py
@@ -0,0 +1,74 @@
+# Ported to C# li_attribute_runme.cs
+
+import li_attribute
+
+aa = li_attribute.A(1,2,3)
+
+if aa.a != 1:
+ raise RuntimeError
+aa.a = 3
+if aa.a != 3:
+ print aa.a
+ raise RuntimeError
+
+if aa.b != 2:
+ print aa.b
+ raise RuntimeError
+aa.b = 5
+if aa.b != 5:
+ raise RuntimeError
+
+if aa.d != aa.b:
+ raise RuntimeError
+
+if aa.c != 3:
+ raise RuntimeError
+#aa.c = 5
+#if aa.c != 3:
+# raise RuntimeError
+
+pi = li_attribute.Param_i(7)
+if pi.value != 7:
+ raise RuntimeError
+
+pi.value=3
+if pi.value != 3:
+ raise RuntimeError
+
+b = li_attribute.B(aa)
+
+if b.a.c != 3:
+ raise RuntimeError
+
+# class/struct attribute with get/set methods using return/pass by reference
+myFoo = li_attribute.MyFoo()
+myFoo.x = 8
+myClass = li_attribute.MyClass()
+myClass.Foo = myFoo
+if myClass.Foo.x != 8:
+ raise RuntimeError
+
+# class/struct attribute with get/set methods using return/pass by value
+myClassVal = li_attribute.MyClassVal()
+if myClassVal.ReadWriteFoo.x != -1:
+ raise RuntimeError
+if myClassVal.ReadOnlyFoo.x != -1:
+ raise RuntimeError
+myClassVal.ReadWriteFoo = myFoo
+if myClassVal.ReadWriteFoo.x != 8:
+ raise RuntimeError
+if myClassVal.ReadOnlyFoo.x != 8:
+ raise RuntimeError
+
+# string attribute with get/set methods using return/pass by value
+myStringyClass = li_attribute.MyStringyClass("initial string")
+if myStringyClass.ReadWriteString != "initial string":
+ raise RuntimeError
+if myStringyClass.ReadOnlyString != "initial string":
+ raise RuntimeError
+myStringyClass.ReadWriteString = "changed string"
+if myStringyClass.ReadWriteString != "changed string":
+ raise RuntimeError
+if myStringyClass.ReadOnlyString != "changed string":
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/li_boost_shared_ptr_bits_runme.py b/trunk/Examples/test-suite/python/li_boost_shared_ptr_bits_runme.py
new file mode 100644
index 000000000..9e5668e57
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_boost_shared_ptr_bits_runme.py
@@ -0,0 +1,31 @@
+from li_boost_shared_ptr_bits import *
+
+def check(nd):
+ nd.i = 200
+ i = nd.i
+
+ try:
+ nd.notexist = 100
+ passed = 0
+ except:
+ passed = 1
+
+ if not passed:
+ raise "Test failed"
+
+nd = NonDynamic()
+check(nd)
+b = boing(nd)
+check(b)
+
+################################
+
+v = VectorIntHolder()
+v.push_back(IntHolder(11))
+v.push_back(IntHolder(22))
+v.push_back(IntHolder(33))
+
+sum = sum(v)
+if sum != 66:
+ raise "sum is wrong"
+
diff --git a/trunk/Examples/test-suite/python/li_boost_shared_ptr_runme.py b/trunk/Examples/test-suite/python/li_boost_shared_ptr_runme.py
new file mode 100644
index 000000000..f967def14
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_boost_shared_ptr_runme.py
@@ -0,0 +1,544 @@
+import li_boost_shared_ptr
+import gc
+
+debug = False
+
+# simple shared_ptr usage - created in C++
+class li_boost_shared_ptr_runme:
+ def main(self):
+ if (debug):
+ print "Started"
+
+ li_boost_shared_ptr.cvar.debug_shared = debug
+
+ # Change loop count to run for a long time to monitor memory
+ loopCount = 1 #5000
+ for i in range (0,loopCount):
+ self.runtest()
+
+ # Expect 1 instance - the one global variable (GlobalValue)
+ if (li_boost_shared_ptr.Klass.getTotal_count() != 1):
+ raise RuntimeError("Klass.total_count=%s" % li_boost_shared_ptr.Klass.getTotal_count())
+
+ wrapper_count = li_boost_shared_ptr.shared_ptr_wrapper_count()
+ if (wrapper_count != li_boost_shared_ptr.NOT_COUNTING):
+ # Expect 1 instance - the one global variable (GlobalSmartValue)
+ if (wrapper_count != 1):
+ raise RuntimeError("shared_ptr wrapper count=%s" % wrapper_count)
+
+ if (debug):
+ print "Finished"
+
+ def runtest(self):
+ # simple shared_ptr usage - created in C++
+ k = li_boost_shared_ptr.Klass("me oh my")
+ val = k.getValue()
+ self.verifyValue("me oh my", val)
+ self.verifyCount(1, k)
+
+ # simple shared_ptr usage - not created in C++
+ k = li_boost_shared_ptr.factorycreate()
+ val = k.getValue()
+ self.verifyValue("factorycreate", val)
+ self.verifyCount(1, k)
+
+ # pass by shared_ptr
+ k = li_boost_shared_ptr.Klass("me oh my")
+ kret = li_boost_shared_ptr.smartpointertest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my smartpointertest", val)
+ self.verifyCount(2, k)
+ self.verifyCount(2, kret)
+
+ # pass by shared_ptr pointer
+ k = li_boost_shared_ptr.Klass("me oh my")
+ kret = li_boost_shared_ptr.smartpointerpointertest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my smartpointerpointertest", val)
+ self.verifyCount(2, k)
+ self.verifyCount(2, kret)
+
+ # pass by shared_ptr reference
+ k = li_boost_shared_ptr.Klass("me oh my")
+ kret = li_boost_shared_ptr.smartpointerreftest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my smartpointerreftest", val)
+ self.verifyCount(2, k)
+ self.verifyCount(2, kret)
+
+ # pass by shared_ptr pointer reference
+ k = li_boost_shared_ptr.Klass("me oh my")
+ kret = li_boost_shared_ptr.smartpointerpointerreftest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my smartpointerpointerreftest", val)
+ self.verifyCount(2, k)
+ self.verifyCount(2, kret)
+
+ # const pass by shared_ptr
+ k = li_boost_shared_ptr.Klass("me oh my")
+ kret = li_boost_shared_ptr.constsmartpointertest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my", val)
+ self.verifyCount(2, k)
+ self.verifyCount(2, kret)
+
+ # const pass by shared_ptr pointer
+ k = li_boost_shared_ptr.Klass("me oh my")
+ kret = li_boost_shared_ptr.constsmartpointerpointertest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my", val)
+ self.verifyCount(2, k)
+ self.verifyCount(2, kret)
+
+ # const pass by shared_ptr reference
+ k = li_boost_shared_ptr.Klass("me oh my")
+ kret = li_boost_shared_ptr.constsmartpointerreftest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my", val)
+ self.verifyCount(2, k)
+ self.verifyCount(2, kret)
+
+ # pass by value
+ k = li_boost_shared_ptr.Klass("me oh my")
+ kret = li_boost_shared_ptr.valuetest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my valuetest", val)
+ self.verifyCount(1, k)
+ self.verifyCount(1, kret)
+
+ # pass by pointer
+ k = li_boost_shared_ptr.Klass("me oh my")
+ kret = li_boost_shared_ptr.pointertest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my pointertest", val)
+ self.verifyCount(1, k)
+ self.verifyCount(1, kret)
+
+ # pass by reference
+ k = li_boost_shared_ptr.Klass("me oh my")
+ kret = li_boost_shared_ptr.reftest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my reftest", val)
+ self.verifyCount(1, k)
+ self.verifyCount(1, kret)
+
+ # pass by pointer reference
+ k = li_boost_shared_ptr.Klass("me oh my")
+ kret = li_boost_shared_ptr.pointerreftest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my pointerreftest", val)
+ self.verifyCount(1, k)
+ self.verifyCount(1, kret)
+
+ # null tests
+ k = None
+
+ if (li_boost_shared_ptr.smartpointertest(k) != None):
+ raise RuntimeError("return was not null")
+
+ if (li_boost_shared_ptr.smartpointerpointertest(k) != None):
+ raise RuntimeError("return was not null")
+
+ if (li_boost_shared_ptr.smartpointerreftest(k) != None):
+ raise RuntimeError("return was not null")
+
+ if (li_boost_shared_ptr.smartpointerpointerreftest(k) != None):
+ raise RuntimeError("return was not null")
+
+ if (li_boost_shared_ptr.nullsmartpointerpointertest(None) != "null pointer"):
+ raise RuntimeError("not null smartpointer pointer")
+
+ try:
+ li_boost_shared_ptr.valuetest(k)
+ raise RuntimeError("Failed to catch null pointer")
+ except ValueError:
+ pass
+
+ if (li_boost_shared_ptr.pointertest(k) != None):
+ raise RuntimeError("return was not null")
+
+ try:
+ li_boost_shared_ptr.reftest(k)
+ raise RuntimeError("Failed to catch null pointer")
+ except ValueError:
+ pass
+
+ # $owner
+ k = li_boost_shared_ptr.pointerownertest()
+ val = k.getValue()
+ self.verifyValue("pointerownertest", val)
+ self.verifyCount(1, k)
+ k = li_boost_shared_ptr.smartpointerpointerownertest()
+ val = k.getValue()
+ self.verifyValue("smartpointerpointerownertest", val)
+ self.verifyCount(1, k)
+
+ # //////////////////////////////// Derived class ////////////////////////////////////////
+ # derived pass by shared_ptr
+ k = li_boost_shared_ptr.KlassDerived("me oh my")
+ kret = li_boost_shared_ptr.derivedsmartptrtest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my derivedsmartptrtest-Derived", val)
+ self.verifyCount(2, k)
+ self.verifyCount(2, kret)
+
+ # derived pass by shared_ptr pointer
+ k = li_boost_shared_ptr.KlassDerived("me oh my")
+ kret = li_boost_shared_ptr.derivedsmartptrpointertest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my derivedsmartptrpointertest-Derived", val)
+ self.verifyCount(2, k)
+ self.verifyCount(2, kret)
+
+ # derived pass by shared_ptr ref
+ k = li_boost_shared_ptr.KlassDerived("me oh my")
+ kret = li_boost_shared_ptr.derivedsmartptrreftest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my derivedsmartptrreftest-Derived", val)
+ self.verifyCount(2, k)
+ self.verifyCount(2, kret)
+
+ # derived pass by shared_ptr pointer ref
+ k = li_boost_shared_ptr.KlassDerived("me oh my")
+ kret = li_boost_shared_ptr.derivedsmartptrpointerreftest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my derivedsmartptrpointerreftest-Derived", val)
+ self.verifyCount(2, k)
+ self.verifyCount(2, kret)
+
+ # derived pass by pointer
+ k = li_boost_shared_ptr.KlassDerived("me oh my")
+ kret = li_boost_shared_ptr.derivedpointertest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my derivedpointertest-Derived", val)
+ self.verifyCount(1, k)
+ self.verifyCount(1, kret)
+
+ # derived pass by ref
+ k = li_boost_shared_ptr.KlassDerived("me oh my")
+ kret = li_boost_shared_ptr.derivedreftest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my derivedreftest-Derived", val)
+ self.verifyCount(1, k)
+ self.verifyCount(1, kret)
+
+ # //////////////////////////////// Derived and base class mixed ////////////////////////////////////////
+ # pass by shared_ptr (mixed)
+ k = li_boost_shared_ptr.KlassDerived("me oh my")
+ kret = li_boost_shared_ptr.smartpointertest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my smartpointertest-Derived", val)
+ self.verifyCount(2, k)
+ self.verifyCount(2, kret)
+
+ # pass by shared_ptr pointer (mixed)
+ k = li_boost_shared_ptr.KlassDerived("me oh my")
+ kret = li_boost_shared_ptr.smartpointerpointertest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my smartpointerpointertest-Derived", val)
+ self.verifyCount(2, k)
+ self.verifyCount(2, kret)
+
+ # pass by shared_ptr reference (mixed)
+ k = li_boost_shared_ptr.KlassDerived("me oh my")
+ kret = li_boost_shared_ptr.smartpointerreftest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my smartpointerreftest-Derived", val)
+ self.verifyCount(2, k)
+ self.verifyCount(2, kret)
+
+ # pass by shared_ptr pointer reference (mixed)
+ k = li_boost_shared_ptr.KlassDerived("me oh my")
+ kret = li_boost_shared_ptr.smartpointerpointerreftest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my smartpointerpointerreftest-Derived", val)
+ self.verifyCount(2, k)
+ self.verifyCount(2, kret)
+
+ # pass by value (mixed)
+ k = li_boost_shared_ptr.KlassDerived("me oh my")
+ kret = li_boost_shared_ptr.valuetest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my valuetest", val) # note slicing
+ self.verifyCount(1, k)
+ self.verifyCount(1, kret)
+
+ # pass by pointer (mixed)
+ k = li_boost_shared_ptr.KlassDerived("me oh my")
+ kret = li_boost_shared_ptr.pointertest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my pointertest-Derived", val)
+ self.verifyCount(1, k)
+ self.verifyCount(1, kret)
+
+ # pass by ref (mixed)
+ k = li_boost_shared_ptr.KlassDerived("me oh my")
+ kret = li_boost_shared_ptr.reftest(k)
+ val = kret.getValue()
+ self.verifyValue("me oh my reftest-Derived", val)
+ self.verifyCount(1, k)
+ self.verifyCount(1, kret)
+
+ # //////////////////////////////// Overloading tests ////////////////////////////////////////
+ # Base class
+ k = li_boost_shared_ptr.Klass("me oh my")
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyval(k), "rawbyval")
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyref(k), "rawbyref")
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyptr(k), "rawbyptr")
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyptrref(k), "rawbyptrref")
+
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyval(k), "smartbyval")
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyref(k), "smartbyref")
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyptr(k), "smartbyptr")
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyptrref(k), "smartbyptrref")
+
+ # Derived class
+ k = li_boost_shared_ptr.KlassDerived("me oh my")
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyval(k), "rawbyval")
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyref(k), "rawbyref")
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyptr(k), "rawbyptr")
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyptrref(k), "rawbyptrref")
+
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyval(k), "smartbyval")
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyref(k), "smartbyref")
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyptr(k), "smartbyptr")
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyptrref(k), "smartbyptrref")
+
+ # 3rd derived class
+ k = li_boost_shared_ptr.Klass3rdDerived("me oh my")
+ val = k.getValue()
+ self.verifyValue("me oh my-3rdDerived", val)
+ self.verifyCount(1, k)
+ val = li_boost_shared_ptr.test3rdupcast(k)
+ self.verifyValue("me oh my-3rdDerived", val)
+ self.verifyCount(1, k)
+
+ # //////////////////////////////// Member variables ////////////////////////////////////////
+ # smart pointer by value
+ m = li_boost_shared_ptr.MemberVariables()
+ k = li_boost_shared_ptr.Klass("smart member value")
+ m.SmartMemberValue = k
+ val = k.getValue()
+ self.verifyValue("smart member value", val)
+ self.verifyCount(2, k)
+
+ kmember = m.SmartMemberValue
+ val = kmember.getValue()
+ self.verifyValue("smart member value", val)
+ self.verifyCount(3, kmember)
+ self.verifyCount(3, k)
+
+ del m
+ self.verifyCount(2, kmember)
+ self.verifyCount(2, k)
+
+ # smart pointer by pointer
+ m = li_boost_shared_ptr.MemberVariables()
+ k = li_boost_shared_ptr.Klass("smart member pointer")
+ m.SmartMemberPointer = k
+ val = k.getValue()
+ self.verifyValue("smart member pointer", val)
+ self.verifyCount(1, k)
+
+ kmember = m.SmartMemberPointer
+ val = kmember.getValue()
+ self.verifyValue("smart member pointer", val)
+ self.verifyCount(2, kmember)
+ self.verifyCount(2, k)
+
+ del m
+ self.verifyCount(2, kmember)
+ self.verifyCount(2, k)
+
+ # smart pointer by reference
+ m = li_boost_shared_ptr.MemberVariables()
+ k = li_boost_shared_ptr.Klass("smart member reference")
+ m.SmartMemberReference = k
+ val = k.getValue()
+ self.verifyValue("smart member reference", val)
+ self.verifyCount(2, k)
+
+ kmember = m.SmartMemberReference
+ val = kmember.getValue()
+ self.verifyValue("smart member reference", val)
+ self.verifyCount(3, kmember)
+ self.verifyCount(3, k)
+
+ # The C++ reference refers to SmartMemberValue...
+ kmemberVal = m.SmartMemberValue
+ val = kmember.getValue()
+ self.verifyValue("smart member reference", val)
+ self.verifyCount(4, kmemberVal)
+ self.verifyCount(4, kmember)
+ self.verifyCount(4, k)
+
+ del m
+ self.verifyCount(3, kmemberVal)
+ self.verifyCount(3, kmember)
+ self.verifyCount(3, k)
+
+ # plain by value
+ m = li_boost_shared_ptr.MemberVariables()
+ k = li_boost_shared_ptr.Klass("plain member value")
+ m.MemberValue = k
+ val = k.getValue()
+ self.verifyValue("plain member value", val)
+ self.verifyCount(1, k)
+
+ kmember = m.MemberValue
+ val = kmember.getValue()
+ self.verifyValue("plain member value", val)
+ self.verifyCount(1, kmember)
+ self.verifyCount(1, k)
+
+ del m
+ self.verifyCount(1, kmember)
+ self.verifyCount(1, k)
+
+ # plain by pointer
+ m = li_boost_shared_ptr.MemberVariables()
+ k = li_boost_shared_ptr.Klass("plain member pointer")
+ m.MemberPointer = k
+ val = k.getValue()
+ self.verifyValue("plain member pointer", val)
+ self.verifyCount(1, k)
+
+ kmember = m.MemberPointer
+ val = kmember.getValue()
+ self.verifyValue("plain member pointer", val)
+ self.verifyCount(1, kmember)
+ self.verifyCount(1, k)
+
+ del m
+ self.verifyCount(1, kmember)
+ self.verifyCount(1, k)
+
+ # plain by reference
+ m = li_boost_shared_ptr.MemberVariables()
+ k = li_boost_shared_ptr.Klass("plain member reference")
+ m.MemberReference = k
+ val = k.getValue()
+ self.verifyValue("plain member reference", val)
+ self.verifyCount(1, k)
+
+ kmember = m.MemberReference
+ val = kmember.getValue()
+ self.verifyValue("plain member reference", val)
+ self.verifyCount(1, kmember)
+ self.verifyCount(1, k)
+
+ del m
+ self.verifyCount(1, kmember)
+ self.verifyCount(1, k)
+
+ # null member variables
+ m = li_boost_shared_ptr.MemberVariables()
+
+ # shared_ptr by value
+ k = m.SmartMemberValue
+ if (k != None):
+ raise RuntimeError("expected null")
+ m.SmartMemberValue = None
+ k = m.SmartMemberValue
+ if (k != None):
+ raise RuntimeError("expected null")
+ self.verifyCount(0, k)
+
+ # plain by value
+ try:
+ m.MemberValue = None
+ raise RuntimeError("Failed to catch null pointer")
+ except ValueError:
+ pass
+
+ # ////////////////////////////////// Global variables ////////////////////////////////////////
+ # smart pointer
+ kglobal = li_boost_shared_ptr.cvar.GlobalSmartValue
+ if (kglobal != None):
+ raise RuntimeError("expected null")
+
+ k = li_boost_shared_ptr.Klass("smart global value")
+ li_boost_shared_ptr.cvar.GlobalSmartValue = k
+ self.verifyCount(2, k)
+
+ kglobal = li_boost_shared_ptr.cvar.GlobalSmartValue
+ val = kglobal.getValue()
+ self.verifyValue("smart global value", val)
+ self.verifyCount(3, kglobal)
+ self.verifyCount(3, k)
+ self.verifyValue("smart global value", li_boost_shared_ptr.cvar.GlobalSmartValue.getValue())
+ li_boost_shared_ptr.cvar.GlobalSmartValue = None
+
+ # plain value
+ k = li_boost_shared_ptr.Klass("global value")
+ li_boost_shared_ptr.cvar.GlobalValue = k
+ self.verifyCount(1, k)
+
+ kglobal = li_boost_shared_ptr.cvar.GlobalValue
+ val = kglobal.getValue()
+ self.verifyValue("global value", val)
+ self.verifyCount(1, kglobal)
+ self.verifyCount(1, k)
+ self.verifyValue("global value", li_boost_shared_ptr.cvar.GlobalValue.getValue())
+
+ try:
+ li_boost_shared_ptr.cvar.GlobalValue = None
+ raise RuntimeError("Failed to catch null pointer")
+ except ValueError:
+ pass
+
+ # plain pointer
+ kglobal = li_boost_shared_ptr.cvar.GlobalPointer
+ if (kglobal != None):
+ raise RuntimeError("expected null")
+
+ k = li_boost_shared_ptr.Klass("global pointer")
+ li_boost_shared_ptr.cvar.GlobalPointer = k
+ self.verifyCount(1, k)
+
+ kglobal = li_boost_shared_ptr.cvar.GlobalPointer
+ val = kglobal.getValue()
+ self.verifyValue("global pointer", val)
+ self.verifyCount(1, kglobal)
+ self.verifyCount(1, k)
+ li_boost_shared_ptr.cvar.GlobalPointer = None
+
+ # plain reference
+ kglobal
+
+ k = li_boost_shared_ptr.Klass("global reference")
+ li_boost_shared_ptr.cvar.GlobalReference = k
+ self.verifyCount(1, k)
+
+ kglobal = li_boost_shared_ptr.cvar.GlobalReference
+ val = kglobal.getValue()
+ self.verifyValue("global reference", val)
+ self.verifyCount(1, kglobal)
+ self.verifyCount(1, k)
+
+ try:
+ li_boost_shared_ptr.cvar.GlobalReference = None
+ raise RuntimeError("Failed to catch null pointer")
+ except ValueError:
+ pass
+
+ # ////////////////////////////////// Templates ////////////////////////////////////////
+ pid = li_boost_shared_ptr.PairIntDouble(10, 20.2)
+ if (pid.baseVal1 != 20 or pid.baseVal2 != 40.4):
+ raise RuntimeError("Base values wrong")
+ if (pid.val1 != 10 or pid.val2 != 20.2):
+ raise RuntimeError("Derived Values wrong")
+
+ def verifyValue(self, expected, got):
+ if (expected != got):
+ raise RuntimeError("verify value failed. Expected: ", expected, " Got: ", got)
+
+ def verifyCount(self, expected, k):
+ got = li_boost_shared_ptr.use_count(k)
+ if (expected != got):
+ raise RuntimeError("verify use_count failed. Expected: ", expected, " Got: ", got)
+
+
+runme = li_boost_shared_ptr_runme()
+runme.main()
+
diff --git a/trunk/Examples/test-suite/python/li_carrays_runme.py b/trunk/Examples/test-suite/python/li_carrays_runme.py
new file mode 100644
index 000000000..ad48eab61
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_carrays_runme.py
@@ -0,0 +1,9 @@
+from li_carrays import *
+
+d = doubleArray(10)
+
+d[0] = 7
+d[5] = d[0] + 3
+
+if d[5] + d[0] != 17:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/li_cdata_runme.py b/trunk/Examples/test-suite/python/li_cdata_runme.py
new file mode 100644
index 000000000..061ca6f68
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_cdata_runme.py
@@ -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"
+
diff --git a/trunk/Examples/test-suite/python/li_cmalloc_runme.py b/trunk/Examples/test-suite/python/li_cmalloc_runme.py
new file mode 100644
index 000000000..9e698aee2
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_cmalloc_runme.py
@@ -0,0 +1,14 @@
+from li_cmalloc import *
+
+p = malloc_int()
+free_int(p)
+
+ok = 0
+try:
+ p = calloc_int(-1)
+ free_int(p)
+except:
+ ok = 1
+
+if ok != 1:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/li_cpointer_runme.py b/trunk/Examples/test-suite/python/li_cpointer_runme.py
new file mode 100644
index 000000000..ac95ff4b9
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_cpointer_runme.py
@@ -0,0 +1,10 @@
+from li_cpointer import *
+
+
+p = new_intp()
+intp_assign(p,3)
+
+if intp_value(p) != 3:
+ raise RuntimeError
+
+delete_intp(p)
diff --git a/trunk/Examples/test-suite/python/li_cstring_runme.py b/trunk/Examples/test-suite/python/li_cstring_runme.py
new file mode 100644
index 000000000..6503744bd
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_cstring_runme.py
@@ -0,0 +1,32 @@
+from li_cstring import *
+
+
+if count("ab\0ab\0ab\0", 0) != 3:
+ raise RuntimeError
+
+if test1() != "Hello World":
+ raise RuntimeError
+
+if test2() != " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_":
+ raise RuntimeError
+
+if test3("hello") != "hello-suffix":
+ print test3("hello")
+ raise RuntimeError
+
+if test4("hello") != "hello-suffix":
+ print test4("hello")
+ raise RuntimeError
+
+if test5(4) != 'xxxx':
+ raise RuntimeError
+
+if test6(10) != 'xxxxx':
+ raise RuntimeError
+
+if test7() !="Hello world!":
+ raise RuntimeError
+
+if test8() != " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_":
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/li_cwstring_runme.py b/trunk/Examples/test-suite/python/li_cwstring_runme.py
new file mode 100644
index 000000000..4ab590882
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_cwstring_runme.py
@@ -0,0 +1,29 @@
+from li_cwstring import *
+
+if count(u"ab\0ab\0ab\0", 0) != 3:
+ raise RuntimeError
+
+if test1() != u"Hello World":
+ raise RuntimeError
+
+if test2() != u" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_":
+ raise RuntimeError
+
+if test3("hello") != u"hello-suffix":
+ raise RuntimeError
+
+if test4("hello") != u"hello-suffix":
+ raise RuntimeError
+
+if test5(4) != u'xxxx':
+ raise RuntimeError
+
+if test6(10) != u'xxxxx':
+ raise RuntimeError
+
+if test7() != u"Hello world!":
+ raise RuntimeError
+
+if test8() != u" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_":
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/li_factory_runme.py b/trunk/Examples/test-suite/python/li_factory_runme.py
new file mode 100644
index 000000000..fb2c81e45
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_factory_runme.py
@@ -0,0 +1,11 @@
+from li_factory import *
+
+circle = Geometry_create(Geometry.CIRCLE)
+r = circle.radius()
+if (r != 1.5):
+ raise RuntimeError
+
+point = Geometry_create(Geometry.POINT)
+w = point.width()
+if (w != 1.0):
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/li_implicit_runme.py b/trunk/Examples/test-suite/python/li_implicit_runme.py
new file mode 100644
index 000000000..a0672e016
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_implicit_runme.py
@@ -0,0 +1,17 @@
+from li_implicit import *
+b = B()
+ai = A(1)
+ad = A(2.0)
+ab = A(b)
+
+ai, get(ai)
+ad, get(ad)
+ab, get(ab)
+
+if get(ai) != get(1):
+ raise RuntimeError,"bad implicit type"
+if get(ad) != get(2.0):
+ raise RuntimeError,"bad implicit type"
+if get(ab) != get(b):
+ raise RuntimeError,"bad implicit type"
+
diff --git a/trunk/Examples/test-suite/python/li_std_carray_runme.py b/trunk/Examples/test-suite/python/li_std_carray_runme.py
new file mode 100644
index 000000000..803bc96c5
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_std_carray_runme.py
@@ -0,0 +1,41 @@
+from li_std_carray import *
+
+
+v3 = Vector3()
+for i in range(0,len(v3)):
+ v3[i] = i
+
+i = 0
+for d in v3:
+ if d != i:
+ raise RuntimeError
+ i = i + 1
+
+
+m3 = Matrix3()
+
+for i in range(0,len(m3)):
+ v3 = m3[i]
+ 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 = j + 1
+ pass
+ i = 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
+
+da = Vector3((1,2,3))
+ma = Matrix3(((1,2,3),(4,5,6),(7,8,9)))
+
+
diff --git a/trunk/Examples/test-suite/python/li_std_map_runme.py b/trunk/Examples/test-suite/python/li_std_map_runme.py
new file mode 100644
index 000000000..ae75bdda0
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_std_map_runme.py
@@ -0,0 +1,58 @@
+import li_std_map
+
+a1 = li_std_map.A(3)
+a2 = li_std_map.A(7)
+
+
+p0 = li_std_map.pairii(1,2)
+p1 = li_std_map.pairA(1,a1.this)
+m = {}
+m[1] = a1
+m[2] = a2
+
+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
+
+
+pm ={}
+for k in m:
+ pm[k] = m[k]
+
+for k in m:
+ if pm[k].this != m[k].this:
+ print pm[k], m[k]
+ raise RuntimeError
+
+
+
+
+
+m = {}
+m[1] = (1,2)
+m["foo"] = "hello"
+
+pm = li_std_map.pymap()
+
+for k in m:
+ pm[k] = m[k]
+
+for k in pm:
+ if (pm[k] != m[k]):
+ raise RuntimeError
+
+
+
+mii = li_std_map.IntIntMap()
+
+mii[1] = 1
+mii[1] = 2
+
+if mii[1] != 2:
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/li_std_pair_extra_runme.py b/trunk/Examples/test-suite/python/li_std_pair_extra_runme.py
new file mode 100644
index 000000000..dc6e31b76
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_std_pair_extra_runme.py
@@ -0,0 +1,59 @@
+import li_std_pair_extra
+
+p = (1,2)
+p1 = li_std_pair_extra.p_inout(p)
+p2 = li_std_pair_extra.p_inoutd(p1)
+
+d1 = li_std_pair_extra.d_inout(2)
+
+i,d2 = li_std_pair_extra.d_inout2(2)
+
+i,p = li_std_pair_extra.p_inout2(p)
+p3,p4 = li_std_pair_extra.p_inout3(p1,p1)
+
+psi = li_std_pair_extra.SIPair("hello",1)
+pci = li_std_pair_extra.CIPair(1,1)
+
+
+#psi.first = "hi"
+
+
+psi = li_std_pair_extra.SIPair("hi",1)
+if psi != ("hi",1):
+ raise RuntimeError
+
+psii = li_std_pair_extra.SIIPair(psi,1)
+
+a = li_std_pair_extra.A()
+b = li_std_pair_extra.B()
+
+pab = li_std_pair_extra.ABPair(a,b);
+
+pab.first = a
+pab.first.val = 2
+
+if pab.first.val != 2:
+ raise RuntimeError
+
+
+pci = li_std_pair_extra.CIntPair(1,0)
+
+a = li_std_pair_extra.A(5)
+p1 = li_std_pair_extra.pairP1(1,a.this)
+p2 = li_std_pair_extra.pairP2(a,1)
+p3 = li_std_pair_extra.pairP3(a,a)
+
+
+if a.val != li_std_pair_extra.p_identa(p1.this)[1].val:
+ raise RuntimeError
+
+p = li_std_pair_extra.IntPair(1,10)
+p.first = 1
+
+p = li_std_pair_extra.paircA1(1,a)
+p.first
+p.second
+
+p = li_std_pair_extra.paircA2(1,a)
+pp = li_std_pair_extra.pairiiA(1,p)
+
diff --git a/trunk/Examples/test-suite/python/li_std_set_runme.py b/trunk/Examples/test-suite/python/li_std_set_runme.py
new file mode 100644
index 000000000..6d8963138
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_std_set_runme.py
@@ -0,0 +1,96 @@
+from li_std_set import *
+
+s = set_string()
+
+s.append("a")
+s.append("b")
+s.append("c")
+
+sum = ""
+for i in s:
+ sum = 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 = sum + b.next()
+if sum != "abc":
+ raise RuntimeError
+
+b = s.rbegin()
+e = s.rend()
+sum = ""
+while (b != e):
+ sum = 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 = 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
+
+
+
+s = pyset()
+s.insert((1,2))
+s.insert(1)
+s.insert("hello")
+
+
+sum = ()
+for i in s:
+ sum = sum + (i,)
+
+if sum != (1, 'hello', (1, 2)):
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/li_std_stream_runme.py b/trunk/Examples/test-suite/python/li_std_stream_runme.py
new file mode 100644
index 000000000..d41e41f4a
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_std_stream_runme.py
@@ -0,0 +1,14 @@
+from li_std_stream import *
+
+
+
+a = A()
+
+o = ostringstream()
+
+o << a << " " << 2345 << " " << 1.435
+
+
+if o.str() != "A class 2345 1.435":
+ print "\"%s\"" % (o.str(),)
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/li_std_string_extra_runme.py b/trunk/Examples/test-suite/python/li_std_string_extra_runme.py
new file mode 100644
index 000000000..cef5921b0
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_std_string_extra_runme.py
@@ -0,0 +1,132 @@
+import li_std_string_extra
+
+x="hello"
+
+
+
+if li_std_string_extra.test_ccvalue(x) != x:
+ raise RuntimeError, "bad string mapping"
+
+if li_std_string_extra.test_cvalue(x) != x:
+ raise RuntimeError, "bad string mapping"
+
+if li_std_string_extra.test_value(x) != x:
+ print x, li_std_string_extra.test_value(x)
+ raise RuntimeError, "bad string mapping"
+
+if li_std_string_extra.test_const_reference(x) != x:
+ raise RuntimeError, "bad string mapping"
+
+
+s = li_std_string_extra.string("he")
+#s += "ll"
+#s.append('o')
+s = s + "llo"
+
+if s != x:
+ print s, x
+ raise RuntimeError, "bad string mapping"
+
+if s[1:4] != x[1:4]:
+ raise RuntimeError, "bad string mapping"
+
+if li_std_string_extra.test_value(s) != x:
+ raise RuntimeError, "bad string mapping"
+
+if li_std_string_extra.test_const_reference(s) != x:
+ raise RuntimeError, "bad string mapping"
+
+a = li_std_string_extra.A(s)
+
+if li_std_string_extra.test_value(a) != x:
+ raise RuntimeError, "bad string mapping"
+
+if li_std_string_extra.test_const_reference(a) != x:
+ raise RuntimeError, "bad string mapping"
+
+b = li_std_string_extra.string(" world")
+
+s = a + b
+if a + b != "hello world":
+ print a + b
+ raise RuntimeError, "bad string mapping"
+
+if a + " world" != "hello world":
+ raise RuntimeError, "bad string mapping"
+
+if "hello" + b != "hello world":
+ raise RuntimeError, "bad string mapping"
+
+c = "hello" + b
+if c.find_last_of("l") != 9:
+ raise RuntimeError, "bad string mapping"
+
+s = "hello world"
+
+b = li_std_string_extra.B("hi")
+
+b.name = li_std_string_extra.string("hello")
+if b.name != "hello":
+ raise RuntimeError, "bad string mapping"
+
+
+b.a = li_std_string_extra.A("hello")
+if b.a != "hello":
+ raise RuntimeError, "bad string mapping"
+
+
+if li_std_string_extra.test_value_basic1(x) != x:
+ raise RuntimeError, "bad string mapping"
+
+if li_std_string_extra.test_value_basic2(x) != x:
+ raise RuntimeError, "bad string mapping"
+
+
+if li_std_string_extra.test_value_basic3(x) != x:
+ raise RuntimeError, "bad string mapping"
+
+# Global variables
+s = "initial string"
+if li_std_string_extra.cvar.GlobalString2 != "global string 2":
+ raise RuntimeError, "GlobalString2 test 1"
+li_std_string_extra.cvar.GlobalString2 = s
+if li_std_string_extra.cvar.GlobalString2 != s:
+ raise RuntimeError, "GlobalString2 test 2"
+if li_std_string_extra.cvar.ConstGlobalString != "const global string":
+ raise RuntimeError, "ConstGlobalString test"
+
+# Member variables
+myStructure = li_std_string_extra.Structure()
+if myStructure.MemberString2 != "member string 2":
+ raise RuntimeError, "MemberString2 test 1"
+myStructure.MemberString2 = s
+if myStructure.MemberString2 != s:
+ raise RuntimeError, "MemberString2 test 2"
+if myStructure.ConstMemberString != "const member string":
+ raise RuntimeError, "ConstMemberString test"
+
+if li_std_string_extra.cvar.Structure_StaticMemberString2 != "static member string 2":
+ raise RuntimeError, "StaticMemberString2 test 1"
+li_std_string_extra.cvar.Structure_StaticMemberString2 = s
+if li_std_string_extra.cvar.Structure_StaticMemberString2 != s:
+ raise RuntimeError, "StaticMemberString2 test 2"
+if li_std_string_extra.cvar.Structure_ConstStaticMemberString != "const static member string":
+ raise RuntimeError, "ConstStaticMemberString test"
+
+
+if li_std_string_extra.test_reference_input("hello") != "hello":
+ raise RuntimeError
+s = li_std_string_extra.test_reference_inout("hello")
+if s != "hellohello":
+ raise RuntimeError
+
+
+if li_std_string_extra.stdstring_empty() != "":
+ raise RuntimeError
+
+
+if li_std_string_extra.c_empty() != "":
+ raise RuntimeError
+
+if li_std_string_extra.c_null() != None:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/li_std_vector_extra_runme.py b/trunk/Examples/test-suite/python/li_std_vector_extra_runme.py
new file mode 100644
index 000000000..8900d7298
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_std_vector_extra_runme.py
@@ -0,0 +1,176 @@
+from li_std_vector_extra import *
+
+iv = IntVector(4)
+for i in range(0,4):
+ iv[i] = i
+
+x = average(iv)
+y = average([1,2,3,4])
+
+a = half([10,10.5,11,11.5])
+
+dv = DoubleVector(10)
+for i in range(0,10):
+ dv[i] = i/2.0
+
+halve_in_place(dv)
+
+
+bv = BoolVector(4)
+bv[0]= 1
+bv[1]= 0
+bv[2]= 4
+bv[3]= 0
+
+if bv[0] != bv[2]:
+ raise RuntimeError,"bad std::vector<bool> mapping"
+
+b = B(5)
+va = VecA([b,None,b,b])
+
+if va[0].f(1) != 6:
+ raise RuntimeError,"bad std::vector<A*> mapping"
+
+if vecAptr(va) != 6:
+ raise RuntimeError,"bad std::vector<A*> mapping"
+
+b.val = 7
+if va[3].f(1) != 8:
+ raise RuntimeError,"bad std::vector<A*> mapping"
+
+
+ip = PtrInt()
+ap = new_ArrInt(10)
+
+ArrInt_setitem(ip,0,123)
+ArrInt_setitem(ap,2,123)
+
+vi = IntPtrVector((ip,ap,None))
+if ArrInt_getitem(vi[0],0) != ArrInt_getitem(vi[1],2):
+ raise RuntimeError,"bad std::vector<int*> mapping"
+
+delete_ArrInt(ap)
+
+
+a = halfs([10,8,4,3])
+
+v = IntVector()
+v[0:2] = [1,2]
+if v[0] != 1 or v[1] != 2:
+ raise RuntimeError,"bad setslice"
+
+if v[0:-1][0] != 1:
+ raise RuntimeError,"bad getslice"
+
+if v[0:-2].size() != 0:
+ raise RuntimeError,"bad getslice"
+
+v[0:1] = [2]
+if v[0] != 2:
+ raise RuntimeError,"bad setslice"
+
+v[1:] = [3]
+if v[1] != 3:
+ raise RuntimeError,"bad setslice"
+
+v[2:] = [3]
+if v[2] != 3:
+ raise RuntimeError,"bad setslice"
+
+if v[0:][0] != v[0]:
+ raise RuntimeError,"bad getslice"
+
+
+del v[:]
+if v.size() != 0:
+ raise RuntimeError,"bad getslice"
+
+del v[:]
+if v.size() != 0:
+ raise RuntimeError,"bad getslice"
+
+
+
+v = vecStr(["hello ", "world"])
+if v[0] != 'hello world':
+ raise RuntimeError,"bad std::string+std::vector"
+
+
+
+pv = pyvector([1, "hello", (1,2)])
+
+if pv[1] != "hello":
+ raise RuntimeError
+
+
+iv = IntVector(5)
+for i in range(0,5):
+ iv[i] = i
+
+iv[1:3] = []
+if iv[1] != 3:
+ raise RuntimeError
+
+# Overloading checks
+if overloaded1(iv) != "vector<int>":
+ raise RuntimeError
+
+if overloaded1(dv) != "vector<double>":
+ raise RuntimeError
+
+if overloaded2(iv) != "vector<int>":
+ raise RuntimeError
+
+if overloaded2(dv) != "vector<double>":
+ raise RuntimeError
+
+if overloaded3(iv) != "vector<int> *":
+ raise RuntimeError
+
+if overloaded3(None) != "vector<int> *":
+ raise RuntimeError
+
+if overloaded3(100) != "int":
+ raise RuntimeError
+
+
+# vector pointer checks
+ip = makeIntPtr(11)
+dp = makeDoublePtr(33.3)
+error = 0
+try:
+ vi = IntPtrVector((ip, dp)) # check vector<int *> does not accept double * element
+ error = 1
+except:
+ pass
+
+if error:
+ raise RuntimeError
+
+vi = IntPtrVector((ip, makeIntPtr(22)))
+if extractInt(vi[0]) != 11:
+ raise RuntimeError
+
+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
+
diff --git a/trunk/Examples/test-suite/python/li_std_vector_ptr_runme.py b/trunk/Examples/test-suite/python/li_std_vector_ptr_runme.py
new file mode 100644
index 000000000..c5f72fde4
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_std_vector_ptr_runme.py
@@ -0,0 +1,8 @@
+from li_std_vector_ptr import *
+
+ip1 = makeIntPtr(11)
+ip2 = makeIntPtr(22)
+
+vi = IntPtrVector((ip1, ip2))
+displayVector(vi)
+
diff --git a/trunk/Examples/test-suite/python/li_std_wstream_runme.py b/trunk/Examples/test-suite/python/li_std_wstream_runme.py
new file mode 100644
index 000000000..f7379bdf8
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_std_wstream_runme.py
@@ -0,0 +1,13 @@
+from li_std_wstream import *
+
+
+
+a = A()
+
+o = wostringstream()
+
+o << a << u" " << 2345 << u" " << 1.435 << wends
+
+if o.str() != "A class 2345 1.435\0":
+ print "\"%s\"" % (o.str(),)
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/li_std_wstring_runme.py b/trunk/Examples/test-suite/python/li_std_wstring_runme.py
new file mode 100644
index 000000000..a4b9d3ee2
--- /dev/null
+++ b/trunk/Examples/test-suite/python/li_std_wstring_runme.py
@@ -0,0 +1,76 @@
+import li_std_wstring
+
+x=u"h"
+
+if li_std_wstring.test_wcvalue(x) != x:
+ print li_std_wstring.test_wcvalue(x)
+ raise RuntimeError, "bad string mapping"
+
+x=u"hello"
+if li_std_wstring.test_ccvalue(x) != x:
+ raise RuntimeError, "bad string mapping"
+
+if li_std_wstring.test_cvalue(x) != x:
+ raise RuntimeError, "bad string mapping"
+
+if li_std_wstring.test_value(x) != x:
+ print x, li_std_wstring.test_value(x)
+ raise RuntimeError, "bad string mapping"
+
+if li_std_wstring.test_const_reference(x) != x:
+ raise RuntimeError, "bad string mapping"
+
+
+s = li_std_wstring.wstring(u"he")
+s = s + u"llo"
+
+if s != x:
+ print s, x
+ raise RuntimeError, "bad string mapping"
+
+if s[1:4] != x[1:4]:
+ raise RuntimeError, "bad string mapping"
+
+if li_std_wstring.test_value(s) != x:
+ raise RuntimeError, "bad string mapping"
+
+if li_std_wstring.test_const_reference(s) != x:
+ raise RuntimeError, "bad string mapping"
+
+a = li_std_wstring.A(s)
+
+if li_std_wstring.test_value(a) != x:
+ raise RuntimeError, "bad string mapping"
+
+if li_std_wstring.test_const_reference(a) != x:
+ raise RuntimeError, "bad string mapping"
+
+b = li_std_wstring.wstring(" world")
+
+if a + b != "hello world":
+ raise RuntimeError, "bad string mapping"
+
+if a + " world" != "hello world":
+ raise RuntimeError, "bad string mapping"
+
+if "hello" + b != "hello world":
+ raise RuntimeError, "bad string mapping"
+
+c = "hello" + b
+if c.find_last_of("l") != 9:
+ raise RuntimeError, "bad string mapping"
+
+s = "hello world"
+
+b = li_std_wstring.B("hi")
+
+b.name = li_std_wstring.wstring(u"hello")
+if b.name != "hello":
+ raise RuntimeError, "bad string mapping"
+
+
+b.a = li_std_wstring.A("hello")
+if b.a != u"hello":
+ raise RuntimeError, "bad string mapping"
+
+
diff --git a/trunk/Examples/test-suite/python/member_pointer_runme.py b/trunk/Examples/test-suite/python/member_pointer_runme.py
new file mode 100644
index 000000000..27e7a483d
--- /dev/null
+++ b/trunk/Examples/test-suite/python/member_pointer_runme.py
@@ -0,0 +1,43 @@
+# Example using pointers to member functions
+
+from member_pointer import *
+
+def check(what, expected, actual):
+ if expected != actual:
+ raise RuntimeError ("Failed: " , what , " Expected: " , expected , " Actual: " , actual)
+
+# Get the pointers
+
+area_pt = areapt()
+perim_pt = perimeterpt()
+
+# Create some objects
+
+s = Square(10)
+
+# Do some calculations
+
+check ("Square area ", 100.0, do_op(s,area_pt))
+check ("Square perim", 40.0, do_op(s,perim_pt))
+
+memberPtr = cvar.areavar
+memberPtr = cvar.perimetervar
+
+# Try the variables
+check ("Square area ", 100.0, do_op(s,cvar.areavar))
+check ("Square perim", 40.0, do_op(s,cvar.perimetervar))
+
+# Modify one of the variables
+cvar.areavar = perim_pt
+
+check ("Square perimeter", 40.0, do_op(s,cvar.areavar))
+
+# Try the constants
+
+memberPtr = AREAPT
+memberPtr = PERIMPT
+memberPtr = NULLPT
+
+check ("Square area ", 100.0, do_op(s,AREAPT))
+check ("Square perim", 40.0, do_op(s,PERIMPT))
+
diff --git a/trunk/Examples/test-suite/python/memberin_extend_c_runme.py b/trunk/Examples/test-suite/python/memberin_extend_c_runme.py
new file mode 100644
index 000000000..314761f89
--- /dev/null
+++ b/trunk/Examples/test-suite/python/memberin_extend_c_runme.py
@@ -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")
diff --git a/trunk/Examples/test-suite/python/minherit_runme.py b/trunk/Examples/test-suite/python/minherit_runme.py
new file mode 100644
index 000000000..d7ad0b36b
--- /dev/null
+++ b/trunk/Examples/test-suite/python/minherit_runme.py
@@ -0,0 +1,71 @@
+
+import minherit
+
+a = minherit.Foo()
+b = minherit.Bar()
+c = minherit.FooBar()
+d = minherit.Spam()
+
+if a.xget() != 1:
+ raise RuntimeError, "Bad attribute value"
+
+if b.yget() != 2:
+ raise RuntimeError, "Bad attribute value"
+
+if c.xget() != 1 or c.yget() != 2 or c.zget() != 3:
+ raise RuntimeError, "Bad attribute value"
+
+if d.xget() != 1 or d.yget() != 2 or d.zget() != 3 or d.wget() != 4:
+ raise RuntimeError, "Bad attribute value"
+
+
+if minherit.xget(a) != 1:
+ raise RuntimeError, "Bad attribute value %d" % (minherit.xget(a))
+
+if minherit.yget(b) != 2:
+ raise RuntimeError, "Bad attribute value %d" % (minherit.yget(b))
+
+if minherit.xget(c) != 1 or minherit.yget(c) != 2 or minherit.zget(c) != 3:
+ raise RuntimeError, "Bad attribute value %d %d %d" % (minherit.xget(c), minherit.yget(c), minherit.zget(c))
+
+if minherit.xget(d) != 1 or minherit.yget(d) != 2 or minherit.zget(d) != 3 or minherit.wget(d) != 4:
+ raise RuntimeError, "Bad attribute value %d %d %d %d" % (minherit.xget(d), minherit.yget(d), minherit.zget(d), minherit.wget(d))
+
+# Cleanse all of the pointers and see what happens
+
+aa = minherit.toFooPtr(a)
+bb = minherit.toBarPtr(b)
+cc = minherit.toFooBarPtr(c)
+dd = minherit.toSpamPtr(d)
+
+if aa.xget() != 1:
+ raise RuntimeError, "Bad attribute value"
+
+if bb.yget() != 2:
+ raise RuntimeError, "Bad attribute value"
+
+if cc.xget() != 1 or cc.yget() != 2 or cc.zget() != 3:
+ raise RuntimeError, "Bad attribute value"
+
+if dd.xget() != 1 or dd.yget() != 2 or dd.zget() != 3 or dd.wget() != 4:
+ raise RuntimeError, "Bad attribute value"
+
+if minherit.xget(aa) != 1:
+ raise RuntimeError, "Bad attribute value %d" % (minherit.xget(aa))
+
+if minherit.yget(bb) != 2:
+ raise RuntimeError, "Bad attribute value %d" % (minherit.yget(bb))
+
+if minherit.xget(cc) != 1 or minherit.yget(cc) != 2 or minherit.zget(cc) != 3:
+ raise RuntimeError, "Bad attribute value %d %d %d" % (minherit.xget(cc), minherit.yget(cc), minherit.zget(cc))
+
+if minherit.xget(dd) != 1 or minherit.yget(dd) != 2 or minherit.zget(dd) != 3 or minherit.wget(dd) != 4:
+ raise RuntimeError, "Bad attribute value %d %d %d %d" % (minherit.xget(dd), minherit.yget(dd), minherit.zget(dd), minherit.wget(dd))
+
+
+
+
+
+
+
+
diff --git a/trunk/Examples/test-suite/python/mod_runme.py b/trunk/Examples/test-suite/python/mod_runme.py
new file mode 100644
index 000000000..d92611991
--- /dev/null
+++ b/trunk/Examples/test-suite/python/mod_runme.py
@@ -0,0 +1,6 @@
+import mod_a
+import mod_b
+
+c = mod_b.C()
+d = mod_b.D()
+d.DoSomething(c)
diff --git a/trunk/Examples/test-suite/python/multi_import_runme.py b/trunk/Examples/test-suite/python/multi_import_runme.py
new file mode 100644
index 000000000..f8a2f19c7
--- /dev/null
+++ b/trunk/Examples/test-suite/python/multi_import_runme.py
@@ -0,0 +1,18 @@
+import multi_import_a
+import multi_import_b
+
+x = multi_import_b.XXX()
+if x.testx() != 0:
+ raise RuntimeError
+
+y = multi_import_b.YYY()
+if y.testx() != 0:
+ raise RuntimeError
+if y.testy() != 1:
+ raise RuntimeError
+
+z = multi_import_a.ZZZ()
+if z.testx() != 0:
+ raise RuntimeError
+if z.testz() != 2:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/namespace_class_runme.py b/trunk/Examples/test-suite/python/namespace_class_runme.py
new file mode 100644
index 000000000..84d3b00ed
--- /dev/null
+++ b/trunk/Examples/test-suite/python/namespace_class_runme.py
@@ -0,0 +1,34 @@
+from namespace_class import *
+
+try:
+ p = Private1()
+ error = 1
+except:
+ error = 0
+
+if (error):
+ raise RuntimeError, "Private1 is private"
+
+try:
+ p = Private2()
+ error = 1
+except:
+ error = 0
+
+if (error):
+ raise RuntimeError, "Private2 is private"
+
+EulerT3D.toFrame(1,1,1)
+
+b = BooT_i()
+b = BooT_H()
+
+
+f = FooT_i()
+f.quack(1)
+
+f = FooT_d()
+f.moo(1)
+
+f = FooT_H()
+f.foo(Hi)
diff --git a/trunk/Examples/test-suite/python/namespace_typemap_runme.py b/trunk/Examples/test-suite/python/namespace_typemap_runme.py
new file mode 100644
index 000000000..682ad3bb1
--- /dev/null
+++ b/trunk/Examples/test-suite/python/namespace_typemap_runme.py
@@ -0,0 +1,82 @@
+from namespace_typemap import *
+
+if stest1("hello") != "hello":
+ raise RuntimeError
+
+if stest2("hello") != "hello":
+ raise RuntimeError
+
+if stest3("hello") != "hello":
+ raise RuntimeError
+
+if stest4("hello") != "hello":
+ raise RuntimeError
+
+if stest5("hello") != "hello":
+ raise RuntimeError
+
+if stest6("hello") != "hello":
+ raise RuntimeError
+
+if stest7("hello") != "hello":
+ raise RuntimeError
+
+if stest8("hello") != "hello":
+ raise RuntimeError
+
+if stest9("hello") != "hello":
+ raise RuntimeError
+
+if stest10("hello") != "hello":
+ raise RuntimeError
+
+if stest11("hello") != "hello":
+ raise RuntimeError
+
+if stest12("hello") != "hello":
+ raise RuntimeError
+
+c = complex(2,3)
+r = c.real
+
+if ctest1(c) != r:
+ raise RuntimeError
+
+if ctest2(c) != r:
+ raise RuntimeError
+
+if ctest3(c) != r:
+ raise RuntimeError
+
+if ctest4(c) != r:
+ raise RuntimeError
+
+if ctest5(c) != r:
+ raise RuntimeError
+
+if ctest6(c) != r:
+ raise RuntimeError
+
+if ctest7(c) != r:
+ raise RuntimeError
+
+if ctest8(c) != r:
+ raise RuntimeError
+
+if ctest9(c) != r:
+ raise RuntimeError
+
+if ctest10(c) != r:
+ raise RuntimeError
+
+if ctest11(c) != r:
+ raise RuntimeError
+
+if ctest12(c) != r:
+ raise RuntimeError
+
+try:
+ ttest1(-14)
+ raise RuntimeError
+except ValueError:
+ pass
diff --git a/trunk/Examples/test-suite/python/namespace_virtual_method_runme.py b/trunk/Examples/test-suite/python/namespace_virtual_method_runme.py
new file mode 100644
index 000000000..c3580fbc5
--- /dev/null
+++ b/trunk/Examples/test-suite/python/namespace_virtual_method_runme.py
@@ -0,0 +1,3 @@
+import namespace_virtual_method
+
+x = namespace_virtual_method.Spam()
diff --git a/trunk/Examples/test-suite/python/naturalvar_runme.py b/trunk/Examples/test-suite/python/naturalvar_runme.py
new file mode 100644
index 000000000..a0481ec60
--- /dev/null
+++ b/trunk/Examples/test-suite/python/naturalvar_runme.py
@@ -0,0 +1,12 @@
+from naturalvar import *
+
+f = Foo()
+b = Bar()
+
+b.f = f
+
+cvar.s = "hello"
+b.s = "hello"
+
+if b.s != cvar.s:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/nested_workaround_runme.py b/trunk/Examples/test-suite/python/nested_workaround_runme.py
new file mode 100644
index 000000000..a8a75d370
--- /dev/null
+++ b/trunk/Examples/test-suite/python/nested_workaround_runme.py
@@ -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
diff --git a/trunk/Examples/test-suite/python/operbool_runme.py b/trunk/Examples/test-suite/python/operbool_runme.py
new file mode 100644
index 000000000..4218b5dd4
--- /dev/null
+++ b/trunk/Examples/test-suite/python/operbool_runme.py
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+import operbool
+assert not operbool.Test()
+
diff --git a/trunk/Examples/test-suite/python/overload_complicated_runme.py b/trunk/Examples/test-suite/python/overload_complicated_runme.py
new file mode 100755
index 000000000..2b7467d4d
--- /dev/null
+++ b/trunk/Examples/test-suite/python/overload_complicated_runme.py
@@ -0,0 +1,47 @@
+from overload_complicated import *
+
+pInt = None
+
+# Check the correct constructors are available
+p = Pop(pInt)
+
+p = Pop(pInt, 0)
+
+# Check overloaded in const only and pointers/references which target languages cannot disambiguate
+if p.hip(0) != 701:
+ raise RuntimeError,"Test 1 failed"
+
+if p.hip(pInt) != 702:
+ raise RuntimeError,"Test 2 failed"
+
+# Reverse the order for the above
+if p.hop(pInt) != 805:
+ raise RuntimeError,"Test 3 failed"
+
+if p.hop(0) != 801:
+ raise RuntimeError,"Test 4 failed"
+
+# Few more variations and order shuffled
+if p.pop(0) != 901:
+ raise RuntimeError,"Test 5 failed"
+
+if p.pop(pInt) != 902:
+ raise RuntimeError,"Test 6 failed"
+
+if p.pop() != 905:
+ raise RuntimeError,"Test 7 failed"
+
+# Overload on const only
+if p.bop(pInt) != 1001:
+ raise RuntimeError,"Test 8 failed"
+
+if p.bip(pInt) != 2001:
+ raise RuntimeError,"Test 9 failed"
+
+# Globals
+if muzak(0) != 3001:
+ raise RuntimeError,"Test 10 failed"
+
+if muzak(pInt) != 3002:
+ raise RuntimeError,"Test 11 failed"
+
diff --git a/trunk/Examples/test-suite/python/overload_copy_runme.py b/trunk/Examples/test-suite/python/overload_copy_runme.py
new file mode 100644
index 000000000..6ccf4013e
--- /dev/null
+++ b/trunk/Examples/test-suite/python/overload_copy_runme.py
@@ -0,0 +1,3 @@
+from overload_copy import *
+f = Foo()
+g = Foo(f)
diff --git a/trunk/Examples/test-suite/python/overload_extend_runme.py b/trunk/Examples/test-suite/python/overload_extend_runme.py
new file mode 100644
index 000000000..7d08d482b
--- /dev/null
+++ b/trunk/Examples/test-suite/python/overload_extend_runme.py
@@ -0,0 +1,14 @@
+import overload_extend
+
+f = overload_extend.Foo()
+if f.test() != 0:
+ raise RuntimeError
+if f.test(3) != 1:
+ raise RuntimeError
+if f.test("hello") != 2:
+ raise RuntimeError
+if f.test(3,2) != 5:
+ raise RuntimeError
+if f.test(3.0) != 1003:
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/overload_extendc_runme.py b/trunk/Examples/test-suite/python/overload_extendc_runme.py
new file mode 100644
index 000000000..cea3ea618
--- /dev/null
+++ b/trunk/Examples/test-suite/python/overload_extendc_runme.py
@@ -0,0 +1,22 @@
+import overload_extendc
+
+f = overload_extendc.Foo()
+if f.test(3) != 1:
+ raise RuntimeError
+if f.test("hello") != 2:
+ raise RuntimeError
+if f.test(3.5,2.5) != 3:
+ raise RuntimeError
+if f.test("hello",20) != 1020:
+ raise RuntimeError
+if f.test("hello",20,100) != 120:
+ raise RuntimeError
+
+# C default args
+if f.test(f) != 30:
+ raise RuntimeError
+if f.test(f,100) != 120:
+ raise RuntimeError
+if f.test(f,100,200) != 300:
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/overload_rename_runme.py b/trunk/Examples/test-suite/python/overload_rename_runme.py
new file mode 100644
index 000000000..b192f7d5d
--- /dev/null
+++ b/trunk/Examples/test-suite/python/overload_rename_runme.py
@@ -0,0 +1,8 @@
+import overload_rename
+
+
+f = overload_rename.Foo(1)
+f = overload_rename.Foo(1,1)
+f = overload_rename.Foo_int(1,1)
+f = overload_rename.Foo_int(1,1,1)
+
diff --git a/trunk/Examples/test-suite/python/overload_simple_runme.py b/trunk/Examples/test-suite/python/overload_simple_runme.py
new file mode 100644
index 000000000..a78f3720a
--- /dev/null
+++ b/trunk/Examples/test-suite/python/overload_simple_runme.py
@@ -0,0 +1,102 @@
+from overload_simple import *
+
+if foo(3) != "foo:int":
+ raise RuntimeError, "foo(int)"
+
+if foo(3.0) != "foo:double":
+ raise RuntimeError, "foo(double)"
+
+if foo("hello") != "foo:char *":
+ raise RuntimeError, "foo(char *)"
+
+f = Foo()
+b = Bar()
+
+if foo(f) != "foo:Foo *":
+ raise RuntimeError, "foo(Foo *)"
+
+if foo(b) != "foo:Bar *":
+ raise RuntimeError, "foo(Bar *)"
+
+v = malloc_void(32)
+
+if foo(v) != "foo:void *":
+ raise RuntimeError, "foo(void *)"
+
+s = Spam()
+
+if s.foo(3) != "foo:int":
+ raise RuntimeError, "Spam::foo(int)"
+
+if s.foo(3.0) != "foo:double":
+ raise RuntimeError, "Spam::foo(double)"
+
+if s.foo("hello") != "foo:char *":
+ raise RuntimeError, "Spam::foo(char *)"
+
+if s.foo(f) != "foo:Foo *":
+ raise RuntimeError, "Spam::foo(Foo *)"
+
+if s.foo(b) != "foo:Bar *":
+ raise RuntimeError, "Spam::foo(Bar *)"
+
+if s.foo(v) != "foo:void *":
+ raise RuntimeError, "Spam::foo(void *)"
+
+if Spam_bar(3) != "bar:int":
+ raise RuntimeError, "Spam::bar(int)"
+
+if Spam_bar(3.0) != "bar:double":
+ raise RuntimeError, "Spam::bar(double)"
+
+if Spam_bar("hello") != "bar:char *":
+ raise RuntimeError, "Spam::bar(char *)"
+
+if Spam_bar(f) != "bar:Foo *":
+ raise RuntimeError, "Spam::bar(Foo *)"
+
+if Spam_bar(b) != "bar:Bar *":
+ raise RuntimeError, "Spam::bar(Bar *)"
+
+if Spam_bar(v) != "bar:void *":
+ raise RuntimeError, "Spam::bar(void *)"
+
+# Test constructors
+
+s = Spam()
+if s.type != "none":
+ raise RuntimeError, "Spam()"
+
+s = Spam(3)
+if s.type != "int":
+ raise RuntimeError, "Spam(int)"
+
+s = Spam(3.4)
+if s.type != "double":
+ raise RuntimeError, "Spam(double)"
+
+s = Spam("hello")
+if s.type != "char *":
+ raise RuntimeError, "Spam(char *)"
+
+s = Spam(f)
+if s.type != "Foo *":
+ raise RuntimeError, "Spam(Foo *)"
+
+s = Spam(b)
+if s.type != "Bar *":
+ raise RuntimeError, "Spam(Bar *)"
+
+s = Spam(v)
+if s.type != "void *":
+ raise RuntimeError, "Spam(void *)"
+
+
+
+
+
+free_void(v)
+
+
+a = ClassA()
+b = a.method1(1)
diff --git a/trunk/Examples/test-suite/python/overload_subtype_runme.py b/trunk/Examples/test-suite/python/overload_subtype_runme.py
new file mode 100644
index 000000000..6bf77dc59
--- /dev/null
+++ b/trunk/Examples/test-suite/python/overload_subtype_runme.py
@@ -0,0 +1,11 @@
+from overload_subtype import *
+
+f = Foo()
+b = Bar()
+
+if spam(f) != 1:
+ raise RuntimeError, "foo"
+
+if spam(b) != 2:
+ raise RuntimeError, "bar"
+
diff --git a/trunk/Examples/test-suite/python/overload_template_fast_runme.py b/trunk/Examples/test-suite/python/overload_template_fast_runme.py
new file mode 100644
index 000000000..d47f7d14d
--- /dev/null
+++ b/trunk/Examples/test-suite/python/overload_template_fast_runme.py
@@ -0,0 +1,145 @@
+from overload_template_fast import *
+f = foo()
+
+a = maximum(3,4)
+b = maximum(3.4,5.2)
+
+# mix 1
+if (mix1("hi") != 101):
+ raise RuntimeError, ("mix1(const char*)")
+
+if (mix1(1.0, 1.0) != 102):
+ raise RuntimeError, ("mix1(double, const double &)")
+
+if (mix1(1.0) != 103):
+ raise RuntimeError, ("mix1(double)")
+
+# mix 2
+if (mix2("hi") != 101):
+ raise RuntimeError, ("mix2(const char*)")
+
+if (mix2(1.0, 1.0) != 102):
+ raise RuntimeError, ("mix2(double, const double &)")
+
+if (mix2(1.0) != 103):
+ raise RuntimeError, ("mix2(double)")
+
+# mix 3
+if (mix3("hi") != 101):
+ raise RuntimeError, ("mix3(const char*)")
+
+if (mix3(1.0, 1.0) != 102):
+ raise RuntimeError, ("mix3(double, const double &)")
+
+if (mix3(1.0) != 103):
+ raise RuntimeError, ("mix3(double)")
+
+# Combination 1
+if (overtparams1(100) != 10):
+ raise RuntimeError, ("overtparams1(int)")
+
+if (overtparams1(100.0, 100) != 20):
+ raise RuntimeError, ("overtparams1(double, int)")
+
+# Combination 2
+if (overtparams2(100.0, 100) != 40):
+ raise RuntimeError, ("overtparams2(double, int)")
+
+# Combination 3
+if (overloaded() != 60):
+ raise RuntimeError, ("overloaded()")
+
+if (overloaded(100.0, 100) != 70):
+ raise RuntimeError, ("overloaded(double, int)")
+
+# Combination 4
+if (overloadedagain("hello") != 80):
+ raise RuntimeError, ("overloadedagain(const char *)")
+
+if (overloadedagain() != 90):
+ raise RuntimeError, ("overloadedagain(double)")
+
+# specializations
+if (specialization(10) != 202):
+ raise RuntimeError, ("specialization(int)")
+
+if (specialization(10.0) != 203):
+ raise RuntimeError, ("specialization(double)")
+
+if (specialization(10, 10) != 204):
+ raise RuntimeError, ("specialization(int, int)")
+
+if (specialization(10.0, 10.0) != 205):
+ raise RuntimeError, ("specialization(double, double)")
+
+if (specialization("hi", "hi") != 201):
+ raise RuntimeError, ("specialization(const char *, const char *)")
+
+
+# simple specialization
+xyz()
+xyz_int()
+xyz_double()
+
+# a bit of everything
+if (overload("hi") != 0):
+ raise RuntimeError, ("overload()")
+
+if (overload(1) != 10):
+ raise RuntimeError, ("overload(int t)")
+
+if (overload(1, 1) != 20):
+ raise RuntimeError, ("overload(int t, const int &)")
+
+if (overload(1, "hello") != 30):
+ raise RuntimeError, ("overload(int t, const char *)")
+
+k = Klass()
+if (overload(k) != 10):
+ raise RuntimeError, ("overload(Klass t)")
+
+if (overload(k, k) != 20):
+ raise RuntimeError, ("overload(Klass t, const Klass &)")
+
+if (overload(k, "hello") != 30):
+ raise RuntimeError, ("overload(Klass t, const char *)")
+
+if (overload(10.0, "hi") != 40):
+ raise RuntimeError, ("overload(double t, const char *)")
+
+if (overload() != 50):
+ raise RuntimeError, ("overload(const char *)")
+
+
+# everything put in a namespace
+if (nsoverload("hi") != 1000):
+ raise RuntimeError, ("nsoverload()")
+
+if (nsoverload(1) != 1010):
+ raise RuntimeError, ("nsoverload(int t)")
+
+if (nsoverload(1, 1) != 1020):
+ raise RuntimeError, ("nsoverload(int t, const int &)")
+
+if (nsoverload(1, "hello") != 1030):
+ raise RuntimeError, ("nsoverload(int t, const char *)")
+
+if (nsoverload(k) != 1010):
+ raise RuntimeError, ("nsoverload(Klass t)")
+
+if (nsoverload(k, k) != 1020):
+ raise RuntimeError, ("nsoverload(Klass t, const Klass &)")
+
+if (nsoverload(k, "hello") != 1030):
+ raise RuntimeError, ("nsoverload(Klass t, const char *)")
+
+if (nsoverload(10.0, "hi") != 1040):
+ raise RuntimeError, ("nsoverload(double t, const char *)")
+
+if (nsoverload() != 1050):
+ raise RuntimeError, ("nsoverload(const char *)")
+
+
+A.foo(1)
+b = B()
+b.foo(1)
diff --git a/trunk/Examples/test-suite/python/overload_template_runme.py b/trunk/Examples/test-suite/python/overload_template_runme.py
new file mode 100644
index 000000000..c1337ba6a
--- /dev/null
+++ b/trunk/Examples/test-suite/python/overload_template_runme.py
@@ -0,0 +1,145 @@
+from overload_template import *
+f = foo()
+
+a = maximum(3,4)
+b = maximum(3.4,5.2)
+
+# mix 1
+if (mix1("hi") != 101):
+ raise RuntimeError, ("mix1(const char*)")
+
+if (mix1(1.0, 1.0) != 102):
+ raise RuntimeError, ("mix1(double, const double &)")
+
+if (mix1(1.0) != 103):
+ raise RuntimeError, ("mix1(double)")
+
+# mix 2
+if (mix2("hi") != 101):
+ raise RuntimeError, ("mix2(const char*)")
+
+if (mix2(1.0, 1.0) != 102):
+ raise RuntimeError, ("mix2(double, const double &)")
+
+if (mix2(1.0) != 103):
+ raise RuntimeError, ("mix2(double)")
+
+# mix 3
+if (mix3("hi") != 101):
+ raise RuntimeError, ("mix3(const char*)")
+
+if (mix3(1.0, 1.0) != 102):
+ raise RuntimeError, ("mix3(double, const double &)")
+
+if (mix3(1.0) != 103):
+ raise RuntimeError, ("mix3(double)")
+
+# Combination 1
+if (overtparams1(100) != 10):
+ raise RuntimeError, ("overtparams1(int)")
+
+if (overtparams1(100.0, 100) != 20):
+ raise RuntimeError, ("overtparams1(double, int)")
+
+# Combination 2
+if (overtparams2(100.0, 100) != 40):
+ raise RuntimeError, ("overtparams2(double, int)")
+
+# Combination 3
+if (overloaded() != 60):
+ raise RuntimeError, ("overloaded()")
+
+if (overloaded(100.0, 100) != 70):
+ raise RuntimeError, ("overloaded(double, int)")
+
+# Combination 4
+if (overloadedagain("hello") != 80):
+ raise RuntimeError, ("overloadedagain(const char *)")
+
+if (overloadedagain() != 90):
+ raise RuntimeError, ("overloadedagain(double)")
+
+# specializations
+if (specialization(10) != 202):
+ raise RuntimeError, ("specialization(int)")
+
+if (specialization(10.0) != 203):
+ raise RuntimeError, ("specialization(double)")
+
+if (specialization(10, 10) != 204):
+ raise RuntimeError, ("specialization(int, int)")
+
+if (specialization(10.0, 10.0) != 205):
+ raise RuntimeError, ("specialization(double, double)")
+
+if (specialization("hi", "hi") != 201):
+ raise RuntimeError, ("specialization(const char *, const char *)")
+
+
+# simple specialization
+xyz()
+xyz_int()
+xyz_double()
+
+# a bit of everything
+if (overload("hi") != 0):
+ raise RuntimeError, ("overload()")
+
+if (overload(1) != 10):
+ raise RuntimeError, ("overload(int t)")
+
+if (overload(1, 1) != 20):
+ raise RuntimeError, ("overload(int t, const int &)")
+
+if (overload(1, "hello") != 30):
+ raise RuntimeError, ("overload(int t, const char *)")
+
+k = Klass()
+if (overload(k) != 10):
+ raise RuntimeError, ("overload(Klass t)")
+
+if (overload(k, k) != 20):
+ raise RuntimeError, ("overload(Klass t, const Klass &)")
+
+if (overload(k, "hello") != 30):
+ raise RuntimeError, ("overload(Klass t, const char *)")
+
+if (overload(10.0, "hi") != 40):
+ raise RuntimeError, ("overload(double t, const char *)")
+
+if (overload() != 50):
+ raise RuntimeError, ("overload(const char *)")
+
+
+# everything put in a namespace
+if (nsoverload("hi") != 1000):
+ raise RuntimeError, ("nsoverload()")
+
+if (nsoverload(1) != 1010):
+ raise RuntimeError, ("nsoverload(int t)")
+
+if (nsoverload(1, 1) != 1020):
+ raise RuntimeError, ("nsoverload(int t, const int &)")
+
+if (nsoverload(1, "hello") != 1030):
+ raise RuntimeError, ("nsoverload(int t, const char *)")
+
+if (nsoverload(k) != 1010):
+ raise RuntimeError, ("nsoverload(Klass t)")
+
+if (nsoverload(k, k) != 1020):
+ raise RuntimeError, ("nsoverload(Klass t, const Klass &)")
+
+if (nsoverload(k, "hello") != 1030):
+ raise RuntimeError, ("nsoverload(Klass t, const char *)")
+
+if (nsoverload(10.0, "hi") != 1040):
+ raise RuntimeError, ("nsoverload(double t, const char *)")
+
+if (nsoverload() != 1050):
+ raise RuntimeError, ("nsoverload(const char *)")
+
+
+A_foo(1)
+b = B()
+b.foo(1)
diff --git a/trunk/Examples/test-suite/python/preproc_runme.py b/trunk/Examples/test-suite/python/preproc_runme.py
new file mode 100644
index 000000000..c989294b6
--- /dev/null
+++ b/trunk/Examples/test-suite/python/preproc_runme.py
@@ -0,0 +1,14 @@
+import preproc
+
+if preproc.endif != 1:
+ raise RuntimeError
+
+if preproc.define != 1:
+ raise RuntimeError
+
+if preproc.defined != 1:
+ raise RuntimeError
+
+if 2*preproc.one != preproc.two:
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/primitive_ref_runme.py b/trunk/Examples/test-suite/python/primitive_ref_runme.py
new file mode 100644
index 000000000..7ce872a62
--- /dev/null
+++ b/trunk/Examples/test-suite/python/primitive_ref_runme.py
@@ -0,0 +1,40 @@
+from primitive_ref import *
+
+if ref_int(3) != 3:
+ raise RuntimeError
+
+if ref_uint(3) != 3:
+ raise RuntimeError
+
+if ref_short(3) != 3:
+ raise RuntimeError
+
+if ref_ushort(3) != 3:
+ raise RuntimeError
+
+if ref_long(3) != 3:
+ raise RuntimeError
+
+if ref_ulong(3) != 3:
+ raise RuntimeError
+
+if ref_schar(3) != 3:
+ raise RuntimeError
+
+if ref_uchar(3) != 3:
+ raise RuntimeError
+
+if ref_float(3.5) != 3.5:
+ raise RuntimeError
+
+if ref_double(3.5) != 3.5:
+ raise RuntimeError
+
+if ref_bool(1) != 1:
+ raise RuntimeError
+
+if ref_char('x') != 'x':
+ raise RuntimeError
+
+if ref_over(0) != 0:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/primitive_types_runme.py b/trunk/Examples/test-suite/python/primitive_types_runme.py
new file mode 100644
index 000000000..02cc21763
--- /dev/null
+++ b/trunk/Examples/test-suite/python/primitive_types_runme.py
@@ -0,0 +1,353 @@
+from primitive_types import *
+
+var_init()
+
+# assigning globals calls
+cvar.var_bool = sct_bool
+cvar.var_schar = sct_schar
+cvar.var_uchar = sct_uchar
+cvar.var_int = sct_int
+cvar.var_uint = sct_uint
+cvar.var_short = sct_short
+cvar.var_ushort = sct_ushort
+cvar.var_long = sct_long
+cvar.var_ulong = sct_ulong
+cvar.var_llong = sct_llong
+cvar.var_ullong = sct_ullong
+cvar.var_char = sct_char
+cvar.var_pchar = sct_pchar
+cvar.var_pcharc = sct_pcharc
+cvar.var_pint = sct_pint
+cvar.var_sizet = sct_sizet
+cvar.var_hello = sct_hello
+cvar.var_myint = sct_myint
+cvar.var_namet = def_namet
+cvar.var_parami = sct_parami
+cvar.var_paramd = sct_paramd
+cvar.var_paramc = sct_paramc
+
+v_check()
+
+def pyerror(name, val, cte):
+ print "bad val/cte", name, val, cte
+ raise RuntimeError
+ pass
+
+if cvar.var_bool != cct_bool: pyerror("bool", cvar.var_bool, cct_bool)
+if cvar.var_schar != cct_schar: pyerror("schar", cvar.var_schar, cct_schar)
+if cvar.var_uchar != cct_uchar: pyerror("uchar", cvar.var_uchar, cct_uchar)
+if cvar.var_int != cct_int: pyerror("int", cvar.var_int, cct_int)
+if cvar.var_uint != cct_uint: pyerror("uint", cvar.var_uint, cct_uint)
+if cvar.var_short != cct_short: pyerror("short", cvar.var_short, cct_short)
+if cvar.var_ushort != cct_ushort: pyerror("ushort", cvar.var_ushort, cct_ushort)
+if cvar.var_long != cct_long: pyerror("long", cvar.var_long, cct_long)
+if cvar.var_ulong != cct_ulong: pyerror("ulong", cvar.var_ulong, cct_ulong)
+if cvar.var_llong != cct_llong: pyerror("llong", cvar.var_llong, cct_llong)
+if cvar.var_ullong != cct_ullong: pyerror("ullong", cvar.var_ullong, cct_ullong)
+if cvar.var_char != cct_char: pyerror("char", cvar.var_char, cct_char)
+if cvar.var_pchar != cct_pchar: pyerror("pchar", cvar.var_pchar, cct_pchar)
+if cvar.var_pcharc != cct_pcharc: pyerror("pchar", cvar.var_pcharc, cct_pcharc)
+if cvar.var_pint != cct_pint: pyerror("pint", cvar.var_pint, cct_pint)
+if cvar.var_sizet != cct_sizet: pyerror("sizet", cvar.var_sizet, cct_sizet)
+if cvar.var_hello != cct_hello: pyerror("hello", cvar.var_hello, cct_hello)
+if cvar.var_myint != cct_myint: pyerror("myint", cvar.var_myint, cct_myint)
+if cvar.var_namet != def_namet: pyerror("name", cvar.var_namet, def_namet)
+
+class PyTest (TestDirector):
+ def __init__(self):
+ TestDirector.__init__(self)
+ pass
+ def ident(self, x):
+ return x
+
+ def vval_bool(self, x): return self.ident(x)
+ def vval_schar(self, x): return self.ident(x)
+ def vval_uchar(self, x): return self.ident(x)
+ def vval_int(self, x): return self.ident(x)
+ def vval_uint(self, x): return self.ident(x)
+ def vval_short(self, x): return self.ident(x)
+ def vval_ushort(self, x): return self.ident(x)
+ def vval_long(self, x): return self.ident(x)
+ def vval_ulong(self, x): return self.ident(x)
+ def vval_llong(self, x): return self.ident(x)
+ def vval_ullong(self, x): return self.ident(x)
+ def vval_float(self, x): return self.ident(x)
+ def vval_double(self, x): return self.ident(x)
+ def vval_char(self, x): return self.ident(x)
+ def vval_pchar(self, x): return self.ident(x)
+ def vval_pcharc(self, x): return self.ident(x)
+ def vval_pint(self, x): return self.ident(x)
+ def vval_sizet(self, x): return self.ident(x)
+ def vval_hello(self, x): return self.ident(x)
+ def vval_myint(self, x): return self.ident(x)
+
+ def vref_bool(self, x): return self.ident(x)
+ def vref_schar(self, x): return self.ident(x)
+ def vref_uchar(self, x): return self.ident(x)
+ def vref_int(self, x): return self.ident(x)
+ def vref_uint(self, x): return self.ident(x)
+ def vref_short(self, x): return self.ident(x)
+ def vref_ushort(self, x): return self.ident(x)
+ def vref_long(self, x): return self.ident(x)
+ def vref_ulong(self, x): return self.ident(x)
+ def vref_llong(self, x): return self.ident(x)
+ def vref_ullong(self, x): return self.ident(x)
+ def vref_float(self, x): return self.ident(x)
+ def vref_double(self, x): return self.ident(x)
+ def vref_char(self, x): return self.ident(x)
+ def vref_pchar(self, x): return self.ident(x)
+ def vref_pcharc(self, x): return self.ident(x)
+ def vref_pint(self, x): return self.ident(x)
+ def vref_sizet(self, x): return self.ident(x)
+ def vref_hello(self, x): return self.ident(x)
+ def vref_myint(self, x): return self.ident(x)
+
+ pass
+
+
+t = Test()
+p = PyTest()
+
+
+# internal call check
+if t.c_check() != p.c_check():
+ raise RuntimeError, "bad director"
+
+p.var_bool = p.stc_bool
+p.var_schar = p.stc_schar
+p.var_uchar = p.stc_uchar
+p.var_int = p.stc_int
+p.var_uint = p.stc_uint
+p.var_short = p.stc_short
+p.var_ushort = p.stc_ushort
+p.var_long = p.stc_long
+p.var_ulong = p.stc_ulong
+p.var_llong = p.stc_llong
+p.var_ullong = p.stc_ullong
+p.var_char = p.stc_char
+p.var_pchar = sct_pchar
+p.var_pcharc = sct_pcharc
+p.var_pint = sct_pint
+p.var_sizet = sct_sizet
+p.var_hello = sct_hello
+p.var_myint = sct_myint
+p.var_namet = def_namet
+p.var_parami = sct_parami
+p.var_paramd = sct_paramd
+p.var_paramc = sct_paramc
+
+p.v_check()
+
+
+t.var_bool = t.stc_bool
+t.var_schar = t.stc_schar
+t.var_uchar = t.stc_uchar
+t.var_int = t.stc_int
+t.var_uint = t.stc_uint
+t.var_short = t.stc_short
+t.var_ushort = t.stc_ushort
+t.var_long = t.stc_long
+t.var_ulong = t.stc_ulong
+t.var_llong = t.stc_llong
+t.var_ullong = t.stc_ullong
+t.var_char = t.stc_char
+t.var_pchar = sct_pchar
+t.var_pcharc = sct_pcharc
+t.var_pint = sct_pint
+t.var_sizet = sct_sizet
+t.var_hello = sct_hello
+t.var_myint = sct_myint
+t.var_namet = def_namet
+t.var_parami = sct_parami
+t.var_paramd = sct_paramd
+t.var_paramc = sct_paramc
+
+t.v_check()
+
+# this value contains a '0' char!
+if def_namet != 'ho\0la':
+ print "bad namet", def_namet
+ raise RuntimeError
+
+t.var_namet = def_namet
+if t.var_namet != def_namet:
+ print "bad namet", t.var_namet, def_namet
+ raise RuntimeError
+
+t.var_namet = 'holac'
+
+if t.var_namet != 'holac':
+ print "bad namet", t.var_namet
+ raise RuntimeError
+
+t.var_namet = 'hol'
+
+if t.var_namet != 'hol':
+#if t.var_namet != 'hol\0\0':
+ print "bad namet", t.var_namet
+ raise RuntimeError
+
+
+if t.strlen('hile') != 4:
+ print t.strlen('hile')
+ raise RuntimeError, "bad string typemap"
+
+if t.strlen('hil\0') != 4:
+ raise RuntimeError, "bad string typemap"
+
+
+cvar.var_char = '\0'
+if cvar.var_char != '\0':
+ raise RuntimeError, "bad char '0' case"
+
+cvar.var_char = 0
+if cvar.var_char != '\0':
+ raise RuntimeError, "bad char '0' case"
+
+cvar.var_namet = '\0'
+#if cvar.var_namet != '\0\0\0\0\0':
+if cvar.var_namet != '':
+ print 'hola', '', cvar.var_namet
+ raise RuntimeError, "bad char '\0' case"
+
+cvar.var_namet = ''
+#if cvar.var_namet != '\0\0\0\0\0':
+if cvar.var_namet != '':
+ raise RuntimeError, "bad char empty case"
+
+cvar.var_pchar = None
+if cvar.var_pchar != None:
+ raise RuntimeError, "bad None case"
+
+cvar.var_pchar = ''
+if cvar.var_pchar != '':
+ print '%c' % (cvar.var_pchar[0],)
+ raise RuntimeError, "bad char empty case"
+
+cvar.var_pcharc = None
+if cvar.var_pcharc != None:
+ raise RuntimeError, "bad None case"
+
+cvar.var_pcharc = ''
+if cvar.var_pcharc != '':
+ raise RuntimeError, "bad char empty case"
+
+
+#
+# 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 string 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)
+
+#
+# Now when things should fail
+#
+
+
+try:
+ error = 0
+ a = t.var_uchar
+ t.var_uchar = 10000
+ error = 1
+except OverflowError:
+ if a != t.var_uchar:
+ error = 1
+ pass
+if error:
+ raise RuntimeError, "bad uchar typemap"
+
+
+
+try:
+ error = 0
+ a = t.var_char
+ t.var_char = '23'
+ error = 1
+except TypeError:
+ if a != t.var_char:
+ error = 1
+ pass
+if error:
+ raise RuntimeError, "bad char typemap"
+
+try:
+ error = 0
+ a = t.var_uint
+ t.var_uint = -1
+ error = 1
+except OverflowError:
+ if a != t.var_uint:
+ error = 1
+ pass
+if error:
+ raise RuntimeError, "bad uint typemap"
+
+#
+#
+try:
+ error = 0
+ a = t.var_namet
+ t.var_namet = '123456'
+ error = 1
+except TypeError:
+ if a != t.var_namet:
+ error = 1
+ pass
+if error:
+ raise RuntimeError, "bad namet typemap"
+
+#
+#
+#
+t2 = p.vtest(t)
+if t.var_namet != t2.var_namet:
+ raise RuntimeError, "bad SWIGTYPE* typemap"
+
+
+if cvar.fixsize != 'ho\0la\0\0\0':
+ raise RuntimeError, "bad FIXSIZE typemap"
+
+cvar.fixsize = 'ho'
+if cvar.fixsize != 'ho\0\0\0\0\0\0':
+ raise RuntimeError, "bad FIXSIZE typemap"
+
+
+f = Foo(3)
+f1 = fptr_val(f)
+f2 = fptr_ref(f)
+if f1._a != f2._a:
+ raise RuntimeError, "bad const ptr& typemap"
+
+
+v = char_foo(1,3)
+if v !=3:
+ raise RuntimeError, "bad int typemap"
+
+s = char_foo(1,"hello")
+if s !="hello":
+ raise RuntimeError, "bad char* typemap"
+
+
+v = SetPos(1,3)
+if v !=4:
+ raise RuntimeError, "bad int typemap"
diff --git a/trunk/Examples/test-suite/python/profiletest_runme.py b/trunk/Examples/test-suite/python/profiletest_runme.py
new file mode 100644
index 000000000..d4f07dc11
--- /dev/null
+++ b/trunk/Examples/test-suite/python/profiletest_runme.py
@@ -0,0 +1,32 @@
+import _profiletest
+import profiletest
+
+a = profiletest.A()
+print a
+print a.this
+
+b = profiletest.B()
+fn = b.fn
+i = 50000
+while i:
+ a = fn(a) #1
+ a = fn(a) #2
+ a = fn(a) #3
+ a = fn(a) #4
+ a = fn(a) #5
+ a = fn(a) #6
+ a = fn(a) #7
+ a = fn(a) #8
+ a = fn(a) #9
+ a = fn(a) #10
+ a = fn(a) #1
+ a = fn(a) #2
+ a = fn(a) #3
+ a = fn(a) #4
+ a = fn(a) #5
+ a = fn(a) #6
+ a = fn(a) #7
+ a = fn(a) #8
+ a = fn(a) #9
+ a = fn(a) #20
+ i -= 1
diff --git a/trunk/Examples/test-suite/python/profiletestc_runme.py b/trunk/Examples/test-suite/python/profiletestc_runme.py
new file mode 100644
index 000000000..33461e484
--- /dev/null
+++ b/trunk/Examples/test-suite/python/profiletestc_runme.py
@@ -0,0 +1,54 @@
+import _profiletest
+#import profiletest
+
+pa = _profiletest.new_A()
+pb = _profiletest.new_B()
+fn = _profiletest.B_fn
+destroy = _profiletest.delete_A
+i = 50000
+a = pa
+while i:
+ a = fn(pb,a) #1
+ destroy(a)
+ a = fn(pb,a) #2
+ destroy(a)
+ a = fn(pb,a) #3
+ destroy(a)
+ a = fn(pb,a) #4
+ destroy(a)
+ a = fn(pb,a) #5
+ destroy(a)
+ a = fn(pb,a) #6
+ destroy(a)
+ a = fn(pb,a) #7
+ destroy(a)
+ a = fn(pb,a) #8
+ destroy(a)
+ a = fn(pb,a) #9
+ destroy(a)
+ a = fn(pb,a) #10
+ destroy(a)
+ a = fn(pb,a) #1
+ destroy(a)
+ a = fn(pb,a) #2
+ destroy(a)
+ a = fn(pb,a) #3
+ destroy(a)
+ a = fn(pb,a) #4
+ destroy(a)
+ a = fn(pb,a) #5
+ destroy(a)
+ a = fn(pb,a) #6
+ destroy(a)
+ a = fn(pb,a) #7
+ destroy(a)
+ a = fn(pb,a) #8
+ destroy(a)
+ a = fn(pb,a) #9
+ destroy(a)
+ a = fn(pb,a) #20
+ destroy(a)
+ i -= 1
+
+_profiletest.delete_A(pa)
+_profiletest.delete_B(pb)
diff --git a/trunk/Examples/test-suite/python/python_abstractbase_runme3.py b/trunk/Examples/test-suite/python/python_abstractbase_runme3.py
new file mode 100644
index 000000000..e34777558
--- /dev/null
+++ b/trunk/Examples/test-suite/python/python_abstractbase_runme3.py
@@ -0,0 +1,8 @@
+from python_abstractbase import *
+from collections import *
+assert issubclass(Mapii, MutableMapping)
+assert issubclass(Multimapii, MutableMapping)
+assert issubclass(IntSet, MutableSet)
+assert issubclass(IntMultiset, MutableSet)
+assert issubclass(IntVector, MutableSequence)
+assert issubclass(IntList, MutableSequence)
diff --git a/trunk/Examples/test-suite/python/python_append_runme.py b/trunk/Examples/test-suite/python/python_append_runme.py
new file mode 100644
index 000000000..c8e6b2640
--- /dev/null
+++ b/trunk/Examples/test-suite/python/python_append_runme.py
@@ -0,0 +1,4 @@
+from python_append import *
+t=Test()
+t.func()
+t.static_func()
diff --git a/trunk/Examples/test-suite/python/python_kwargs_runme.py b/trunk/Examples/test-suite/python/python_kwargs_runme.py
new file mode 100644
index 000000000..fb6e191dd
--- /dev/null
+++ b/trunk/Examples/test-suite/python/python_kwargs_runme.py
@@ -0,0 +1,67 @@
+from python_kwargs 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
+
diff --git a/trunk/Examples/test-suite/python/python_nondynamic_runme.py b/trunk/Examples/test-suite/python/python_nondynamic_runme.py
new file mode 100644
index 000000000..27755db9c
--- /dev/null
+++ b/trunk/Examples/test-suite/python/python_nondynamic_runme.py
@@ -0,0 +1,39 @@
+import python_nondynamic
+
+aa = python_nondynamic.A()
+
+aa.a = 1
+aa.b = 2
+try:
+ aa.c = 2
+ err = 0
+except:
+ err = 1
+
+if not err:
+ raise RuntimeError, "A is not static"
+
+
+class B(python_nondynamic.A):
+ c = 4
+ def __init__(self):
+ python_nondynamic.A.__init__(self)
+ pass
+ pass
+
+
+
+bb = B()
+bb.c = 3
+try:
+ bb.d = 2
+ err = 0
+except:
+ err = 1
+
+if not err:
+ raise RuntimeError, "B is not static"
+
+
+cc = python_nondynamic.C()
+cc.d = 3
diff --git a/trunk/Examples/test-suite/python/python_overload_simple_cast_runme.py b/trunk/Examples/test-suite/python/python_overload_simple_cast_runme.py
new file mode 100644
index 000000000..1b3a5482c
--- /dev/null
+++ b/trunk/Examples/test-suite/python/python_overload_simple_cast_runme.py
@@ -0,0 +1,192 @@
+from python_overload_simple_cast import *
+
+class Ai:
+ def __init__(self,x):
+ self.x = x
+
+ def __int__(self):
+ return self.x
+
+class Ad:
+ def __init__(self,x):
+ self.x = x
+
+ def __float__(self):
+ return self.x
+
+ai = Ai(4)
+
+ad = Ad(5.0)
+add = Ad(5.5)
+
+try:
+ fint(add)
+ good = 0
+except:
+ good = 1
+
+if not good:
+ raise RuntimeError, "fint(int)"
+
+
+if fint(ad) != "fint:int":
+ raise RuntimeError, "fint(int)"
+
+if fdouble(ad) != "fdouble:double":
+ raise RuntimeError, "fdouble(double)"
+
+if fint(ai) != "fint:int":
+ raise RuntimeError, "fint(int)"
+
+if fint(5.0) != "fint:int":
+ raise RuntimeError, "fint(int)"
+
+if fint(3) != "fint:int":
+ raise RuntimeError, "fint(int)"
+if fint(3.0) != "fint:int":
+ raise RuntimeError, "fint(int)"
+
+if fdouble(ad) != "fdouble:double":
+ raise RuntimeError, "fdouble(double)"
+if fdouble(3) != "fdouble:double":
+ raise RuntimeError, "fdouble(double)"
+if fdouble(3.0) != "fdouble:double":
+ raise RuntimeError, "fdouble(double)"
+
+if fid(3,3.0) != "fid:intdouble":
+ raise RuntimeError, "fid:intdouble"
+
+if fid(3.0,3) != "fid:doubleint":
+ raise RuntimeError, "fid:doubleint"
+
+if fid(ad,ai) != "fid:doubleint":
+ raise RuntimeError, "fid:doubleint"
+
+if fid(ai,ad) != "fid:intdouble":
+ raise RuntimeError, "fid:intdouble"
+
+
+
+if foo(3) != "foo:int":
+ raise RuntimeError, "foo(int)"
+
+if foo(3.0) != "foo:double":
+ raise RuntimeError, "foo(double)"
+
+if foo("hello") != "foo:char *":
+ raise RuntimeError, "foo(char *)"
+
+f = Foo()
+b = Bar()
+
+if foo(f) != "foo:Foo *":
+ raise RuntimeError, "foo(Foo *)"
+
+if foo(b) != "foo:Bar *":
+ raise RuntimeError, "foo(Bar *)"
+
+v = malloc_void(32)
+
+if foo(v) != "foo:void *":
+ raise RuntimeError, "foo(void *)"
+
+s = Spam()
+
+if s.foo(3) != "foo:int":
+ raise RuntimeError, "Spam::foo(int)"
+
+if s.foo(3.0) != "foo:double":
+ raise RuntimeError, "Spam::foo(double)"
+
+if s.foo("hello") != "foo:char *":
+ raise RuntimeError, "Spam::foo(char *)"
+
+if s.foo(f) != "foo:Foo *":
+ raise RuntimeError, "Spam::foo(Foo *)"
+
+if s.foo(b) != "foo:Bar *":
+ raise RuntimeError, "Spam::foo(Bar *)"
+
+if s.foo(v) != "foo:void *":
+ raise RuntimeError, "Spam::foo(void *)"
+
+if Spam_bar(3) != "bar:int":
+ raise RuntimeError, "Spam::bar(int)"
+
+if Spam_bar(3.0) != "bar:double":
+ raise RuntimeError, "Spam::bar(double)"
+
+if Spam_bar("hello") != "bar:char *":
+ raise RuntimeError, "Spam::bar(char *)"
+
+if Spam_bar(f) != "bar:Foo *":
+ raise RuntimeError, "Spam::bar(Foo *)"
+
+if Spam_bar(b) != "bar:Bar *":
+ raise RuntimeError, "Spam::bar(Bar *)"
+
+if Spam_bar(v) != "bar:void *":
+ raise RuntimeError, "Spam::bar(void *)"
+
+# Test constructors
+
+s = Spam()
+if s.type != "none":
+ raise RuntimeError, "Spam()"
+
+s = Spam(3)
+if s.type != "int":
+ raise RuntimeError, "Spam(int)"
+
+s = Spam(3.4)
+if s.type != "double":
+ raise RuntimeError, "Spam(double)"
+
+s = Spam("hello")
+if s.type != "char *":
+ raise RuntimeError, "Spam(char *)"
+
+s = Spam(f)
+if s.type != "Foo *":
+ raise RuntimeError, "Spam(Foo *)"
+
+s = Spam(b)
+if s.type != "Bar *":
+ raise RuntimeError, "Spam(Bar *)"
+
+s = Spam(v)
+if s.type != "void *":
+ raise RuntimeError, "Spam(void *)"
+
+
+# unsigned long long
+ullmax = 9223372036854775807 #0xffffffffffffffff
+ullmaxd = 9007199254740992.0
+ullmin = 0
+ullmind = 0.0
+if ull(ullmin) != ullmin:
+ raise runtimeerror, "ull(ullmin)"
+if ull(ullmax) != ullmax:
+ raise runtimeerror, "ull(ullmax)"
+if ull(ullmind) != ullmind:
+ raise RuntimeError, "ull(ullmind)"
+if ull(ullmaxd) != ullmaxd:
+ raise RuntimeError, "ull(ullmaxd)"
+
+# long long
+llmax = 9223372036854775807 #0x7fffffffffffffff
+llmin = -9223372036854775808
+# these are near the largest floats we can still convert into long long
+llmaxd = 9007199254740992.0
+llmind = -9007199254740992.0
+if ll(llmin) != llmin:
+ raise runtimeerror, "ll(llmin)"
+if ll(llmax) != llmax:
+ raise runtimeerror, "ll(llmax)"
+if ll(llmind) != llmind:
+ raise RuntimeError, "ll(llmind)"
+if ll(llmaxd) != llmaxd:
+ raise RuntimeError, "ll(llmaxd)"
+
+
+free_void(v)
diff --git a/trunk/Examples/test-suite/python/python_pybuf_runme3.py b/trunk/Examples/test-suite/python/python_pybuf_runme3.py
new file mode 100644
index 000000000..152aecdc0
--- /dev/null
+++ b/trunk/Examples/test-suite/python/python_pybuf_runme3.py
@@ -0,0 +1,42 @@
+#run:
+# python python_pybuf_runme3.py benchmark
+#for the benchmark, other wise the test case will be run
+import python_pybuf
+import sys
+if len(sys.argv)>=2 and sys.argv[1]=="benchmark":
+ #run the benchmark
+ import time
+ k=1000000 #number of times to excute the functions
+
+ t=time.time()
+ a = bytearray(b'hello world')
+ for i in range(k):
+ pybuf.title1(a)
+ print("Time used by bytearray:",time.time()-t)
+
+ t=time.time()
+ b = 'hello world'
+ for i in range(k):
+ pybuf.title2(b)
+ print("Time used by string:",time.time()-t)
+else:
+ #run the test case
+ buf1 = bytearray(10)
+ buf2 = bytearray(50)
+
+ pybuf.func1(buf1)
+ assert buf1 == b'a'*10
+
+ pybuf.func2(buf2)
+ assert buf2.startswith(b"Hello world!\x00")
+
+ count = pybuf.func3(buf2)
+ assert count==10 #number of alpha and number in 'Hello world!'
+
+ length = pybuf.func4(buf2)
+ assert length==12
+
+ buf3 = bytearray(b"hello")
+ pybuf.title1(buf3)
+ assert buf3==b'Hello'
+
diff --git a/trunk/Examples/test-suite/python/pythonswig.supp b/trunk/Examples/test-suite/python/pythonswig.supp
new file mode 100644
index 000000000..a9b03afc9
--- /dev/null
+++ b/trunk/Examples/test-suite/python/pythonswig.supp
@@ -0,0 +1,463 @@
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znam
+ fun:_Z21SWIG_AsCharPtrAndSizeP7_objectPPcPmPi
+ fun:var_pcharc_set
+ fun:swig_varlink_setattr
+ fun:PyObject_SetAttr
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znam
+ fun:var_pchar_set
+ fun:swig_varlink_setattr
+ fun:PyObject_SetAttr
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znam
+ fun:_wrap_Test_var_pcharc_set
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:function_call
+ fun:PyObject_Call
+ fun:PyEval_CallObjectWithKeywords
+ fun:instance_setattr
+ fun:PyObject_SetAttr
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znam
+ fun:_wrap_TestDirector_var_pcharc_set
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:function_call
+ fun:PyObject_Call
+ fun:instancemethod_call
+ fun:PyObject_Call
+ fun:call_method
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znam
+ fun:_Z21SWIG_AsCharPtrAndSizeP7_objectPPcPmPi
+ fun:var_pcharc_set
+ fun:swig_varlink_setattr
+ fun:PyObject_SetAttr
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znam
+ fun:_wrap_Test_var_pchar_set
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:function_call
+ fun:PyObject_Call
+ fun:PyEval_CallObjectWithKeywords
+ fun:instance_setattr
+ fun:PyObject_SetAttr
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znam
+ fun:_wrap_TestDirector_var_pchar_set
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:function_call
+ fun:PyObject_Call
+ fun:instancemethod_call
+ fun:PyObject_Call
+ fun:call_method
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:SWIG_Python_newvarlink
+ fun:SWIG_globals
+ fun:init_primitive_types
+ fun:_PyImport_LoadDynamicModule
+ fun:load_module
+ fun:import_submodule
+ fun:load_next
+ fun:import_module_ex
+ fun:PyImport_ImportModuleEx
+ fun:builtin___import__
+ fun:PyObject_Call
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:SWIG_Python_addvarlink
+ fun:init_primitive_types
+ fun:_PyImport_LoadDynamicModule
+ fun:load_module
+ fun:import_submodule
+ fun:load_next
+ fun:import_module_ex
+ fun:PyImport_ImportModuleEx
+ fun:builtin___import__
+ fun:PyObject_Call
+ fun:PyEval_CallObjectWithKeywords
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:PyFloat_FromDouble
+ fun:init_primitive_types
+ fun:_PyImport_LoadDynamicModule
+ fun:load_module
+ fun:import_submodule
+ fun:load_next
+ fun:import_module_ex
+ fun:PyImport_ImportModuleEx
+ fun:builtin___import__
+ fun:PyObject_Call
+ fun:PyEval_CallObjectWithKeywords
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:SWIG_Python_addvarlink
+ fun:init_primitive_types
+ fun:_PyImport_LoadDynamicModule
+ fun:load_module
+ fun:import_submodule
+ fun:load_next
+ fun:import_module_ex
+ fun:PyImport_ImportModuleEx
+ fun:builtin___import__
+ fun:PyObject_Call
+ fun:PyEval_CallObjectWithKeywords
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:realloc
+ fun:_PyString_Resize
+ fun:jcompile
+ fun:com_funcdef
+ fun:com_node
+ fun:com_node
+ fun:compile_node
+ fun:jcompile
+ fun:com_classdef
+ fun:com_node
+ fun:compile_node
+ fun:jcompile
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:_PyObject_GC_New
+ fun:PyDict_New
+ fun:PyModule_New
+ fun:PyImport_AddModule
+ fun:Py_InitModule4
+ fun:_PyExc_Init
+ fun:Py_InitializeEx
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znwm
+ fun:_Z21createref_signed_chara
+ fun:_wrap_createref_signed_char
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znwm
+ fun:_Z23createref_unsigned_charh
+ fun:_wrap_createref_unsigned_char
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znwm
+ fun:_Z14createref_charc
+ fun:_wrap_createref_char
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znwm
+ fun:_Z24createref_unsigned_shortt
+ fun:_wrap_createref_unsigned_short
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znwm
+ fun:_Z15createref_shorts
+ fun:_wrap_createref_short
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znwm
+ fun:_Z14createref_boolb
+ fun:_wrap_createref_bool
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znwm
+ fun:_Z19createref_TestClass9TestClass
+ fun:_wrap_createref_TestClass
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znwm
+ fun:_Z15createref_floatf
+ fun:_wrap_createref_float
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znwm
+ fun:_Z22createref_unsigned_intj
+ fun:_wrap_createref_unsigned_int
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znwm
+ fun:_Z13createref_inti
+ fun:_wrap_createref_int
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znwm
+ fun:_Z16createref_doubled
+ fun:_wrap_createref_double
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znwm
+ fun:_Z28createref_unsigned_long_longy
+ fun:_wrap_createref_unsigned_long_long
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znwm
+ fun:_Z19createref_long_longx
+ fun:_wrap_createref_long_long
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znwm
+ fun:_Z23createref_unsigned_longm
+ fun:_wrap_createref_unsigned_long
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:_Znwm
+ fun:_Z14createref_longl
+ fun:_wrap_createref_long
+ fun:PyEval_EvalFrame
+ fun:PyEval_EvalCodeEx
+ fun:PyEval_EvalCode
+ fun:PyRun_FileExFlags
+ fun:PyRun_SimpleFileExFlags
+ fun:Py_Main
+ fun:__libc_start_main
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:SWIG_Python_newvarlink
+ fun:SWIG_globals
+ fun:init_reference_global_vars
+ fun:_PyImport_LoadDynamicModule
+ fun:load_module
+ fun:import_submodule
+ fun:load_next
+ fun:import_module_ex
+ fun:PyImport_ImportModuleEx
+ fun:builtin___import__
+ fun:PyObject_Call
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:SWIG_Python_addvarlink
+ fun:init_reference_global_vars
+ fun:_PyImport_LoadDynamicModule
+ fun:load_module
+ fun:import_submodule
+ fun:load_next
+ fun:import_module_ex
+ fun:PyImport_ImportModuleEx
+ fun:builtin___import__
+ fun:PyObject_Call
+ fun:PyEval_CallObjectWithKeywords
+}
+{
+ <insert a suppression name here>
+ Memcheck:Leak
+ fun:malloc
+ fun:SWIG_Python_addvarlink
+ fun:init_reference_global_vars
+ fun:_PyImport_LoadDynamicModule
+ fun:load_module
+ fun:import_submodule
+ fun:load_next
+ fun:import_module_ex
+ fun:PyImport_ImportModuleEx
+ fun:builtin___import__
+ fun:PyObject_Call
+ fun:PyEval_CallObjectWithKeywords
+}
diff --git a/trunk/Examples/test-suite/python/refcount_runme.py b/trunk/Examples/test-suite/python/refcount_runme.py
new file mode 100644
index 000000000..b429404e7
--- /dev/null
+++ b/trunk/Examples/test-suite/python/refcount_runme.py
@@ -0,0 +1,32 @@
+from refcount import *
+#
+# very innocent example
+#
+
+a = A3()
+b1 = B(a)
+b2 = B.create(a)
+
+
+
+if a.ref_count() != 3:
+ print "This program will crash... now"
+
+
+rca = b2.get_rca()
+b3 = B.create(rca)
+
+if a.ref_count() != 5:
+ print "This program will crash... now"
+
+
+v = vector_A(2)
+v[0] = a
+v[1] = a
+
+x = v[0]
+del v
+
+
+
+
diff --git a/trunk/Examples/test-suite/python/reference_global_vars_runme.py b/trunk/Examples/test-suite/python/reference_global_vars_runme.py
new file mode 100644
index 000000000..aa42ff50b
--- /dev/null
+++ b/trunk/Examples/test-suite/python/reference_global_vars_runme.py
@@ -0,0 +1,74 @@
+from reference_global_vars import *
+
+# const class reference variable
+if getconstTC().num != 33:
+ raise RuntimeError
+
+# primitive reference variables
+cvar.var_bool = createref_bool(0)
+if value_bool(cvar.var_bool) != 0:
+ raise RuntimeError
+
+cvar.var_bool = createref_bool(1)
+if value_bool(cvar.var_bool) != 1:
+ raise RuntimeError
+
+cvar.var_char = createref_char('w')
+if value_char(cvar.var_char) != 'w':
+ raise RuntimeError
+
+cvar.var_unsigned_char = createref_unsigned_char(10)
+if value_unsigned_char(cvar.var_unsigned_char) != 10:
+ raise RuntimeError
+
+cvar.var_signed_char = createref_signed_char(10)
+if value_signed_char(cvar.var_signed_char) != 10:
+ raise RuntimeError
+
+cvar.var_short = createref_short(10)
+if value_short(cvar.var_short) != 10:
+ raise RuntimeError
+
+cvar.var_unsigned_short = createref_unsigned_short(10)
+if value_unsigned_short(cvar.var_unsigned_short) != 10:
+ raise RuntimeError
+
+cvar.var_int = createref_int(10)
+if value_int(cvar.var_int) != 10:
+ raise RuntimeError
+
+cvar.var_unsigned_int = createref_unsigned_int(10)
+if value_unsigned_int(cvar.var_unsigned_int) != 10:
+ raise RuntimeError
+
+cvar.var_long = createref_long(10)
+if value_long(cvar.var_long) != 10:
+ raise RuntimeError
+
+cvar.var_unsigned_long = createref_unsigned_long(10)
+if value_unsigned_long(cvar.var_unsigned_long) != 10:
+ raise RuntimeError
+
+cvar.var_long_long = createref_long_long(0x6FFFFFFFFFFFFFF8)
+if value_long_long(cvar.var_long_long) != 0x6FFFFFFFFFFFFFF8:
+ raise RuntimeError
+
+#ull = abs(0xFFFFFFF2FFFFFFF0)
+ull = 55834574864
+cvar.var_unsigned_long_long = createref_unsigned_long_long(ull)
+if value_unsigned_long_long(cvar.var_unsigned_long_long) != ull:
+ raise RuntimeError
+
+cvar.var_float = createref_float(10.5)
+if value_float(cvar.var_float) != 10.5:
+ raise RuntimeError
+
+cvar.var_double = createref_double(10.5)
+if value_double(cvar.var_double) != 10.5:
+ raise RuntimeError
+
+# class reference variable
+cvar.var_TestClass = createref_TestClass(TestClass(20))
+if value_TestClass(cvar.var_TestClass).num != 20:
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/rename_scope_runme.py b/trunk/Examples/test-suite/python/rename_scope_runme.py
new file mode 100644
index 000000000..faea6a84d
--- /dev/null
+++ b/trunk/Examples/test-suite/python/rename_scope_runme.py
@@ -0,0 +1,12 @@
+from rename_scope import *
+
+a = Natural_UP()
+b = Natural_BP()
+
+if a.rtest() != 1:
+ raise RuntimeError
+
+if b.rtest() != 1:
+ raise RuntimeError
+
+f = equals
diff --git a/trunk/Examples/test-suite/python/rename_strip_encoder_runme.py b/trunk/Examples/test-suite/python/rename_strip_encoder_runme.py
new file mode 100644
index 000000000..64be611d6
--- /dev/null
+++ b/trunk/Examples/test-suite/python/rename_strip_encoder_runme.py
@@ -0,0 +1,6 @@
+from rename_strip_encoder import *
+
+s = SomeWidget()
+a = AnotherWidget()
+a.DoSomething()
+
diff --git a/trunk/Examples/test-suite/python/ret_by_value_runme.py b/trunk/Examples/test-suite/python/ret_by_value_runme.py
new file mode 100644
index 000000000..0b2d7fd86
--- /dev/null
+++ b/trunk/Examples/test-suite/python/ret_by_value_runme.py
@@ -0,0 +1,8 @@
+import ret_by_value
+
+a = ret_by_value.get_test()
+if a.myInt != 100:
+ raise RuntimeError
+
+if a.myShort != 200:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/return_const_value_runme.py b/trunk/Examples/test-suite/python/return_const_value_runme.py
new file mode 100644
index 000000000..516e9f5d9
--- /dev/null
+++ b/trunk/Examples/test-suite/python/return_const_value_runme.py
@@ -0,0 +1,12 @@
+import return_const_value
+import sys
+
+p = return_const_value.Foo_ptr.getPtr()
+if (p.getVal() != 17):
+ print "Runtime test1 faild. p.getVal()=", p.getVal()
+ sys.exit(1)
+
+p = return_const_value.Foo_ptr.getConstPtr()
+if (p.getVal() != 17):
+ print "Runtime test2 faild. p.getVal()=", p.getVal()
+ sys.exit(1)
diff --git a/trunk/Examples/test-suite/python/smart_pointer_extend_runme.py b/trunk/Examples/test-suite/python/smart_pointer_extend_runme.py
new file mode 100644
index 000000000..969757b4c
--- /dev/null
+++ b/trunk/Examples/test-suite/python/smart_pointer_extend_runme.py
@@ -0,0 +1,34 @@
+from smart_pointer_extend import *
+
+f = Foo()
+b = Bar(f)
+
+if b.extension() != f.extension():
+ raise RuntimeError
+
+
+b = CBase()
+d = CDerived()
+p = CPtr()
+
+if b.bar() != p.bar():
+ raise RuntimeError
+
+if d.foo() != p.foo():
+ raise RuntimeError
+
+if b.hello() != p.hello():
+ raise RuntimeError
+
+
+
+d = DFoo()
+
+dp = DPtrFoo(d)
+
+if d.SExt(1) != dp.SExt(1):
+ raise RuntimeError
+
+if d.Ext(1) != dp.Ext(1):
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/smart_pointer_member_runme.py b/trunk/Examples/test-suite/python/smart_pointer_member_runme.py
new file mode 100644
index 000000000..70e655652
--- /dev/null
+++ b/trunk/Examples/test-suite/python/smart_pointer_member_runme.py
@@ -0,0 +1,30 @@
+from smart_pointer_member import *
+
+f = Foo()
+f.y = 1
+
+if f.y != 1:
+ raise RuntimeError
+
+b = Bar(f)
+b.y = 2
+
+if f.y != 2:
+ print f.y
+ print b.y
+ raise RuntimeError
+
+if b.x != f.x:
+ raise RuntimeError
+
+if b.z != f.z:
+ raise RuntimeError
+
+if Foo.z == Bar.z:
+ raise RuntimeError
+
+
+
+
+
+
diff --git a/trunk/Examples/test-suite/python/smart_pointer_multi_runme.py b/trunk/Examples/test-suite/python/smart_pointer_multi_runme.py
new file mode 100644
index 000000000..c17053055
--- /dev/null
+++ b/trunk/Examples/test-suite/python/smart_pointer_multi_runme.py
@@ -0,0 +1,15 @@
+from smart_pointer_multi import *
+
+f = Foo()
+b = Bar(f)
+s = Spam(b)
+g = Grok(b)
+
+s.x = 3
+if s.getx() != 3:
+ raise RuntimeError
+
+g.x = 4
+if g.getx() != 4:
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/smart_pointer_multi_typedef_runme.py b/trunk/Examples/test-suite/python/smart_pointer_multi_typedef_runme.py
new file mode 100644
index 000000000..ebf4c9b09
--- /dev/null
+++ b/trunk/Examples/test-suite/python/smart_pointer_multi_typedef_runme.py
@@ -0,0 +1,15 @@
+from smart_pointer_multi_typedef import *
+
+f = Foo()
+b = Bar(f)
+s = Spam(b)
+g = Grok(b)
+
+s.x = 3
+if s.getx() != 3:
+ raise RuntimeError
+
+g.x = 4
+if g.getx() != 4:
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/smart_pointer_not_runme.py b/trunk/Examples/test-suite/python/smart_pointer_not_runme.py
new file mode 100644
index 000000000..4c90b376b
--- /dev/null
+++ b/trunk/Examples/test-suite/python/smart_pointer_not_runme.py
@@ -0,0 +1,42 @@
+from smart_pointer_not import *
+
+f = Foo()
+b = Bar(f)
+s = Spam(f)
+g = Grok(f)
+
+try:
+ x = b.x
+ print "Error! b.x"
+except:
+ pass
+
+try:
+ x = s.x
+ print "Error! s.x"
+except:
+ pass
+
+try:
+ x = g.x
+ print "Error! g.x"
+except:
+ pass
+
+try:
+ x = b.getx()
+ print "Error! b.getx()"
+except:
+ pass
+
+try:
+ x = s.getx()
+ print "Error! s.getx()"
+except:
+ pass
+
+try:
+ x = g.getx()
+ print "Error! g.getx()"
+except:
+ pass
diff --git a/trunk/Examples/test-suite/python/smart_pointer_overload_runme.py b/trunk/Examples/test-suite/python/smart_pointer_overload_runme.py
new file mode 100644
index 000000000..c9fd3a5b0
--- /dev/null
+++ b/trunk/Examples/test-suite/python/smart_pointer_overload_runme.py
@@ -0,0 +1,21 @@
+from smart_pointer_overload import *
+
+f = Foo()
+b = Bar(f)
+
+
+if f.test(3) != 1:
+ raise RuntimeError
+if f.test(3.5) != 2:
+ raise RuntimeError
+if f.test("hello") != 3:
+ raise RuntimeError
+
+if b.test(3) != 1:
+ raise RuntimeError
+if b.test(3.5) != 2:
+ raise RuntimeError
+if b.test("hello") != 3:
+ raise RuntimeError
+
+
diff --git a/trunk/Examples/test-suite/python/smart_pointer_rename_runme.py b/trunk/Examples/test-suite/python/smart_pointer_rename_runme.py
new file mode 100644
index 000000000..c6d22273c
--- /dev/null
+++ b/trunk/Examples/test-suite/python/smart_pointer_rename_runme.py
@@ -0,0 +1,13 @@
+from smart_pointer_rename import *
+
+f = Foo()
+b = Bar(f)
+
+if b.test() != 3:
+ raise RuntimeError
+
+if b.ftest1(1) != 1:
+ raise RuntimeError
+
+if b.ftest2(2,3) != 2:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/smart_pointer_simple_runme.py b/trunk/Examples/test-suite/python/smart_pointer_simple_runme.py
new file mode 100644
index 000000000..95b678aae
--- /dev/null
+++ b/trunk/Examples/test-suite/python/smart_pointer_simple_runme.py
@@ -0,0 +1,13 @@
+from smart_pointer_simple import *
+
+f = Foo()
+b = Bar(f)
+
+b.x = 3
+if b.getx() != 3:
+ raise RuntimeError
+
+fp = b.__deref__()
+fp.x = 4
+if fp.getx() != 4:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/smart_pointer_templatevariables_runme.py b/trunk/Examples/test-suite/python/smart_pointer_templatevariables_runme.py
new file mode 100644
index 000000000..367dcf3b2
--- /dev/null
+++ b/trunk/Examples/test-suite/python/smart_pointer_templatevariables_runme.py
@@ -0,0 +1,17 @@
+from smart_pointer_templatevariables import *
+
+d = DiffImContainerPtr_D(create(1234, 5678))
+
+if (d.id != 1234):
+ raise RuntimeError
+#if (d.xyz != 5678):
+# raise RuntimeError
+
+d.id = 4321
+#d.xyz = 8765
+
+if (d.id != 4321):
+ raise RuntimeError
+#if (d.xyz != 8765):
+# raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/smart_pointer_typedef_runme.py b/trunk/Examples/test-suite/python/smart_pointer_typedef_runme.py
new file mode 100644
index 000000000..eee0537f4
--- /dev/null
+++ b/trunk/Examples/test-suite/python/smart_pointer_typedef_runme.py
@@ -0,0 +1,13 @@
+from smart_pointer_typedef import *
+
+f = Foo()
+b = Bar(f)
+
+b.x = 3
+if b.getx() != 3:
+ raise RuntimeError
+
+fp = b.__deref__()
+fp.x = 4
+if fp.getx() != 4:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/sneaky1_runme.py b/trunk/Examples/test-suite/python/sneaky1_runme.py
new file mode 100644
index 000000000..9c2c32f85
--- /dev/null
+++ b/trunk/Examples/test-suite/python/sneaky1_runme.py
@@ -0,0 +1,5 @@
+import sneaky1
+x = sneaky1.add(3,4)
+y = sneaky1.subtract(3,4)
+z = sneaky1.mul(3,4)
+w = sneaky1.divide(3,4)
diff --git a/trunk/Examples/test-suite/python/special_variable_macros_runme.py b/trunk/Examples/test-suite/python/special_variable_macros_runme.py
new file mode 100644
index 000000000..07e60dfa2
--- /dev/null
+++ b/trunk/Examples/test-suite/python/special_variable_macros_runme.py
@@ -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"
+
diff --git a/trunk/Examples/test-suite/python/static_const_member_2_runme.py b/trunk/Examples/test-suite/python/static_const_member_2_runme.py
new file mode 100644
index 000000000..081726361
--- /dev/null
+++ b/trunk/Examples/test-suite/python/static_const_member_2_runme.py
@@ -0,0 +1,16 @@
+from static_const_member_2 import *
+
+c = Test_int()
+try:
+ a = c.forward_field
+ a = c.current_profile
+ a = c.RightIndex
+ a = Test_int.backward_field
+ a = Test_int.LeftIndex
+ a = Test_int.cavity_flags
+except:
+ raise RuntimeError
+
+
+if Foo.BAZ.val != 2*Foo.BAR.val:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/std_containers_runme.py b/trunk/Examples/test-suite/python/std_containers_runme.py
new file mode 100644
index 000000000..bed59bb29
--- /dev/null
+++ b/trunk/Examples/test-suite/python/std_containers_runme.py
@@ -0,0 +1,119 @@
+import sys
+import std_containers
+
+
+cube = (((1, 2), (3, 4)), ((5, 6), (7, 8)))
+
+icube = std_containers.cident(cube)
+for i in range(0,len(cube)):
+ if cube[i] != icube[i]:
+ raise RuntimeError, "bad cident"
+
+
+p = (1,2)
+if p != std_containers.pident(p):
+ raise RuntimeError, "bad pident"
+
+v = (1,2,3,4,5,6)
+iv = std_containers.vident(v)
+for i in range(0,len(v)):
+ if v[i] != iv[i]:
+ raise RuntimeError, "bad vident"
+
+
+
+iv = std_containers.videntu(v)
+for i in range(0,len(v)):
+ if v[i] != iv[i]:
+ raise RuntimeError, "bad videntu"
+
+
+vu = std_containers.vector_ui(v)
+if vu[2] != std_containers.videntu(vu)[2]:
+ raise RuntimeError, "bad videntu"
+
+
+if v[0:3][1] != vu[0:3][1]:
+ print v[0:3][1], vu[0:3][1]
+ raise RuntimeError, "bad getslice"
+
+
+m = ((1,2,3),(2,3),(3,4))
+im = std_containers.midenti(m)
+
+for i in range(0,len(m)):
+ for j in range(0,len(m[i])):
+ if m[i][j] != im[i][j]:
+ raise RuntimeError, "bad getslice"
+
+m = ((1,0,1),(1,1),(1,1))
+im = std_containers.midentb(m)
+for i in range(0,len(m)):
+ for j in range(0,len(m[i])):
+ if m[i][j] != im[i][j]:
+ raise RuntimeError, "bad getslice"
+
+
+mi = std_containers.imatrix(m)
+mc = std_containers.cmatrix(m)
+if mi[0][1] != mc[0][1]:
+ raise RuntimeError, "bad matrix"
+
+
+map ={}
+map['hello'] = 1
+map['hi'] = 2
+map['3'] = 2
+
+imap = std_containers.mapident(map)
+for k in map:
+ if map[k] != imap[k]:
+ raise RuntimeError, "bad map"
+
+
+mapc ={}
+c1 = std_containers.C()
+c2 = std_containers.C()
+mapc[1] = c1.this
+mapc[2] = c2
+
+std_containers.mapidentc(mapc)
+
+
+vi = std_containers.vector_i((2,2,3,4))
+
+
+v = (1,2)
+v1 = std_containers.v_inout(vi)
+vi[1], v1[1]
+
+v1,v2 = ((1,2),(3,4))
+v1,v2 = std_containers.v_inout2(v1,v2)
+
+a1 = std_containers.A(1)
+a2 = std_containers.A(2)
+
+p1 = (1,a1)
+p2 = (2,a2)
+v = (p1,p2)
+v2= std_containers.pia_vident(v)
+
+v2[0][1].a
+v2[1][1].a
+
+v3 = std_containers.vector_piA(v2)
+
+v3[0][1].a
+v3[1][1].a
+
+s = std_containers.set_i()
+s.append(1)
+s.append(2)
+s.append(3)
+j=1
+for i in s:
+ if i != j:
+ raise RuntimeError
+ j = j + 1
+
+
diff --git a/trunk/Examples/test-suite/python/struct_initialization_runme.py b/trunk/Examples/test-suite/python/struct_initialization_runme.py
new file mode 100644
index 000000000..fbed6a5e9
--- /dev/null
+++ b/trunk/Examples/test-suite/python/struct_initialization_runme.py
@@ -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
+
diff --git a/trunk/Examples/test-suite/python/struct_rename_runme.py b/trunk/Examples/test-suite/python/struct_rename_runme.py
new file mode 100644
index 000000000..880c41639
--- /dev/null
+++ b/trunk/Examples/test-suite/python/struct_rename_runme.py
@@ -0,0 +1,3 @@
+import struct_rename
+
+b = struct_rename.Bar()
diff --git a/trunk/Examples/test-suite/python/struct_value_runme.py b/trunk/Examples/test-suite/python/struct_value_runme.py
new file mode 100644
index 000000000..727996f53
--- /dev/null
+++ b/trunk/Examples/test-suite/python/struct_value_runme.py
@@ -0,0 +1,9 @@
+import struct_value
+
+b = struct_value.Bar()
+
+b.a.x = 3
+if b.a.x != 3: raise RuntimeError
+
+b.b.x = 3
+if b.b.x != 3: raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/swigobject_runme.py b/trunk/Examples/test-suite/python/swigobject_runme.py
new file mode 100644
index 000000000..a906108e3
--- /dev/null
+++ b/trunk/Examples/test-suite/python/swigobject_runme.py
@@ -0,0 +1,34 @@
+
+from swigobject import *
+
+a = A()
+
+
+a1 = a_ptr(a)
+a2 = a_ptr(a)
+
+if a1.this != a2.this:
+ raise RuntimeError
+
+
+lthis = long(a.this)
+# match pointer value, but deal with leading zeros on 8/16 bit systems and different C++ compilers interpretation of %p
+xstr1 = "%016X" % (lthis,)
+xstr1 = str.lstrip(xstr1, '0')
+xstr2 = pointer_str(a)
+xstr2 = str.replace(xstr2, "0x", "")
+xstr2 = str.replace(xstr2, "0X", "")
+xstr2 = str.lstrip(xstr2, '0')
+xstr2 = str.upper(xstr2)
+
+if xstr1 != xstr2:
+ print xstr1, xstr2
+ raise RuntimeError
+
+s = str(a.this)
+r = repr(a.this)
+
+v1 = v_ptr(a)
+v2 = v_ptr(a)
+if long(v1) != long(v2):
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/template_construct_runme.py b/trunk/Examples/test-suite/python/template_construct_runme.py
new file mode 100644
index 000000000..3409fdd62
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_construct_runme.py
@@ -0,0 +1 @@
+import template_construct
diff --git a/trunk/Examples/test-suite/python/template_default_arg_runme.py b/trunk/Examples/test-suite/python/template_default_arg_runme.py
new file mode 100644
index 000000000..235a2313a
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_default_arg_runme.py
@@ -0,0 +1,98 @@
+import template_default_arg
+
+
+helloInt = template_default_arg.Hello_int()
+helloInt.foo(template_default_arg.Hello_int.hi)
+
+
+x = template_default_arg.X_int()
+if (x.meth(20.0, 200) != 200):
+ raise RuntimeError, ("X_int test 1 failed")
+if (x.meth(20) != 20):
+ raise RuntimeError, ("X_int test 2 failed")
+if (x.meth() != 0):
+ raise RuntimeError, ("X_int test 3 failed")
+
+
+
+y = template_default_arg.Y_unsigned()
+if (y.meth(20.0, 200) != 200):
+ raise RuntimeError, ("Y_unsigned test 1 failed")
+if (y.meth(20) != 20):
+ raise RuntimeError, ("Y_unsigned test 2 failed")
+if (y.meth() != 0):
+ raise RuntimeError, ("Y_unsigned test 3 failed")
+
+
+
+x = template_default_arg.X_longlong()
+x = template_default_arg.X_longlong(20.0)
+x = template_default_arg.X_longlong(20.0, 200L)
+
+
+x = template_default_arg.X_int()
+x = template_default_arg.X_int(20.0)
+x = template_default_arg.X_int(20.0, 200)
+
+
+x = template_default_arg.X_hello_unsigned()
+x = template_default_arg.X_hello_unsigned(20.0)
+x = template_default_arg.X_hello_unsigned(20.0, template_default_arg.Hello_int())
+
+
+y = template_default_arg.Y_hello_unsigned()
+y.meth(20.0, template_default_arg.Hello_int())
+y.meth(template_default_arg.Hello_int())
+y.meth()
+
+
+
+fz = template_default_arg.Foo_Z_8()
+x = template_default_arg.X_Foo_Z_8()
+fzc = x.meth(fz)
+
+
+# Templated functions
+
+# plain function: int ott(Foo<int>)
+if (template_default_arg.ott(template_default_arg.Foo_int()) != 30):
+ raise RuntimeError, ("ott test 1 failed")
+
+# %template(ott) ott<int, int>
+if (template_default_arg.ott() != 10):
+ raise RuntimeError, ("ott test 2 failed")
+if (template_default_arg.ott(1) != 10):
+ raise RuntimeError, ("ott test 3 failed")
+if (template_default_arg.ott(1, 1) != 10):
+ raise RuntimeError, ("ott test 4 failed")
+
+if (template_default_arg.ott("hi") != 20):
+ raise RuntimeError, ("ott test 5 failed")
+if (template_default_arg.ott("hi", 1) != 20):
+ raise RuntimeError, ("ott test 6 failed")
+if (template_default_arg.ott("hi", 1, 1) != 20):
+ raise RuntimeError, ("ott test 7 failed")
+
+# %template(ott) ott<const char *>
+if (template_default_arg.ottstring(template_default_arg.Hello_int(), "hi") != 40):
+ raise RuntimeError, ("ott test 8 failed")
+
+if (template_default_arg.ottstring(template_default_arg.Hello_int()) != 40):
+ raise RuntimeError, ("ott test 9 failed")
+
+# %template(ott) ott<int>
+if (template_default_arg.ottint(template_default_arg.Hello_int(), 1) != 50):
+ raise RuntimeError, ("ott test 10 failed")
+
+if (template_default_arg.ottint(template_default_arg.Hello_int()) != 50):
+ raise RuntimeError, ("ott test 11 failed")
+
+# %template(ott) ott<double>
+if (template_default_arg.ott(template_default_arg.Hello_int(), 1.0) != 60):
+ raise RuntimeError, ("ott test 12 failed")
+
+if (template_default_arg.ott(template_default_arg.Hello_int()) != 60):
+ raise RuntimeError, ("ott test 13 failed")
+
+
+
diff --git a/trunk/Examples/test-suite/python/template_extend1_runme.py b/trunk/Examples/test-suite/python/template_extend1_runme.py
new file mode 100644
index 000000000..b4679513a
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_extend1_runme.py
@@ -0,0 +1,10 @@
+import template_extend1
+
+a = template_extend1.lBaz()
+b = template_extend1.dBaz()
+
+if a.foo() != "lBaz::foo":
+ raise RuntimeError
+
+if b.foo() != "dBaz::foo":
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/template_extend2_runme.py b/trunk/Examples/test-suite/python/template_extend2_runme.py
new file mode 100644
index 000000000..a5f222fb6
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_extend2_runme.py
@@ -0,0 +1,10 @@
+import template_extend2
+
+a = template_extend2.lBaz()
+b = template_extend2.dBaz()
+
+if a.foo() != "lBaz::foo":
+ raise RuntimeError
+
+if b.foo() != "dBaz::foo":
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/template_inherit_runme.py b/trunk/Examples/test-suite/python/template_inherit_runme.py
new file mode 100644
index 000000000..bb1465a2b
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_inherit_runme.py
@@ -0,0 +1,53 @@
+from template_inherit import *
+a = FooInt()
+b = FooDouble()
+c = BarInt()
+d = BarDouble()
+e = FooUInt()
+f = BarUInt()
+
+if a.blah() != "Foo":
+ raise ValueError
+
+if b.blah() != "Foo":
+ raise ValueError
+
+if e.blah() != "Foo":
+ raise ValueError
+
+if c.blah() != "Bar":
+ raise ValueError
+
+if d.blah() != "Bar":
+ raise ValueError
+
+if f.blah() != "Bar":
+ raise ValueError
+
+if c.foomethod() != "foomethod":
+ raise ValueError
+
+if d.foomethod() != "foomethod":
+ raise ValueError
+
+if f.foomethod() != "foomethod":
+ raise ValueError
+
+if invoke_blah_int(a) != "Foo":
+ raise ValueError
+
+if invoke_blah_int(c) != "Bar":
+ raise ValueError
+
+if invoke_blah_double(b) != "Foo":
+ raise ValueError
+
+if invoke_blah_double(d) != "Bar":
+ raise ValueError
+
+if invoke_blah_uint(e) != "Foo":
+ raise ValueError
+
+if invoke_blah_uint(f) != "Bar":
+ raise ValueError
+
diff --git a/trunk/Examples/test-suite/python/template_matrix_runme.py b/trunk/Examples/test-suite/python/template_matrix_runme.py
new file mode 100644
index 000000000..95815a068
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_matrix_runme.py
@@ -0,0 +1,6 @@
+from template_matrix import *
+passVector([1,2,3])
+passMatrix([[1,2],[1,2,3]])
+passCube([[[1,2],[1,2,3]],[[1,2],[1,2,3]]])
+
+
diff --git a/trunk/Examples/test-suite/python/template_ns4_runme.py b/trunk/Examples/test-suite/python/template_ns4_runme.py
new file mode 100644
index 000000000..81107b493
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_ns4_runme.py
@@ -0,0 +1,5 @@
+from template_ns4 import *
+
+d = make_Class_DD();
+if d.test() != "test":
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/template_ns_runme.py b/trunk/Examples/test-suite/python/template_ns_runme.py
new file mode 100644
index 000000000..20cc9b99c
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_ns_runme.py
@@ -0,0 +1,17 @@
+from template_ns import *
+p1 = pairii(2,3)
+p2 = pairii(p1)
+
+if p2.first != 2:
+ raise RuntimeError
+if p2.second != 3:
+ raise RuntimeError
+
+p3 = pairdd(3.5,2.5)
+p4 = pairdd(p3)
+
+if p4.first != 3.5:
+ raise RuntimeError
+
+if p4.second != 2.5:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/template_opaque_runme.py b/trunk/Examples/test-suite/python/template_opaque_runme.py
new file mode 100644
index 000000000..f3aeb39d1
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_opaque_runme.py
@@ -0,0 +1,6 @@
+import template_opaque
+
+v = template_opaque.OpaqueVectorType(10)
+
+template_opaque.FillVector(v)
+
diff --git a/trunk/Examples/test-suite/python/template_ref_type_runme.py b/trunk/Examples/test-suite/python/template_ref_type_runme.py
new file mode 100644
index 000000000..0b3e4dd26
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_ref_type_runme.py
@@ -0,0 +1,5 @@
+import template_ref_type
+
+xr = template_ref_type.XC()
+y = template_ref_type.Y()
+y.find(xr)
diff --git a/trunk/Examples/test-suite/python/template_rename_runme.py b/trunk/Examples/test-suite/python/template_rename_runme.py
new file mode 100644
index 000000000..4f0e7e83e
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_rename_runme.py
@@ -0,0 +1,12 @@
+import template_rename
+
+i = template_rename.iFoo()
+d = template_rename.dFoo()
+
+a = i.blah_test(4)
+b = i.spam_test(5)
+c = i.groki_test(6)
+
+x = d.blah_test(7)
+y = d.spam(8)
+z = d.grok_test(9)
diff --git a/trunk/Examples/test-suite/python/template_static_runme.py b/trunk/Examples/test-suite/python/template_static_runme.py
new file mode 100644
index 000000000..9171d93b5
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_static_runme.py
@@ -0,0 +1,3 @@
+from template_static import *
+
+Foo_bar_double(1)
diff --git a/trunk/Examples/test-suite/python/template_tbase_template_runme.py b/trunk/Examples/test-suite/python/template_tbase_template_runme.py
new file mode 100644
index 000000000..d13c5f2c2
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_tbase_template_runme.py
@@ -0,0 +1,5 @@
+from template_tbase_template import *
+
+a = make_Class_dd()
+if a.test() != "test":
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/template_type_namespace_runme.py b/trunk/Examples/test-suite/python/template_type_namespace_runme.py
new file mode 100644
index 000000000..19ea5f5ce
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_type_namespace_runme.py
@@ -0,0 +1,5 @@
+from template_type_namespace import *
+
+if type(foo()[0]) != type(""):
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/template_typedef_cplx2_runme.py b/trunk/Examples/test-suite/python/template_typedef_cplx2_runme.py
new file mode 100644
index 000000000..04c599329
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_typedef_cplx2_runme.py
@@ -0,0 +1,94 @@
+from template_typedef_cplx2 import *
+
+#
+# double case
+#
+
+try:
+ d = make_Identity_double()
+ a = d.this
+except:
+ print d, "is not an instance"
+ raise RuntimeError
+
+s = '%s' % d
+if str.find(s, 'ArithUnaryFunction') == -1:
+ print d, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+try:
+ e = make_Multiplies_double_double_double_double(d, d)
+ a = e.this
+except:
+ print e, "is not an instance"
+ raise RuntimeError
+
+s = '%s' % e
+if str.find(s, 'ArithUnaryFunction') == -1:
+ print e, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+
+#
+# complex case
+#
+
+try:
+ c = make_Identity_complex()
+ a = c.this
+except:
+ print c, "is not an instance"
+ raise RuntimeError
+
+s = '%s' % c
+if str.find(s, 'ArithUnaryFunction') == -1:
+ print c, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+try:
+ f = make_Multiplies_complex_complex_complex_complex(c, c)
+ a = f.this
+except:
+ print f, "is not an instance"
+ raise RuntimeError
+
+s = '%s' % f
+if str.find(s, 'ArithUnaryFunction') == -1:
+ print f, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+#
+# Mix case
+#
+
+try:
+ g = make_Multiplies_double_double_complex_complex(d, c)
+ a = g.this
+except:
+ print g, "is not an instance"
+ raise RuntimeError
+
+s = '%s' % g
+if str.find(s, 'ArithUnaryFunction') == -1:
+ print g, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+
+try:
+ h = make_Multiplies_complex_complex_double_double(c, d)
+ a = h.this
+except:
+ print h, "is not an instance"
+ raise RuntimeError
+
+s = '%s' % h
+if str.find(s, 'ArithUnaryFunction') == -1:
+ print h, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+try:
+ a = g.get_value()
+except:
+ print g, "has not get_value() method"
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/template_typedef_cplx3_runme.py b/trunk/Examples/test-suite/python/template_typedef_cplx3_runme.py
new file mode 100644
index 000000000..b8ac1b6ef
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_typedef_cplx3_runme.py
@@ -0,0 +1,34 @@
+import string
+from template_typedef_cplx3 import *
+
+#
+# this is OK
+#
+
+
+s = Sin()
+s.get_base_value()
+s.get_value()
+s.get_arith_value()
+my_func_r(s)
+make_Multiplies_double_double_double_double(s,s)
+
+z = CSin()
+z.get_base_value()
+z.get_value()
+z.get_arith_value()
+my_func_c(z)
+make_Multiplies_complex_complex_complex_complex(z,z)
+
+#
+# Here we fail
+#
+d = make_Identity_double()
+my_func_r(d)
+
+c = make_Identity_complex()
+my_func_c(c)
+
+
+
+
diff --git a/trunk/Examples/test-suite/python/template_typedef_cplx4_runme.py b/trunk/Examples/test-suite/python/template_typedef_cplx4_runme.py
new file mode 100644
index 000000000..faeca219f
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_typedef_cplx4_runme.py
@@ -0,0 +1,34 @@
+import string
+from template_typedef_cplx4 import *
+
+#
+# this is OK
+#
+
+
+s = Sin()
+s.get_base_value()
+s.get_value()
+s.get_arith_value()
+my_func_r(s)
+make_Multiplies_double_double_double_double(s,s)
+
+z = CSin()
+z.get_base_value()
+z.get_value()
+z.get_arith_value()
+my_func_c(z)
+make_Multiplies_complex_complex_complex_complex(z,z)
+
+#
+# Here we fail
+#
+d = make_Identity_double()
+my_func_r(d)
+
+c = make_Identity_complex()
+my_func_c(c)
+
+
+
+
diff --git a/trunk/Examples/test-suite/python/template_typedef_cplx_runme.py b/trunk/Examples/test-suite/python/template_typedef_cplx_runme.py
new file mode 100644
index 000000000..2cd9c8348
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_typedef_cplx_runme.py
@@ -0,0 +1,87 @@
+from template_typedef_cplx import *
+
+#
+# double case
+#
+
+try:
+ d = make_Identity_double()
+ a = d.this
+except:
+ print d, "is not an instance"
+ raise RuntimeError
+
+s = '%s' % d
+if str.find(s, 'ArithUnaryFunction') == -1:
+ print d, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+try:
+ e = make_Multiplies_double_double_double_double(d, d)
+ a = e.this
+except:
+ print e, "is not an instance"
+ raise RuntimeError
+
+s = '%s' % e
+if str.find(s, 'ArithUnaryFunction') == -1:
+ print e, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+
+#
+# complex case
+#
+
+try:
+ c = make_Identity_complex()
+ a = c.this
+except:
+ print c, "is not an instance"
+ raise RuntimeError
+
+s = '%s' % c
+if str.find(s, 'ArithUnaryFunction') == -1:
+ print c, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+try:
+ f = make_Multiplies_complex_complex_complex_complex(c, c)
+ a = f.this
+except:
+ print f, "is not an instance"
+ raise RuntimeError
+
+s = '%s' % f
+if str.find(s, 'ArithUnaryFunction') == -1:
+ print f, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+#
+# Mix case
+#
+
+try:
+ g = make_Multiplies_double_double_complex_complex(d, c)
+ a = g.this
+except:
+ print g, "is not an instance"
+ raise RuntimeError
+
+s = '%s' % g
+if str.find(s, 'ArithUnaryFunction') == -1:
+ print g, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+
+try:
+ h = make_Multiplies_complex_complex_double_double(c, d)
+ a = h.this
+except:
+ print h, "is not an instance"
+ raise RuntimeError
+
+s = '%s' % h
+if str.find(s, 'ArithUnaryFunction') == -1:
+ print h, "is not an ArithUnaryFunction"
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/template_typedef_import_runme.py b/trunk/Examples/test-suite/python/template_typedef_import_runme.py
new file mode 100644
index 000000000..5c0b0b936
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_typedef_import_runme.py
@@ -0,0 +1,34 @@
+from template_typedef_cplx2 import *
+from template_typedef_import import *
+
+#
+# this is OK
+#
+
+
+s = Sin()
+s.get_base_value()
+s.get_value()
+s.get_arith_value()
+my_func_r(s)
+make_Multiplies_double_double_double_double(s,s)
+
+z = CSin()
+z.get_base_value()
+z.get_value()
+z.get_arith_value()
+my_func_c(z)
+make_Multiplies_complex_complex_complex_complex(z,z)
+
+#
+# Here we fail
+#
+d = make_Identity_double()
+my_func_r(d)
+
+c = make_Identity_complex()
+my_func_c(c)
+
+
+
+
diff --git a/trunk/Examples/test-suite/python/template_typedef_runme.py b/trunk/Examples/test-suite/python/template_typedef_runme.py
new file mode 100644
index 000000000..4b3970593
--- /dev/null
+++ b/trunk/Examples/test-suite/python/template_typedef_runme.py
@@ -0,0 +1,46 @@
+from template_typedef import *
+
+d = make_Identity_float()
+c = make_Identity_reald()
+
+
+try:
+ a = d.this
+ a = c.this
+except:
+ raise RuntimeError
+
+try:
+ e = make_Multiplies_float_float_float_float(d, d)
+ a = e.this
+except:
+ print e, "is not an instance"
+ raise RuntimeError
+
+try:
+ f = make_Multiplies_reald_reald_reald_reald(c, c)
+ a = f.this
+except:
+ print f, "is not an instance"
+ raise RuntimeError
+
+try:
+ g = make_Multiplies_float_float_reald_reald(d, c)
+ a = g.this
+except:
+ print g, "is not an instance"
+ raise RuntimeError
+
+
+# the old large format
+if not SWIG_TypeQuery("vfncs::ArithUnaryFunction<vfncs::arith_traits<float,double>::argument_type,vfncs::arith_traits<float,double >::result_type > *"):
+ raise RuntimeError
+
+
+# the reduced format
+if not SWIG_TypeQuery("vfncs::ArithUnaryFunction<double,double> *"):
+ raise RuntimeError
+
+# this is a bad name
+if SWIG_TypeQuery("vfncs::ArithUnaryFunction<double,doublex> *"):
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/threads_exception_runme.py b/trunk/Examples/test-suite/python/threads_exception_runme.py
new file mode 100755
index 000000000..9fbc6a9b2
--- /dev/null
+++ b/trunk/Examples/test-suite/python/threads_exception_runme.py
@@ -0,0 +1,36 @@
+import threads_exception
+
+t = threads_exception.Test()
+try:
+ t.unknown()
+except RuntimeError,e:
+ pass
+
+try:
+ t.simple()
+except RuntimeError,e:
+ if e.args[0] != 37:
+ raise RuntimeError
+
+try:
+ t.message()
+except RuntimeError,e:
+ if e.args[0] != "I died.":
+ raise RuntimeError
+
+try:
+ t.hosed()
+except threads_exception.Exc,e:
+ if e.code != 42:
+ raise RuntimeError
+ if e.msg != "Hosed":
+ raise RuntimeError
+
+for i in range(1,4):
+ try:
+ t.multi(i)
+ except RuntimeError,e:
+ pass
+ except threads_exception.Exc,e:
+ pass
+
diff --git a/trunk/Examples/test-suite/python/typedef_class_runme.py b/trunk/Examples/test-suite/python/typedef_class_runme.py
new file mode 100644
index 000000000..71436b399
--- /dev/null
+++ b/trunk/Examples/test-suite/python/typedef_class_runme.py
@@ -0,0 +1,7 @@
+import typedef_class
+
+a = typedef_class.RealA()
+a.a = 3
+
+b = typedef_class.B()
+b.testA(a)
diff --git a/trunk/Examples/test-suite/python/typedef_inherit_runme.py b/trunk/Examples/test-suite/python/typedef_inherit_runme.py
new file mode 100644
index 000000000..6b7f2d872
--- /dev/null
+++ b/trunk/Examples/test-suite/python/typedef_inherit_runme.py
@@ -0,0 +1,23 @@
+import typedef_inherit
+
+a = typedef_inherit.Foo()
+b = typedef_inherit.Bar()
+
+x = typedef_inherit.do_blah(a)
+if x != "Foo::blah":
+ print "Whoa! Bad return", x
+
+x = typedef_inherit.do_blah(b)
+if x != "Bar::blah":
+ print "Whoa! Bad return", x
+
+c = typedef_inherit.Spam()
+d = typedef_inherit.Grok()
+
+x = typedef_inherit.do_blah2(c)
+if x != "Spam::blah":
+ print "Whoa! Bad return", x
+
+x = typedef_inherit.do_blah2(d)
+if x != "Grok::blah":
+ print "Whoa! Bad return", x
diff --git a/trunk/Examples/test-suite/python/typedef_scope_runme.py b/trunk/Examples/test-suite/python/typedef_scope_runme.py
new file mode 100644
index 000000000..37bfc97b1
--- /dev/null
+++ b/trunk/Examples/test-suite/python/typedef_scope_runme.py
@@ -0,0 +1,12 @@
+import typedef_scope
+
+b = typedef_scope.Bar()
+x = b.test1(42,"hello")
+if x != 42:
+ print "Failed!!"
+
+x = b.test2(42,"hello")
+if x != "hello":
+ print "Failed!!"
+
+
diff --git a/trunk/Examples/test-suite/python/typemap_delete_runme.py b/trunk/Examples/test-suite/python/typemap_delete_runme.py
new file mode 100644
index 000000000..582a2167c
--- /dev/null
+++ b/trunk/Examples/test-suite/python/typemap_delete_runme.py
@@ -0,0 +1,5 @@
+import typemap_delete
+
+r = typemap_delete.Rect(123)
+if r.val != 123:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/typemap_namespace_runme.py b/trunk/Examples/test-suite/python/typemap_namespace_runme.py
new file mode 100644
index 000000000..581a0f437
--- /dev/null
+++ b/trunk/Examples/test-suite/python/typemap_namespace_runme.py
@@ -0,0 +1,8 @@
+from typemap_namespace import *
+
+if test1("hello") != "hello":
+ raise RuntimeError
+
+if test2("hello") != "hello":
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/typemap_ns_using_runme.py b/trunk/Examples/test-suite/python/typemap_ns_using_runme.py
new file mode 100644
index 000000000..802ea7f56
--- /dev/null
+++ b/trunk/Examples/test-suite/python/typemap_ns_using_runme.py
@@ -0,0 +1,4 @@
+import typemap_ns_using
+
+if typemap_ns_using.spam(37) != 37:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/typemap_out_optimal_runme.py b/trunk/Examples/test-suite/python/typemap_out_optimal_runme.py
new file mode 100644
index 000000000..b148f2d06
--- /dev/null
+++ b/trunk/Examples/test-suite/python/typemap_out_optimal_runme.py
@@ -0,0 +1,5 @@
+from typemap_out_optimal import *
+
+cvar.XX_debug = False
+x = XX.create()
+
diff --git a/trunk/Examples/test-suite/python/typemap_qualifier_strip_runme.py b/trunk/Examples/test-suite/python/typemap_qualifier_strip_runme.py
new file mode 100644
index 000000000..5e466cf69
--- /dev/null
+++ b/trunk/Examples/test-suite/python/typemap_qualifier_strip_runme.py
@@ -0,0 +1,54 @@
+import typemap_qualifier_strip
+
+val = typemap_qualifier_strip.create_int(111)
+if typemap_qualifier_strip.testA1(val) != 1234:
+ raise RuntimeError
+
+if typemap_qualifier_strip.testA2(val) != 1234:
+ raise RuntimeError
+
+if typemap_qualifier_strip.testA3(val) != 1234:
+ raise RuntimeError
+
+if typemap_qualifier_strip.testA4(val) != 1234:
+ raise RuntimeError
+
+
+if typemap_qualifier_strip.testB1(val) != 111:
+ raise RuntimeError
+
+if typemap_qualifier_strip.testB2(val) != 111:
+ raise RuntimeError
+
+if typemap_qualifier_strip.testB3(val) != 111:
+ raise RuntimeError
+
+if typemap_qualifier_strip.testB4(val) != 111:
+ raise RuntimeError
+
+
+if typemap_qualifier_strip.testC1(val) != 5678:
+ raise RuntimeError
+
+if typemap_qualifier_strip.testC2(val) != 111:
+ raise RuntimeError
+
+if typemap_qualifier_strip.testC3(val) != 5678:
+ raise RuntimeError
+
+if typemap_qualifier_strip.testC4(val) != 111:
+ raise RuntimeError
+
+
+if typemap_qualifier_strip.testD1(val) != 111:
+ raise RuntimeError
+
+if typemap_qualifier_strip.testD2(val) != 3456:
+ raise RuntimeError
+
+if typemap_qualifier_strip.testD3(val) != 111:
+ raise RuntimeError
+
+if typemap_qualifier_strip.testD4(val) != 111:
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/typename_runme.py b/trunk/Examples/test-suite/python/typename_runme.py
new file mode 100644
index 000000000..59a0f1f76
--- /dev/null
+++ b/trunk/Examples/test-suite/python/typename_runme.py
@@ -0,0 +1,12 @@
+import typename
+import types
+f = typename.Foo()
+b = typename.Bar()
+
+x = typename.twoFoo(f)
+if not isinstance(x,types.FloatType):
+ print "Wrong return type!"
+y = typename.twoBar(b)
+if not isinstance(y,types.IntType):
+ print "Wrong return type!"
+
diff --git a/trunk/Examples/test-suite/python/types_directive_runme.py b/trunk/Examples/test-suite/python/types_directive_runme.py
new file mode 100644
index 000000000..c28453e84
--- /dev/null
+++ b/trunk/Examples/test-suite/python/types_directive_runme.py
@@ -0,0 +1,12 @@
+from types_directive import *
+
+d1 = Time1(2001, 2, 3, 60)
+newDate = add(d1, 7) # check that a Time1 instance is accepted where Date is expected
+if newDate.day != 10:
+ raise RuntimeError
+
+d2 = Time2(1999, 8, 7, 60)
+newDate = add(d2, 7) # check that a Time2 instance is accepted where Date is expected
+if newDate.day != 14:
+ raise RuntimeError
+
diff --git a/trunk/Examples/test-suite/python/unions_runme.py b/trunk/Examples/test-suite/python/unions_runme.py
new file mode 100644
index 000000000..d59e2429e
--- /dev/null
+++ b/trunk/Examples/test-suite/python/unions_runme.py
@@ -0,0 +1,51 @@
+
+# This is the union runtime testcase. It ensures that values within a
+# union embedded within a struct can be set and read correctly.
+
+import unions
+import sys
+import string
+
+# Create new instances of SmallStruct and BigStruct for later use
+small = unions.SmallStruct()
+small.jill = 200
+
+big = unions.BigStruct()
+big.smallstruct = small
+big.jack = 300
+
+# Use SmallStruct then BigStruct to setup EmbeddedUnionTest.
+# Ensure values in EmbeddedUnionTest are set correctly for each.
+eut = unions.EmbeddedUnionTest()
+
+# First check the SmallStruct in EmbeddedUnionTest
+eut.number = 1
+eut.uni.small = small
+Jill1 = eut.uni.small.jill
+if (Jill1 != 200):
+ print "Runtime test1 failed. eut.uni.small.jill=" , Jill1
+ sys.exit(1)
+
+Num1 = eut.number
+if (Num1 != 1):
+ print "Runtime test2 failed. eut.number=" , Num1
+ sys.exit(1)
+
+# Secondly check the BigStruct in EmbeddedUnionTest
+eut.number = 2
+eut.uni.big = big
+Jack1 = eut.uni.big.jack
+if (Jack1 != 300):
+ print "Runtime test3 failed. eut.uni.big.jack=" , Jack1
+ sys.exit(1)
+
+Jill2 = eut.uni.big.smallstruct.jill
+if (Jill2 != 200):
+ print "Runtime test4 failed. eut.uni.big.smallstruct.jill=" , Jill2
+ sys.exit(1)
+
+Num2 = eut.number
+if (Num2 != 2):
+ print "Runtime test5 failed. eut.number=" , Num2
+ sys.exit(1)
+
diff --git a/trunk/Examples/test-suite/python/using1_runme.py b/trunk/Examples/test-suite/python/using1_runme.py
new file mode 100644
index 000000000..5556c1b6a
--- /dev/null
+++ b/trunk/Examples/test-suite/python/using1_runme.py
@@ -0,0 +1,4 @@
+import using1
+
+if using1.spam(37) != 37:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/using2_runme.py b/trunk/Examples/test-suite/python/using2_runme.py
new file mode 100644
index 000000000..cf657d734
--- /dev/null
+++ b/trunk/Examples/test-suite/python/using2_runme.py
@@ -0,0 +1,4 @@
+import using2
+
+if using2.spam(37) != 37:
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/using_composition_runme.py b/trunk/Examples/test-suite/python/using_composition_runme.py
new file mode 100644
index 000000000..6baa16d13
--- /dev/null
+++ b/trunk/Examples/test-suite/python/using_composition_runme.py
@@ -0,0 +1,34 @@
+from using_composition import *
+
+f = FooBar()
+if f.blah(3) != 3:
+ raise RuntimeError,"FooBar::blah(int)"
+
+if f.blah(3.5) != 3.5:
+ raise RuntimeError,"FooBar::blah(double)"
+
+if f.blah("hello") != "hello":
+ raise RuntimeError,"FooBar::blah(char *)"
+
+
+f = FooBar2()
+if f.blah(3) != 3:
+ raise RuntimeError,"FooBar2::blah(int)"
+
+if f.blah(3.5) != 3.5:
+ raise RuntimeError,"FooBar2::blah(double)"
+
+if f.blah("hello") != "hello":
+ raise RuntimeError,"FooBar2::blah(char *)"
+
+
+f = FooBar3()
+if f.blah(3) != 3:
+ raise RuntimeError,"FooBar3::blah(int)"
+
+if f.blah(3.5) != 3.5:
+ raise RuntimeError,"FooBar3::blah(double)"
+
+if f.blah("hello") != "hello":
+ raise RuntimeError,"FooBar3::blah(char *)"
+
diff --git a/trunk/Examples/test-suite/python/using_extend_runme.py b/trunk/Examples/test-suite/python/using_extend_runme.py
new file mode 100644
index 000000000..14615a05e
--- /dev/null
+++ b/trunk/Examples/test-suite/python/using_extend_runme.py
@@ -0,0 +1,21 @@
+from using_extend import *
+
+f = FooBar()
+if f.blah(3) != 3:
+ raise RuntimeError,"blah(int)"
+
+if f.blah(3.5) != 3.5:
+ raise RuntimeError,"blah(double)"
+
+if f.blah("hello") != "hello":
+ raise RuntimeError,"blah(char *)"
+
+if f.blah(3,4) != 7:
+ raise RuntimeError,"blah(int,int)"
+
+if f.blah(3.5,7.5) != (3.5+7.5):
+ raise RuntimeError,"blah(double,double)"
+
+
+if f.duh(3) != 3:
+ raise RuntimeError,"duh(int)"
diff --git a/trunk/Examples/test-suite/python/using_inherit_runme.py b/trunk/Examples/test-suite/python/using_inherit_runme.py
new file mode 100644
index 000000000..b00e66ec3
--- /dev/null
+++ b/trunk/Examples/test-suite/python/using_inherit_runme.py
@@ -0,0 +1,49 @@
+from using_inherit import *
+
+b = Bar()
+if b.test(3) != 3:
+ raise RuntimeError,"Bar::test(int)"
+
+if b.test(3.5) != 3.5:
+ raise RuntimeError, "Bar::test(double)"
+
+
+b = Bar2()
+if b.test(3) != 6:
+ raise RuntimeError,"Bar2::test(int)"
+
+if b.test(3.5) != 7.0:
+ raise RuntimeError, "Bar2::test(double)"
+
+
+b = Bar3()
+if b.test(3) != 6:
+ raise RuntimeError,"Bar3::test(int)"
+
+if b.test(3.5) != 7.0:
+ raise RuntimeError, "Bar3::test(double)"
+
+
+b = Bar4()
+if b.test(3) != 6:
+ raise RuntimeError,"Bar4::test(int)"
+
+if b.test(3.5) != 7.0:
+ raise RuntimeError, "Bar4::test(double)"
+
+
+b = Fred1()
+if b.test(3) != 3:
+ raise RuntimeError,"Fred1::test(int)"
+
+if b.test(3.5) != 7.0:
+ raise RuntimeError, "Fred1::test(double)"
+
+
+b = Fred2()
+if b.test(3) != 3:
+ raise RuntimeError,"Fred2::test(int)"
+
+if b.test(3.5) != 7.0:
+ raise RuntimeError, "Fred2::test(double)"
+
diff --git a/trunk/Examples/test-suite/python/using_private_runme.py b/trunk/Examples/test-suite/python/using_private_runme.py
new file mode 100644
index 000000000..00c9a8d25
--- /dev/null
+++ b/trunk/Examples/test-suite/python/using_private_runme.py
@@ -0,0 +1,13 @@
+from using_private import *
+
+f = FooBar()
+f.x = 3
+
+if f.blah(4) != 4:
+ raise RuntimeError, "blah(int)"
+
+if f.defaulted() != -1:
+ raise RuntimeError, "defaulted()"
+
+if f.defaulted(222) != 222:
+ raise RuntimeError, "defaulted(222)"
diff --git a/trunk/Examples/test-suite/python/using_protected_runme.py b/trunk/Examples/test-suite/python/using_protected_runme.py
new file mode 100644
index 000000000..525a1cde4
--- /dev/null
+++ b/trunk/Examples/test-suite/python/using_protected_runme.py
@@ -0,0 +1,7 @@
+from using_protected import *
+
+f = FooBar()
+f.x = 3
+
+if f.blah(4) != 4:
+ raise RuntimeError, "blah(int)"
diff --git a/trunk/Examples/test-suite/python/varargs_runme.py b/trunk/Examples/test-suite/python/varargs_runme.py
new file mode 100644
index 000000000..301de78a7
--- /dev/null
+++ b/trunk/Examples/test-suite/python/varargs_runme.py
@@ -0,0 +1,18 @@
+import varargs
+
+if varargs.test("Hello") != "Hello":
+ raise RuntimeError, "Failed"
+
+f = varargs.Foo("Greetings")
+if f.str != "Greetings":
+ raise RuntimeError, "Failed"
+
+if f.test("Hello") != "Hello":
+ raise RuntimeError, "Failed"
+
+
+if varargs.test_def("Hello",1) != "Hello":
+ raise RuntimeError, "Failed"
+
+if varargs.test_def("Hello") != "Hello":
+ raise RuntimeError, "Failed"
diff --git a/trunk/Examples/test-suite/python/virtual_derivation_runme.py b/trunk/Examples/test-suite/python/virtual_derivation_runme.py
new file mode 100644
index 000000000..8a6e743af
--- /dev/null
+++ b/trunk/Examples/test-suite/python/virtual_derivation_runme.py
@@ -0,0 +1,8 @@
+from virtual_derivation import *
+#
+# very innocent example
+#
+b = B(3)
+if b.get_a() != b.get_b():
+ raise RuntimeError, "something is really wrong"
+
diff --git a/trunk/Examples/test-suite/python/virtual_poly_runme.py b/trunk/Examples/test-suite/python/virtual_poly_runme.py
new file mode 100644
index 000000000..7e202f9cf
--- /dev/null
+++ b/trunk/Examples/test-suite/python/virtual_poly_runme.py
@@ -0,0 +1,38 @@
+import virtual_poly
+
+d = virtual_poly.NDouble(3.5)
+i = virtual_poly.NInt(2)
+
+#
+# the copy methods return the right polymorphic types
+#
+dc = d.copy()
+ic = i.copy()
+
+if d.get() != dc.get():
+ raise RuntimeError
+
+if i.get() != ic.get():
+ raise RuntimeError
+
+virtual_poly.incr(ic)
+
+if (i.get() + 1) != ic.get():
+ raise RuntimeError
+
+
+dr = d.ref_this()
+if d.get() != dr.get():
+ raise RuntimeError
+
+
+#
+# 'narrowing' also works
+#
+ddc = virtual_poly.NDouble_narrow(d.nnumber())
+if d.get() != ddc.get():
+ raise RuntimeError
+
+dic = virtual_poly.NInt_narrow(i.nnumber())
+if i.get() != dic.get():
+ raise RuntimeError
diff --git a/trunk/Examples/test-suite/python/voidtest_runme.py b/trunk/Examples/test-suite/python/voidtest_runme.py
new file mode 100644
index 000000000..a7b421d6e
--- /dev/null
+++ b/trunk/Examples/test-suite/python/voidtest_runme.py
@@ -0,0 +1,29 @@
+import voidtest
+
+voidtest.globalfunc()
+f = voidtest.Foo()
+f.memberfunc()
+
+voidtest.Foo_staticmemberfunc()
+
+def fvoid():
+ pass
+
+if f.memberfunc() != fvoid():
+ raise RuntimeError
+
+
+v1 = voidtest.vfunc1(f)
+v2 = voidtest.vfunc2(f)
+if v1 != v2:
+ raise RuntimeError
+
+v3 = voidtest.vfunc3(v1)
+if v3.this != f.this:
+ raise RuntimeError
+v4 = voidtest.vfunc1(f)
+if v4 != v1:
+ raise RuntimeError
+
+
+v3.memberfunc()
diff --git a/trunk/Examples/test-suite/python/wrapmacro_runme.py b/trunk/Examples/test-suite/python/wrapmacro_runme.py
new file mode 100644
index 000000000..0272afd5d
--- /dev/null
+++ b/trunk/Examples/test-suite/python/wrapmacro_runme.py
@@ -0,0 +1,7 @@
+import wrapmacro
+
+a = 2
+b = -1
+wrapmacro.maximum(a,b)
+wrapmacro.maximum(a/7.0, -b*256)
+wrapmacro.GUINT16_SWAP_LE_BE_CONSTANT(1)