summaryrefslogtreecommitdiff
path: root/trunk/Examples/test-suite/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/Examples/test-suite/ruby')
-rw-r--r--trunk/Examples/test-suite/ruby/Makefile.in71
-rw-r--r--trunk/Examples/test-suite/ruby/README4
-rwxr-xr-xtrunk/Examples/test-suite/ruby/abstract_access_runme.rb34
-rw-r--r--trunk/Examples/test-suite/ruby/abstract_inherit_ok_runme.rb48
-rw-r--r--trunk/Examples/test-suite/ruby/abstract_inherit_runme.rb61
-rw-r--r--trunk/Examples/test-suite/ruby/abstract_signature_runme.rb62
-rw-r--r--trunk/Examples/test-suite/ruby/abstract_typedef2_runme.rb17
-rw-r--r--trunk/Examples/test-suite/ruby/abstract_typedef_runme.rb23
-rw-r--r--trunk/Examples/test-suite/ruby/abstract_virtual_runme.rb16
-rwxr-xr-xtrunk/Examples/test-suite/ruby/access_change_runme.rb46
-rwxr-xr-xtrunk/Examples/test-suite/ruby/add_link_runme.rb20
-rw-r--r--trunk/Examples/test-suite/ruby/aggregate_runme.rb37
-rwxr-xr-xtrunk/Examples/test-suite/ruby/anonymous_bitfield_runme.rb35
-rwxr-xr-xtrunk/Examples/test-suite/ruby/apply_signed_char_runme.rb45
-rwxr-xr-xtrunk/Examples/test-suite/ruby/apply_strings_runme.rb61
-rwxr-xr-xtrunk/Examples/test-suite/ruby/argout_runme.rb42
-rw-r--r--trunk/Examples/test-suite/ruby/array_member_runme.rb36
-rw-r--r--trunk/Examples/test-suite/ruby/arrays_global_runme.rb15
-rwxr-xr-xtrunk/Examples/test-suite/ruby/arrays_runme.rb25
-rw-r--r--trunk/Examples/test-suite/ruby/bools_runme.rb82
-rwxr-xr-xtrunk/Examples/test-suite/ruby/cast_operator_runme.rb17
-rwxr-xr-xtrunk/Examples/test-suite/ruby/casts_runme.rb23
-rw-r--r--trunk/Examples/test-suite/ruby/char_constant_runme.rb34
-rwxr-xr-xtrunk/Examples/test-suite/ruby/check_missing_tests.rb53
-rwxr-xr-xtrunk/Examples/test-suite/ruby/class_ignore_runme.rb21
-rwxr-xr-xtrunk/Examples/test-suite/ruby/const_const_runme.rb14
-rwxr-xr-xtrunk/Examples/test-suite/ruby/constover_runme.rb55
-rwxr-xr-xtrunk/Examples/test-suite/ruby/cpp_namespace_runme.rb62
-rwxr-xr-xtrunk/Examples/test-suite/ruby/default_constructor_runme.rb153
-rw-r--r--trunk/Examples/test-suite/ruby/director_abstract_runme.rb42
-rw-r--r--trunk/Examples/test-suite/ruby/director_basic_runme.rb36
-rw-r--r--trunk/Examples/test-suite/ruby/director_constructor_runme.rb37
-rw-r--r--trunk/Examples/test-suite/ruby/director_default_runme.rb30
-rw-r--r--trunk/Examples/test-suite/ruby/director_detect_runme.rb54
-rw-r--r--trunk/Examples/test-suite/ruby/director_exception_runme.rb70
-rw-r--r--trunk/Examples/test-suite/ruby/director_frob_runme.rb17
-rw-r--r--trunk/Examples/test-suite/ruby/director_nested_runme.rb54
-rw-r--r--trunk/Examples/test-suite/ruby/director_protected_runme.rb45
-rw-r--r--trunk/Examples/test-suite/ruby/director_string_runme.rb24
-rw-r--r--trunk/Examples/test-suite/ruby/director_unroll_runme.rb28
-rw-r--r--trunk/Examples/test-suite/ruby/director_wombat_runme.rb60
-rw-r--r--trunk/Examples/test-suite/ruby/disown_runme.rb20
-rwxr-xr-xtrunk/Examples/test-suite/ruby/dynamic_cast_runme.rb24
-rwxr-xr-xtrunk/Examples/test-suite/ruby/enum_thorough_runme.rb19
-rw-r--r--trunk/Examples/test-suite/ruby/enums_runme.rb34
-rw-r--r--trunk/Examples/test-suite/ruby/extend_template_ns_runme.rb23
-rw-r--r--trunk/Examples/test-suite/ruby/extend_template_runme.rb21
-rw-r--r--trunk/Examples/test-suite/ruby/friends_runme.rb19
-rwxr-xr-xtrunk/Examples/test-suite/ruby/function_typedef_runme.rb11
-rw-r--r--trunk/Examples/test-suite/ruby/grouping_runme.rb26
-rw-r--r--trunk/Examples/test-suite/ruby/ignore_parameter_runme.rb34
-rwxr-xr-xtrunk/Examples/test-suite/ruby/imports_runme.rb20
-rw-r--r--trunk/Examples/test-suite/ruby/inherit_missing_runme.rb31
-rwxr-xr-xtrunk/Examples/test-suite/ruby/integers_runme.rb21
-rw-r--r--trunk/Examples/test-suite/ruby/li_carrays_runme.rb36
-rwxr-xr-xtrunk/Examples/test-suite/ruby/li_cstring_runme.rb22
-rw-r--r--trunk/Examples/test-suite/ruby/li_factory_runme.rb38
-rwxr-xr-xtrunk/Examples/test-suite/ruby/li_math_runme.rb13
-rw-r--r--trunk/Examples/test-suite/ruby/li_std_deque_runme.rb55
-rwxr-xr-xtrunk/Examples/test-suite/ruby/li_std_functors_runme.rb70
-rwxr-xr-xtrunk/Examples/test-suite/ruby/li_std_map_runme.rb51
-rwxr-xr-xtrunk/Examples/test-suite/ruby/li_std_multimap_runme.rb27
-rw-r--r--trunk/Examples/test-suite/ruby/li_std_pair_lang_object_runme.rb19
-rwxr-xr-xtrunk/Examples/test-suite/ruby/li_std_pair_runme.rb57
-rwxr-xr-xtrunk/Examples/test-suite/ruby/li_std_queue_runme.rb32
-rwxr-xr-xtrunk/Examples/test-suite/ruby/li_std_set_runme.rb63
-rwxr-xr-xtrunk/Examples/test-suite/ruby/li_std_speed2_runme.rb67
-rwxr-xr-xtrunk/Examples/test-suite/ruby/li_std_stack_runme.rb30
-rwxr-xr-xtrunk/Examples/test-suite/ruby/li_std_stream_runme.rb22
-rw-r--r--trunk/Examples/test-suite/ruby/li_std_string_runme.rb144
-rwxr-xr-xtrunk/Examples/test-suite/ruby/li_std_vector_runme.rb122
-rw-r--r--trunk/Examples/test-suite/ruby/member_pointer_runme.rb54
-rw-r--r--trunk/Examples/test-suite/ruby/minherit_runme.rb89
-rwxr-xr-xtrunk/Examples/test-suite/ruby/namespace_typemap_runme.rb44
-rw-r--r--trunk/Examples/test-suite/ruby/newobject1_runme.rb33
-rw-r--r--trunk/Examples/test-suite/ruby/newobject2_runme.rb27
-rwxr-xr-xtrunk/Examples/test-suite/ruby/overload_copy_runme.rb17
-rwxr-xr-xtrunk/Examples/test-suite/ruby/overload_extend_runme.rb19
-rwxr-xr-xtrunk/Examples/test-suite/ruby/overload_extendc_runme.rb18
-rwxr-xr-xtrunk/Examples/test-suite/ruby/overload_simple_runme.rb130
-rw-r--r--trunk/Examples/test-suite/ruby/overload_subtype_runme.rb26
-rwxr-xr-xtrunk/Examples/test-suite/ruby/overload_template_runme.rb17
-rwxr-xr-xtrunk/Examples/test-suite/ruby/primitive_ref_runme.rb38
-rw-r--r--trunk/Examples/test-suite/ruby/primitive_types_runme.rb98
-rw-r--r--trunk/Examples/test-suite/ruby/profiletest_runme.rb20
-rw-r--r--trunk/Examples/test-suite/ruby/refcount_runme.rb21
-rw-r--r--trunk/Examples/test-suite/ruby/reference_global_vars_runme.rb104
-rw-r--r--trunk/Examples/test-suite/ruby/rename_scope_runme.rb21
-rw-r--r--trunk/Examples/test-suite/ruby/ruby_keywords_runme.rb159
-rwxr-xr-xtrunk/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb82
-rw-r--r--trunk/Examples/test-suite/ruby/ruby_naming_runme.rb115
-rw-r--r--trunk/Examples/test-suite/ruby/ruby_track_objects_directors_runme.rb39
-rw-r--r--trunk/Examples/test-suite/ruby/ruby_track_objects_runme.rb117
-rw-r--r--trunk/Examples/test-suite/ruby/smart_pointer_const_runme.rb24
-rw-r--r--trunk/Examples/test-suite/ruby/smart_pointer_multi_runme.rb26
-rw-r--r--trunk/Examples/test-suite/ruby/smart_pointer_multi_typedef_runme.rb25
-rw-r--r--trunk/Examples/test-suite/ruby/smart_pointer_not_runme.rb55
-rw-r--r--trunk/Examples/test-suite/ruby/smart_pointer_overload_runme.rb27
-rw-r--r--trunk/Examples/test-suite/ruby/smart_pointer_rename_runme.rb23
-rw-r--r--trunk/Examples/test-suite/ruby/smart_pointer_simple_runme.rb24
-rw-r--r--trunk/Examples/test-suite/ruby/smart_pointer_typedef_runme.rb24
-rwxr-xr-xtrunk/Examples/test-suite/ruby/sneaky1_runme.rb17
-rw-r--r--trunk/Examples/test-suite/ruby/static_const_member_2_runme.rb23
-rwxr-xr-xtrunk/Examples/test-suite/ruby/std_containers_runme.rb119
-rwxr-xr-xtrunk/Examples/test-suite/ruby/stl_new_runme.rb117
-rw-r--r--trunk/Examples/test-suite/ruby/struct_value_runme.rb21
-rwxr-xr-xtrunk/Examples/test-suite/ruby/swig_assert.rb141
-rwxr-xr-xtrunk/Examples/test-suite/ruby/swig_gc.rb70
-rw-r--r--trunk/Examples/test-suite/ruby/template_construct_runme.rb13
-rw-r--r--trunk/Examples/test-suite/ruby/template_extend1_runme.rb19
-rw-r--r--trunk/Examples/test-suite/ruby/template_extend2_runme.rb19
-rwxr-xr-xtrunk/Examples/test-suite/ruby/template_inherit_runme.rb51
-rwxr-xr-xtrunk/Examples/test-suite/ruby/template_ns4_runme.rb15
-rwxr-xr-xtrunk/Examples/test-suite/ruby/template_ns_runme.rb26
-rwxr-xr-xtrunk/Examples/test-suite/ruby/template_rename_runme.rb23
-rw-r--r--trunk/Examples/test-suite/ruby/template_tbase_template_runme.rb18
-rw-r--r--trunk/Examples/test-suite/ruby/template_type_namespace_runme.rb18
-rw-r--r--trunk/Examples/test-suite/ruby/template_typedef_cplx2_runme.rb81
-rw-r--r--trunk/Examples/test-suite/ruby/template_typedef_cplx3_runme.rb46
-rw-r--r--trunk/Examples/test-suite/ruby/template_typedef_cplx4_runme.rb46
-rw-r--r--trunk/Examples/test-suite/ruby/template_typedef_cplx_runme.rb77
-rw-r--r--trunk/Examples/test-suite/ruby/throw_exception_runme.rb41
-rwxr-xr-xtrunk/Examples/test-suite/ruby/typedef_inherit_runme.rb38
-rwxr-xr-xtrunk/Examples/test-suite/ruby/typedef_scope_runme.rb24
-rwxr-xr-xtrunk/Examples/test-suite/ruby/typemap_namespace_runme.rb18
-rw-r--r--trunk/Examples/test-suite/ruby/typemap_ns_using_runme.rb15
-rwxr-xr-xtrunk/Examples/test-suite/ruby/typename_runme.rb25
-rw-r--r--trunk/Examples/test-suite/ruby/unions_runme.rb65
-rw-r--r--trunk/Examples/test-suite/ruby/using1_runme.rb15
-rw-r--r--trunk/Examples/test-suite/ruby/using2_runme.rb15
-rw-r--r--trunk/Examples/test-suite/ruby/using_composition_runme.rb56
-rw-r--r--trunk/Examples/test-suite/ruby/using_extend_runme.rb36
-rw-r--r--trunk/Examples/test-suite/ruby/using_inherit_runme.rb74
-rw-r--r--trunk/Examples/test-suite/ruby/using_private_runme.rb30
-rw-r--r--trunk/Examples/test-suite/ruby/using_protected_runme.rb22
-rw-r--r--trunk/Examples/test-suite/ruby/varargs_runme.rb26
-rw-r--r--trunk/Examples/test-suite/ruby/virtual_derivation_runme.rb18
-rw-r--r--trunk/Examples/test-suite/ruby/virtual_poly_runme.rb33
-rw-r--r--trunk/Examples/test-suite/ruby/voidtest_runme.rb24
139 files changed, 5931 insertions, 0 deletions
diff --git a/trunk/Examples/test-suite/ruby/Makefile.in b/trunk/Examples/test-suite/ruby/Makefile.in
new file mode 100644
index 000000000..27996616e
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/Makefile.in
@@ -0,0 +1,71 @@
+#######################################################################
+# Makefile for ruby test-suite
+#######################################################################
+
+LANGUAGE = ruby
+RUBY = @RUBY@
+SCRIPTSUFFIX = _runme.rb
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
+
+CPP_TEST_CASES = \
+ li_cdata \
+ li_cstring \
+ li_factory \
+ li_std_functors \
+ li_std_multimap \
+ li_std_pair_lang_object \
+ li_std_queue \
+ li_std_set \
+ li_std_stack \
+ primitive_types \
+ ruby_keywords \
+ ruby_naming \
+ ruby_track_objects \
+ ruby_track_objects_directors \
+ std_containers
+# ruby_li_std_speed
+# stl_new
+
+C_TEST_CASES += \
+ li_cdata \
+ li_cstring
+
+include $(srcdir)/../common.mk
+
+# Overridden variables here
+SWIGOPT += -w801 -noautorename -features autodoc=4
+
+# Custom tests - tests with additional commandline options
+ruby_naming.cpptest: SWIGOPT += -autorename
+
+# 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)
+
+# Runs the testcase. A testcase is only run if
+# a file is found which has _runme.rb appended after the testcase name.
+run_testcase = \
+ if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(RUBY) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ fi
+
+# Clean
+%.clean:
+
+
+clean:
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile ruby_clean
diff --git a/trunk/Examples/test-suite/ruby/README b/trunk/Examples/test-suite/ruby/README
new file mode 100644
index 000000000..c4ace93e6
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/README
@@ -0,0 +1,4 @@
+See ../README for common README file.
+
+Any testcases which have _runme.rb appended after the testcase name will be detected and run.
+
diff --git a/trunk/Examples/test-suite/ruby/abstract_access_runme.rb b/trunk/Examples/test-suite/ruby/abstract_access_runme.rb
new file mode 100755
index 000000000..6f91702c9
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/abstract_access_runme.rb
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+#
+# Put script description here.
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'abstract_access'
+
+include Abstract_access
+
+begin
+ a = A.new
+rescue TypeError
+ swig_assert(true, binding, 'A.new')
+end
+
+begin
+ b = B.new
+rescue TypeError
+ swig_assert(true, binding, 'B.new')
+end
+
+begin
+ c = C.new
+rescue TypeError
+ swig_assert(true, binding, 'C.new')
+end
+
+swig_assert( 'D.new' )
+
diff --git a/trunk/Examples/test-suite/ruby/abstract_inherit_ok_runme.rb b/trunk/Examples/test-suite/ruby/abstract_inherit_ok_runme.rb
new file mode 100644
index 000000000..1d6899317
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/abstract_inherit_ok_runme.rb
@@ -0,0 +1,48 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'abstract_inherit_ok'
+
+include Abstract_inherit_ok
+
+#
+# Shouldn't be able to instantiate Foo, because it declares
+# a pure virtual function.
+#
+
+exceptionRaised = false
+begin
+ Foo.new
+rescue NameError
+ exceptionRaised = true
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Abstract_inherit_ok::Foo
+ exceptionRaised = true
+ensure
+ swig_assert( "exceptionRaised", binding )
+end
+
+#
+# This one's OK since we cleared it with a %feature("notabstract")
+# declaration in the interface file.
+#
+
+exceptionRaised = false
+begin
+ spam = Spam.new
+ raise RuntimeError unless spam.blah == 0
+rescue NameError
+ exceptionRaised = true
+ensure
+ swig_assert( "!exceptionRaised", binding )
+end
+
diff --git a/trunk/Examples/test-suite/ruby/abstract_inherit_runme.rb b/trunk/Examples/test-suite/ruby/abstract_inherit_runme.rb
new file mode 100644
index 000000000..c9cef7d5b
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/abstract_inherit_runme.rb
@@ -0,0 +1,61 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'abstract_inherit'
+
+include Abstract_inherit
+
+#
+# Shouldn't be able to instantiate any of these classes
+# since none of them implements the pure virtual function
+# declared in the base class (Foo).
+#
+
+exceptionRaised = false
+begin
+ Foo.new
+rescue NameError
+ exceptionRaised = true
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Abstract_inherit::Foo
+ exceptionRaised = true
+ensure
+ swig_assert( "exceptionRaised", binding )
+end
+
+exceptionRaised = false
+begin
+ Bar.new
+rescue NameError
+ exceptionRaised = true
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Abstract_inherit::Bar
+ exceptionRaised = true
+ensure
+ swig_assert( "exceptionRaised", binding )
+end
+
+exceptionRaised = false
+begin
+ Spam.new
+rescue NameError
+ exceptionRaised = true
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Abstract_inherit::Spam
+ exceptionRaised = true
+ensure
+ swig_assert( "exceptionRaised", binding )
+end
+
+
diff --git a/trunk/Examples/test-suite/ruby/abstract_signature_runme.rb b/trunk/Examples/test-suite/ruby/abstract_signature_runme.rb
new file mode 100644
index 000000000..8c090a70d
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/abstract_signature_runme.rb
@@ -0,0 +1,62 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'abstract_signature'
+
+include Abstract_signature
+
+#
+# Shouldn't be able to instantiate Abstract_foo, because it declares
+# a pure virtual function.
+#
+
+exceptionRaised = false
+begin
+ foo = Abstract_foo.new
+ begin
+ foo.meth(1)
+ rescue RuntimeError
+ # here we are using directors
+ exceptionRaised = true
+ end
+rescue NameError
+ exceptionRaised = true
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Abstract_signature::Abstract_foo
+ exceptionRaised = true
+ensure
+ swig_assert( "exceptionRaised", binding)
+end
+
+#
+# Shouldn't be able to instantiate an Abstract_bar either, because it doesn't
+# implement the pure virtual function with the correct signature.
+#
+
+exceptionRaised = false
+begin
+ bar = Abstract_bar.new
+ begin
+ bar.meth(1)
+ rescue RuntimeError
+ # here we are using directors
+ exceptionRaised = true
+ end
+rescue NameError
+ exceptionRaised = true
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Abstract_signature::Abstract_bar
+ exceptionRaised = true
+ensure
+ swig_assert( "exceptionRaised", binding)
+end
+
diff --git a/trunk/Examples/test-suite/ruby/abstract_typedef2_runme.rb b/trunk/Examples/test-suite/ruby/abstract_typedef2_runme.rb
new file mode 100644
index 000000000..8c7d43f7a
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/abstract_typedef2_runme.rb
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'abstract_typedef2'
+
+include Abstract_typedef2
+
+swig_assert( 'a = A_UF.new' )
+
+
diff --git a/trunk/Examples/test-suite/ruby/abstract_typedef_runme.rb b/trunk/Examples/test-suite/ruby/abstract_typedef_runme.rb
new file mode 100644
index 000000000..100f089d1
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/abstract_typedef_runme.rb
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'abstract_typedef'
+
+include Abstract_typedef
+
+swig_assert_each_line(<<'EOF', binding)
+
+e = Engine.new
+a = A.new
+a.write(e)
+
+EOF
+
diff --git a/trunk/Examples/test-suite/ruby/abstract_virtual_runme.rb b/trunk/Examples/test-suite/ruby/abstract_virtual_runme.rb
new file mode 100644
index 000000000..08fb43b66
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/abstract_virtual_runme.rb
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'abstract_virtual'
+
+include Abstract_virtual
+
+swig_assert('d = D.new')
+swig_assert('e = E.new')
diff --git a/trunk/Examples/test-suite/ruby/access_change_runme.rb b/trunk/Examples/test-suite/ruby/access_change_runme.rb
new file mode 100755
index 000000000..5b3e99c58
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/access_change_runme.rb
@@ -0,0 +1,46 @@
+#!/usr/bin/env ruby
+#
+# Put script description here.
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'access_change'
+
+
+#
+# this test will currently fail, as it exposes functions that were
+# made protected from public. swig limitation for now.
+#
+exit(0)
+
+include Access_change
+
+klass = BaseInt.new
+public = ['PublicProtectedPublic1', 'PublicProtectedPublic2',
+ 'PublicProtectedPublic3', 'PublicProtectedPublic4']
+methods = (klass.public_methods - Object.methods).sort
+pmethods = (klass.protected_methods - Object.methods).sort
+swig_assert( methods == public,
+ " incorrect public methods for BaseInt\n" +
+ "#{methods.inspect} !=\n#{public.inspect}" )
+
+klass = DerivedInt.new
+public = ['PublicProtectedPublic3', 'PublicProtectedPublic4',
+ 'WasProtected1', 'WasProtected2', 'WasProtected3', 'WasProtected4']
+methods = (klass.public_methods - Object.methods).sort
+swig_assert( methods == public,
+ " incorrect public methods for DerivedInt\n" +
+ "#{methods.inspect} !=\n#{public.inspect}" )
+
+klass = BottomInt.new
+public = ['PublicProtectedPublic1', 'PublicProtectedPublic2',
+ 'PublicProtectedPublic3', 'PublicProtectedPublic4',
+ 'WasProtected1', 'WasProtected2']
+methods = (klass.public_methods - Object.methods).sort
+swig_assert( methods == public,
+ " incorrect public methods for BottomInt\n" +
+ "#{methods.inspect} !=\n#{public.inspect}" )
diff --git a/trunk/Examples/test-suite/ruby/add_link_runme.rb b/trunk/Examples/test-suite/ruby/add_link_runme.rb
new file mode 100755
index 000000000..8f726d27a
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/add_link_runme.rb
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+#
+# Put script description here.
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'add_link'
+include Add_link
+
+#
+# This test currently fails due to swig
+#
+exit(0)
+
+swig_assert( 'Foo.new' )
+swig_assert( 'Foo.blah' )
diff --git a/trunk/Examples/test-suite/ruby/aggregate_runme.rb b/trunk/Examples/test-suite/ruby/aggregate_runme.rb
new file mode 100644
index 000000000..4849fd185
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/aggregate_runme.rb
@@ -0,0 +1,37 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'aggregate'
+
+include Aggregate
+
+# Confirm that move() returns correct results under normal use
+result = move(UP)
+raise RuntimeError unless (result == UP)
+
+result = move(DOWN)
+raise RuntimeError unless (result == DOWN)
+
+result = move(LEFT)
+raise RuntimeError unless (result == LEFT)
+
+result = move(RIGHT)
+raise RuntimeError unless (result == RIGHT)
+
+# Confirm that it raises an exception when the contract is violated
+failed = false
+begin
+ move(0)
+rescue RuntimeError
+ failed = true
+end
+raise RuntimeError unless failed
+
diff --git a/trunk/Examples/test-suite/ruby/anonymous_bitfield_runme.rb b/trunk/Examples/test-suite/ruby/anonymous_bitfield_runme.rb
new file mode 100755
index 000000000..6949a3f28
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/anonymous_bitfield_runme.rb
@@ -0,0 +1,35 @@
+#!/usr/bin/env ruby
+#
+# Put script description here.
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'anonymous_bitfield'
+
+include Anonymous_bitfield
+
+foo = Foo.new
+
+{'x' => 4,
+ 'y' => 3,
+ 'f' => 1,
+ 'z' => 8,
+ 'seq' => 3 }.each do |m, v|
+ foo.send("#{m}=", v)
+ val = foo.send(m)
+ swig_assert("val == v", binding)
+end
+
+{'x' => (1 << 4),
+ 'y' => (1 << 4),
+ 'f' => (1 << 1),
+ 'z' => (1 << 16),
+ 'seq' => (1 << (4*8-6)) }.each do |m, v|
+ foo.send("#{m}=", v)
+ val = foo.send(m)
+ swig_assert("val != v", binding)
+end
diff --git a/trunk/Examples/test-suite/ruby/apply_signed_char_runme.rb b/trunk/Examples/test-suite/ruby/apply_signed_char_runme.rb
new file mode 100755
index 000000000..3256e1f02
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/apply_signed_char_runme.rb
@@ -0,0 +1,45 @@
+#!/usr/bin/env ruby
+#
+# Put script description here.
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'apply_signed_char'
+
+include Apply_signed_char
+
+
+['CharValFunction', 'CCharValFunction', 'CCharRefFunction'].each do |m|
+ [ 3, -3 ].each do |v|
+ val = send( m, v )
+ swig_assert( "v == val", binding, "for #{m}")
+ end
+end
+
+{ 'globalchar' => -109,
+ 'globalconstchar' => -110,
+}.each do |k,v|
+ val = Apply_signed_char.send( k )
+ swig_assert( "v == val", binding, "for #{k}")
+end
+
+
+a = DirectorTest.new
+
+['CharValFunction', 'CCharValFunction', 'CCharRefFunction'].each do |m|
+ [ 3, -3 ].each do |v|
+ val = a.send( m, v )
+ swig_assert( "v == val", binding, "for DirectorTest.#{m}")
+ end
+end
+
+{ 'memberchar' => -111,
+ 'memberconstchar' => -112,
+}.each do |k,v|
+ val = a.send( k )
+ swig_assert( "v == val", binding, "for #{k}")
+end
diff --git a/trunk/Examples/test-suite/ruby/apply_strings_runme.rb b/trunk/Examples/test-suite/ruby/apply_strings_runme.rb
new file mode 100755
index 000000000..299b96bb6
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/apply_strings_runme.rb
@@ -0,0 +1,61 @@
+#!/usr/bin/env ruby
+#
+# Put script description here.
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'apply_strings'
+
+include Apply_strings
+
+begin
+ x = UcharPtr.new
+ swig_assert( fail, "UcharPtr should not be defined")
+rescue NameError
+end
+
+ptr = 'a'
+['UCharFunction', 'SCharFunction', 'CUCharFunction',
+ 'CSCharFunction'].each do |m|
+ val = Apply_strings.send(m, ptr)
+ swig_assert( "val == ptr", binding )
+end
+
+
+['CharFunction', 'CCharFunction'].each do |m|
+ begin
+ val = Apply_strings.send(m, ptr)
+ swig_assert( false, nil, "Apply_strings.#{m} should raise TypeError" )
+ rescue TypeError
+ end
+end
+
+ptr = 'a'
+foo = DirectorTest.new
+['UCharFunction', 'SCharFunction', 'CUCharFunction',
+ 'CSCharFunction'].each do |m|
+ val = foo.send(m, ptr)
+ swig_assert( "val == ptr", binding, "DirectorTest.#{m}" )
+end
+
+
+['CharFunction', 'CCharFunction'].each do |m|
+ begin
+ val = foo.send(m, ptr)
+ swig_assert( false, nil, "DirectorTest.#{m} should raise TypeError" )
+ rescue TypeError
+ end
+end
+
+
+# ary = Apply_strings.DigitsGlobalB
+# { 0 => 'A',
+# 1 => 'B',
+# 2 => 'B' }.each do |k,v|
+# val = ary[k]
+# swig_assert( val == v, "Apply_strings.DigitsGlobalB[#{k}] #{val} != #{v}")
+# end
diff --git a/trunk/Examples/test-suite/ruby/argout_runme.rb b/trunk/Examples/test-suite/ruby/argout_runme.rb
new file mode 100755
index 000000000..54cb8f30f
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/argout_runme.rb
@@ -0,0 +1,42 @@
+#!/usr/bin/env ruby
+#
+# Put script description here.
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'argout'
+
+include Argout
+
+swig_assert_each_line(<<'EOF', binding)
+
+t = new_intp
+intp_assign(t, 5)
+v = incp(t)
+val = intp_value(t)
+val == 6
+
+t = new_intp
+intp_assign(t, 5)
+v = incr(t)
+v == 5
+val = intp_value(t)
+val == 6
+
+t = new_intp
+intp_assign(t, 5)
+v = inctr(t)
+v == 5
+val = intp_value(t)
+val == 6
+
+EOF
+
+#
+# @todo: how to use voidhandle and handle?
+#
+
diff --git a/trunk/Examples/test-suite/ruby/array_member_runme.rb b/trunk/Examples/test-suite/ruby/array_member_runme.rb
new file mode 100644
index 000000000..686f5a3c6
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/array_member_runme.rb
@@ -0,0 +1,36 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'array_member'
+
+include Array_member
+
+f = Foo.new
+f.data = Array_member.global_data
+
+0.upto(7) { |i|
+ unless get_value(f.data, i) == get_value(Array_member.global_data, i)
+ raise RuntimeError, "Bad array assignment"
+ end
+}
+
+0.upto(7) { |i|
+ set_value(f.data, i, -i)
+}
+
+Array_member.global_data = f.data
+
+0.upto(7) { |i|
+ unless get_value(f.data, i) == get_value(Array_member.global_data, i)
+ raise RuntimeError, "Bad array assignment"
+ end
+}
+
diff --git a/trunk/Examples/test-suite/ruby/arrays_global_runme.rb b/trunk/Examples/test-suite/ruby/arrays_global_runme.rb
new file mode 100644
index 000000000..9835f2a1d
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/arrays_global_runme.rb
@@ -0,0 +1,15 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'arrays_global'
+
+Arrays_global.array_i = Arrays_global.array_const_i
+
diff --git a/trunk/Examples/test-suite/ruby/arrays_runme.rb b/trunk/Examples/test-suite/ruby/arrays_runme.rb
new file mode 100755
index 000000000..749d81758
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/arrays_runme.rb
@@ -0,0 +1,25 @@
+#!/usr/bin/env ruby
+#
+# Test run of arrays.i
+#
+#
+
+require 'swig_assert'
+require 'arrays'
+
+include Arrays
+
+a = SimpleStruct.new
+a.double_field = 2.0
+
+b = SimpleStruct.new
+b.double_field = 1.0
+
+# @bug: this is broken
+#
+# c = [a,b]
+# fn_taking_arrays(c)
+#
+# a = ArrayStruct.new
+# a.array_i[0] = 0
+#
diff --git a/trunk/Examples/test-suite/ruby/bools_runme.rb b/trunk/Examples/test-suite/ruby/bools_runme.rb
new file mode 100644
index 000000000..373477c7e
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/bools_runme.rb
@@ -0,0 +1,82 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+
+require 'bools'
+
+# bool constant check
+if (Bools::Constbool != false)
+ print "Runtime test 1 failed\n"
+ exit 1
+end
+
+# bool variables check
+if (Bools.bool1 != true)
+ print "Runtime test 2 failed\n"
+ exit 1
+end
+
+if (Bools.bool2 != false)
+ print "Runtime test 3 failed\n"
+ exit 1
+end
+
+if (Bools.value(Bools.pbool) != Bools.bool1)
+ print "Runtime test 4 failed\n"
+ exit 1
+end
+
+if (Bools.value(Bools.rbool) != Bools.bool2)
+ print "Runtime test 5 failed\n"
+ exit 1
+end
+
+if (Bools.value(Bools.const_pbool) != Bools.bool1)
+ print "Runtime test 6 failed\n"
+ exit 1
+end
+
+if (Bools.const_rbool != Bools.bool2)
+ print "Runtime test 7 failed\n"
+ exit 1
+end
+
+# bool functions check
+if (Bools.bo(false) != false)
+ print "Runtime test 8 failed\n"
+ exit 1
+end
+
+if (Bools.bo(true) != true)
+ print "Runtime test 9 failed\n"
+ exit 1
+end
+
+if (Bools.value(Bools.rbo(Bools.rbool)) != Bools.value(Bools.rbool))
+ print "Runtime test 10 failed\n"
+ exit 1
+end
+
+if (Bools.value(Bools.pbo(Bools.pbool)) != Bools.value(Bools.pbool))
+ print "Runtime test 11 failed\n"
+ exit 1
+end
+
+if (Bools.const_rbo(Bools.const_rbool) != Bools.const_rbool)
+ print "Runtime test 12 failed\n"
+ exit 1
+end
+
+if (Bools.value(Bools.const_pbo(Bools.const_pbool)) != Bools.value(Bools.const_pbool))
+ print "Runtime test 13 failed\n"
+ exit 1
+end
+
diff --git a/trunk/Examples/test-suite/ruby/cast_operator_runme.rb b/trunk/Examples/test-suite/ruby/cast_operator_runme.rb
new file mode 100755
index 000000000..4879befbf
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/cast_operator_runme.rb
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+#
+# Put script description here.
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'cast_operator'
+include Cast_operator
+
+a = A.new
+t = a.tochar
+
+swig_assert( t == 'hi' )
diff --git a/trunk/Examples/test-suite/ruby/casts_runme.rb b/trunk/Examples/test-suite/ruby/casts_runme.rb
new file mode 100755
index 000000000..d1f536d75
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/casts_runme.rb
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+#
+# Put script description here.
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'casts'
+
+include Casts
+
+swig_assert( B.ancestors.include?(A), 'B.ancestors.include? A' )
+
+a = A.new
+a.hello
+
+b = B.new
+b.hello
+
+swig_assert( b.kind_of?( A ), ' B.kind_of? A' )
diff --git a/trunk/Examples/test-suite/ruby/char_constant_runme.rb b/trunk/Examples/test-suite/ruby/char_constant_runme.rb
new file mode 100644
index 000000000..4e9d9d59c
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/char_constant_runme.rb
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'char_constant'
+
+
+if Char_constant::CHAR_CONSTANT != 'x'
+ raise RuntimeError, "Invalid value for CHAR_CONSTANT."
+end
+
+if Char_constant::STRING_CONSTANT != 'xyzzy'
+ raise RuntimeError, "Invalid value for STRING_CONSTANT."
+end
+
+if Char_constant::ESC_CONST != "\001"
+ raise RuntimeError, "Invalid value for ESC_CONST."
+end
+
+if Char_constant::NULL_CONST != "\000"
+ raise RuntimeError, "Invalid value for NULL_CONST."
+end
+
+if Char_constant::SPECIALCHAR != "\341" #'á'
+ raise RuntimeError, "Invalid value for SPECIALCHAR."
+end
+
diff --git a/trunk/Examples/test-suite/ruby/check_missing_tests.rb b/trunk/Examples/test-suite/ruby/check_missing_tests.rb
new file mode 100755
index 000000000..97e197e3a
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/check_missing_tests.rb
@@ -0,0 +1,53 @@
+#!/usr/bin/env ruby
+#
+# This script allows you to compare the tests in the current directory
+# (Ruby) against the tests of other languages to see which ones are missing
+#
+#
+#
+#
+#
+
+
+ignore = ['ruby','std','typemaps']
+
+curr = Dir.pwd.sub(/.*\//, '')
+
+langs = Dir.glob('../*').select { |x| File.directory?("../#{x}") }
+langs.map! { |x| x.sub(/^\.\.\/*/, '') }
+langs -= ignore
+
+# Add generic test directory, too
+langs << ''
+
+testsB = Dir.glob("*runme*").map { |x| x.sub(/\.\w+$/, '') }
+
+
+all_tests = []
+
+langs.each do |lang|
+ testsA = Dir.glob("../#{lang}/*runme*")
+ testsA.map! { |x| x.sub(/.*\/(\w+)\.\w+$/, '\1') }
+ testsA.delete_if { |x| x =~ /~$/ } # ignore emacs backups
+
+ diff = testsA - testsB
+
+ unless diff.empty?
+ puts '-'*70
+ title = !lang.empty? ? "#{lang[0,1].upcase}#{lang[1..-1]}" : 'Generic'
+ title = "Missing #{title} tests"
+ puts title
+ puts '='*title.size
+ puts diff.join(', ')
+ all_tests += diff
+ end
+
+end
+
+
+all_tests.uniq!
+
+puts '-'*70
+puts 'All missing tests'
+puts '================='
+puts all_tests.join(', ')
diff --git a/trunk/Examples/test-suite/ruby/class_ignore_runme.rb b/trunk/Examples/test-suite/ruby/class_ignore_runme.rb
new file mode 100755
index 000000000..28e432486
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/class_ignore_runme.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'class_ignore'
+
+a = Class_ignore::Bar.new
+
+# Even though we didn't wrap the Foo class, this call
+# to do_blah() should succeed.
+
+if Class_ignore.do_blah(a) != "Bar::blah"
+ raise RuntimeError
+end
diff --git a/trunk/Examples/test-suite/ruby/const_const_runme.rb b/trunk/Examples/test-suite/ruby/const_const_runme.rb
new file mode 100755
index 000000000..cadc73a94
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/const_const_runme.rb
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+#
+#
+
+require 'swig_assert'
+
+require 'const_const'
+include Const_const
+
+swig_assert_each_line <<EOF
+foo(1) # 1 is unused
+EOF
+
+
diff --git a/trunk/Examples/test-suite/ruby/constover_runme.rb b/trunk/Examples/test-suite/ruby/constover_runme.rb
new file mode 100755
index 000000000..49c0c81e8
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/constover_runme.rb
@@ -0,0 +1,55 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'constover'
+
+error = 0
+
+p = Constover.test("test")
+if p != "test"
+ puts "test failed!"
+ error = 1
+end
+
+p = Constover.test_pconst("test")
+if p != "test_pconst"
+ puts "test_pconst failed!"
+ error = 1
+end
+
+f = Constover::Foo.new
+p = f.test("test")
+if p != "test"
+ print "member-test failed!"
+ error = 1
+end
+
+p = f.test_pconst("test")
+if p != "test_pconst"
+ print "member-test_pconst failed!"
+ error = 1
+end
+
+p = f.test_constm("test")
+if p != "test_constmethod"
+ print "member-test_constm failed!"
+ error = 1
+end
+
+p = f.test_pconstm("test")
+if p != "test_pconstmethod"
+ print "member-test_pconstm failed!"
+ error = 1
+end
+
+exit(error)
+
+
diff --git a/trunk/Examples/test-suite/ruby/cpp_namespace_runme.rb b/trunk/Examples/test-suite/ruby/cpp_namespace_runme.rb
new file mode 100755
index 000000000..53649faf5
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/cpp_namespace_runme.rb
@@ -0,0 +1,62 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+# Note: This example assumes that namespaces are flattened
+require 'cpp_namespace'
+
+n = Cpp_namespace.fact(4)
+if n != 24
+ raise "Bad return value!"
+end
+
+if Cpp_namespace.Foo != 42
+ raise "Bad variable value!"
+end
+
+t = Cpp_namespace::Test.new
+if t.method() != "Test::method"
+ raise "Bad method return value!"
+end
+
+if Cpp_namespace.do_method(t) != "Test::method"
+ raise "Bad return value!"
+end
+
+if Cpp_namespace.do_method2(t) != "Test::method"
+ raise "Bad return value!"
+end
+
+Cpp_namespace.weird("hello", 4)
+
+t2 = Cpp_namespace::Test2.new
+t3 = Cpp_namespace::Test3.new
+t4 = Cpp_namespace::Test4.new
+t5 = Cpp_namespace::Test5.new
+
+if Cpp_namespace.foo3(42) != 42
+ raise "Bad return value!"
+end
+
+if Cpp_namespace.do_method3(t2, 40) != "Test2::method"
+ raise "Bad return value!"
+end
+
+if Cpp_namespace.do_method3(t3, 40) != "Test3::method"
+ raise "Bad return value!"
+end
+
+if Cpp_namespace.do_method3(t4, 40) != "Test4::method"
+ raise "Bad return value!"
+end
+
+if Cpp_namespace.do_method3(t5, 40) != "Test5::method"
+ raise "Bad return value!"
+end
diff --git a/trunk/Examples/test-suite/ruby/default_constructor_runme.rb b/trunk/Examples/test-suite/ruby/default_constructor_runme.rb
new file mode 100755
index 000000000..2706f67ca
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/default_constructor_runme.rb
@@ -0,0 +1,153 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'default_constructor'
+
+include Default_constructor
+
+# Ruby 1.6 raises NameError if you try to call Class.new where no constructor
+# is defined; Ruby 1.7 changed this to NoMethodError
+
+NoConstructorError = Kernel.const_defined?("NoMethodError") ? NoMethodError : NameError
+
+# This should be no problem
+a = A.new
+
+# Nor should this
+aa = AA.new
+
+# The default constructor for B is private, so this should raise an exception
+begin
+ b = B.new
+rescue ArgumentError
+ # pass
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Default_constructor::BB
+ exceptionRaised = true
+end
+
+# The two-argument constructor for B should work
+b = B.new(3, 4)
+
+# BB shouldn't inherit B's default constructor, so this should raise an exception
+begin
+ bb = BB.new
+ puts "Whoa. new BB created."
+rescue NoConstructorError
+ # pass
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Default_constructor::BB
+ exceptionRaised = true
+end
+
+# C's constructor is protected, so this should raise an exception
+begin
+ c = C.new
+ print "Whoa. new C created."
+rescue NoConstructorError
+ # pass
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Default_constructor::C
+ # pass
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Default_constructor::C
+ # pass
+end
+
+# CC gets a default constructor, so no problem here
+cc = CC.new
+
+# D's constructor is private, so this should fail
+begin
+ d = D.new
+ puts "Whoa. new D created"
+rescue NoConstructorError
+ # pass
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Default_constructor::D
+ # pass
+end
+
+# DD shouldn't get a default constructor, so this should fail
+begin
+ dd = DD.new
+ puts "Whoa. new DD created"
+rescue NoConstructorError
+ # pass
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Default_constructor::DD
+ # pass
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Default_constructor::D
+ # pass
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Default_constructor::DD
+ # pass
+end
+
+# AD shouldn't get a default constructor, so this should fail
+begin
+ ad = AD.new
+ puts "Whoa. new AD created"
+rescue NoConstructorError
+ # pass
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Default_constructor::AD
+ # pass
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Default_constructor::AD
+ # pass
+end
+
+# Both of the arguments to E's constructor have default values,
+# so this should be fine.
+e = E.new
+
+# EE should get a default constructor
+ee = EE.new
+
+# EB should not get a default constructor (because B doesn't have one)
+begin
+ eb = EB.new
+ puts "Whoa. new EB created"
+rescue NoConstructorError
+ # pass
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Default_constructor::EB
+ # pass
+rescue TypeError
+ # In Ruby 1.8 the exception raised is:
+ # TypeError: allocator undefined for Default_constructor::EB
+ # pass
+end
+
+# This should work fine
+f = F.new
+
+# This should work fine
+ff = FFF.new
+
+# This should work fine
+g = G.new
+
+# This should work fine
+gg = GG.new
diff --git a/trunk/Examples/test-suite/ruby/director_abstract_runme.rb b/trunk/Examples/test-suite/ruby/director_abstract_runme.rb
new file mode 100644
index 000000000..685ede1e9
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/director_abstract_runme.rb
@@ -0,0 +1,42 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'director_abstract'
+
+class MyFoo < Director_abstract::Foo
+ def ping
+ "MyFoo::ping()"
+ end
+end
+
+
+a = MyFoo.new
+
+if a.ping != "MyFoo::ping()"
+ raise RuntimeError, a.ping
+end
+
+if a.pong != "Foo::pong();MyFoo::ping()"
+ raise RuntimeError, a.pong
+end
+
+
+class MyExample1 < Director_abstract::Example1
+ def color(r,g,b)
+ r
+ end
+end
+
+#m1 = MyExample1.new
+#
+#if m1.color(1,2,3) != 1
+# raise RuntimeError, m1.color
+#end
diff --git a/trunk/Examples/test-suite/ruby/director_basic_runme.rb b/trunk/Examples/test-suite/ruby/director_basic_runme.rb
new file mode 100644
index 000000000..a9019b68d
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/director_basic_runme.rb
@@ -0,0 +1,36 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'director_basic'
+
+class MyFoo < Director_basic::Foo
+ def ping
+ "MyFoo::ping()"
+ end
+end
+
+a = MyFoo.new
+
+raise RuntimeError if a.ping != "MyFoo::ping()"
+raise RuntimeError if a.pong != "Foo::pong();MyFoo::ping()"
+
+b = Director_basic::Foo.new
+
+raise RuntimeError if b.ping != "Foo::ping()"
+raise RuntimeError if b.pong != "Foo::pong();Foo::ping()"
+
+
+a = Director_basic::MyClass.new
+a = Director_basic::MyClassT_i.new
+
+
+a = Director_basic::MyClass.new 1
+a = Director_basic::MyClassT_i.new 1
diff --git a/trunk/Examples/test-suite/ruby/director_constructor_runme.rb b/trunk/Examples/test-suite/ruby/director_constructor_runme.rb
new file mode 100644
index 000000000..f83f23ec0
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/director_constructor_runme.rb
@@ -0,0 +1,37 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'director_constructor'
+
+include Director_constructor
+
+class Test < Foo
+ def initialize(i)
+ super(i)
+ end
+
+ def doubleit()
+ self.a = (self.a * 2)
+ end
+
+ def test
+ 3
+ end
+end
+
+a = Test.new(5) #dies here
+
+raise RuntimeError if a.getit != 5
+raise RuntimeError if a.do_test != 3
+
+a.doubleit
+raise RuntimeError if a.getit != 10
+
diff --git a/trunk/Examples/test-suite/ruby/director_default_runme.rb b/trunk/Examples/test-suite/ruby/director_default_runme.rb
new file mode 100644
index 000000000..355f3c779
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/director_default_runme.rb
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'director_default'
+
+
+
+a = Director_default::Foo.new 1
+a = Director_default::Foo.new
+
+a.Msg
+a.Msg "hello"
+a.GetMsg
+a.GetMsg "hello"
+
+a = Director_default::Bar.new 1
+a = Director_default::Bar.new
+
+a.Msg
+a.Msg "hello"
+a.GetMsg
+a.GetMsg "hello"
diff --git a/trunk/Examples/test-suite/ruby/director_detect_runme.rb b/trunk/Examples/test-suite/ruby/director_detect_runme.rb
new file mode 100644
index 000000000..c1bd8adf8
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/director_detect_runme.rb
@@ -0,0 +1,54 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'director_detect'
+
+class MyBar < Director_detect::Bar
+ def initialize(v)
+ @val = v
+ end
+
+ def get_value
+ @val = @val + 1
+ end
+
+ def get_class
+ @val = @val + 1
+ Director_detect::A
+ end
+
+ def just_do_it
+ @val = @val + 1
+ end
+
+ def clone
+ MyBar.new(@val)
+ end
+
+ def val
+ @val
+ end
+end
+
+
+b = MyBar.new(2)
+
+f = b
+
+v = f.get_value
+a = f.get_class
+f.just_do_it
+
+c = b.clone
+vc = c.get_value
+
+raise RuntimeError if (v != 3) || (b.val != 5) || (vc != 6)
+
diff --git a/trunk/Examples/test-suite/ruby/director_exception_runme.rb b/trunk/Examples/test-suite/ruby/director_exception_runme.rb
new file mode 100644
index 000000000..d31cd712e
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/director_exception_runme.rb
@@ -0,0 +1,70 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'director_exception'
+
+include Director_exception
+
+class MyFoo < Foo
+ def ping
+ raise NotImplementedError, "MyFoo::ping() EXCEPTION"
+ end
+end
+
+class MyFoo2 < Foo
+ def ping
+ nil # error: should return a string
+ end
+end
+
+class MyFoo3 < Foo
+ def ping
+ 5 # error: should return a string
+ end
+end
+
+ok = false
+
+a = MyFoo.new
+b = launder(a)
+
+begin
+ b.pong
+rescue NotImplementedError
+ ok = true
+end
+
+raise RuntimeError unless ok
+
+ok = false
+
+a = MyFoo2.new
+b = launder(a)
+
+begin
+ b.pong
+rescue TypeError
+ ok = true
+end
+
+
+a = MyFoo3.new
+b = launder(a)
+
+begin
+ b.pong
+rescue TypeError
+ ok = true
+end
+
+
+raise RuntimeError unless ok
+
diff --git a/trunk/Examples/test-suite/ruby/director_frob_runme.rb b/trunk/Examples/test-suite/ruby/director_frob_runme.rb
new file mode 100644
index 000000000..edd861c20
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/director_frob_runme.rb
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'director_frob'
+
+foo = Director_frob::Bravo.new;
+s = foo.abs_method;
+
+raise RuntimeError if s != "Bravo::abs_method()"
diff --git a/trunk/Examples/test-suite/ruby/director_nested_runme.rb b/trunk/Examples/test-suite/ruby/director_nested_runme.rb
new file mode 100644
index 000000000..a376b0d38
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/director_nested_runme.rb
@@ -0,0 +1,54 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'director_nested'
+
+NoProtectedError = Kernel.const_defined?("NoMethodError") ? NoMethodError : NameError
+
+class A < Director_nested::FooBar_int
+ protected
+ def do_step
+ "A::do_step;"
+ end
+
+ def get_value
+ "A::get_value"
+ end
+end
+
+a = A.new
+
+begin
+ a.do_advance
+rescue NoProtectedError
+end
+
+raise RuntimeError if a.step != "Bar::step;Foo::advance;Bar::do_advance;A::do_step;"
+
+
+class B < Director_nested::FooBar_int
+ protected
+ def do_advance
+ "B::do_advance;" + do_step
+ end
+
+ def do_step
+ "B::do_step;"
+ end
+
+ def get_value
+ "B::get_value"
+ end
+end
+
+
+b = B.new
+raise RuntimeError if b.step != "Bar::step;Foo::advance;B::do_advance;B::do_step;"
diff --git a/trunk/Examples/test-suite/ruby/director_protected_runme.rb b/trunk/Examples/test-suite/ruby/director_protected_runme.rb
new file mode 100644
index 000000000..3bee9ac77
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/director_protected_runme.rb
@@ -0,0 +1,45 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'director_protected'
+
+NoProtectedError = Kernel.const_defined?("NoMethodError") ? NoMethodError : NameError
+
+class FooBar < Director_protected::Bar
+ protected
+ def ping
+ "FooBar::ping();"
+ end
+end
+
+class Hello < FooBar
+ public
+ def pang
+ ping
+ end
+end
+
+b = Director_protected::Bar.new
+fb = FooBar.new
+
+p = 0
+begin
+ b.ping
+ p = 1
+rescue NoProtectedError
+end
+
+h = Hello.new
+
+raise RuntimeError if p == 1
+raise RuntimeError if b.pong != "Bar::pong();Foo::pong();Bar::ping();"
+raise RuntimeError if fb.pong != "Bar::pong();Foo::pong();FooBar::ping();"
+raise RuntimeError if h.pang != "FooBar::ping();"
diff --git a/trunk/Examples/test-suite/ruby/director_string_runme.rb b/trunk/Examples/test-suite/ruby/director_string_runme.rb
new file mode 100644
index 000000000..a18feac3d
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/director_string_runme.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'director_string'
+
+class B < Director_string::A
+
+ def initialize(some_string)
+ super(some_string)
+ end
+end
+
+
+b = B.new("hello")
+b.get_first
+b.get(0)
diff --git a/trunk/Examples/test-suite/ruby/director_unroll_runme.rb b/trunk/Examples/test-suite/ruby/director_unroll_runme.rb
new file mode 100644
index 000000000..0545671cb
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/director_unroll_runme.rb
@@ -0,0 +1,28 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'director_unroll'
+
+class MyFoo < Director_unroll::Foo
+ def ping
+ "MyFoo::ping()"
+ end
+end
+
+a = MyFoo.new
+
+b = Director_unroll::Bar.new
+
+b.set(a)
+c = b.get()
+
+raise RuntimeError if a != c
+
diff --git a/trunk/Examples/test-suite/ruby/director_wombat_runme.rb b/trunk/Examples/test-suite/ruby/director_wombat_runme.rb
new file mode 100644
index 000000000..39f4a9e61
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/director_wombat_runme.rb
@@ -0,0 +1,60 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'director_wombat'
+
+include Director_wombat
+
+# Test base class functionality
+barObj = Bar.new
+
+# Bar#meth should return a Foo_integers instance
+fooIntsObj = barObj.meth
+raise RuntimeError unless fooIntsObj.instance_of?(Foo_integers)
+
+# Foo_integers#meth(n) should return n
+raise RuntimeError if fooIntsObj.meth(42) != 42
+
+#
+# Now subclass Foo_integers, but override its virtual method
+# meth(n) so that it returns the number plus one.
+#
+class MyFooInts < Foo_integers
+ def meth(n)
+ n + 1
+ end
+end
+
+#
+# Subclass Bar and override its virtual method meth()
+# so that it returns a new MyFooInts instance instead of
+# a Foo_integers instance.
+#
+class MyBar < Bar
+ def meth
+ MyFooInts.new
+ end
+end
+
+#
+# Now repeat previous tests:
+#
+# Create a MyBar instance...
+#
+barObj = MyBar.new
+
+# MyBar#meth should return a MyFooInts instance
+fooIntsObj = barObj.meth
+raise RuntimeError unless fooIntsObj.instance_of?(MyFooInts)
+
+# MyFooInts#meth(n) should return n+1
+raise RuntimeError if fooIntsObj.meth(42) != 43
+
diff --git a/trunk/Examples/test-suite/ruby/disown_runme.rb b/trunk/Examples/test-suite/ruby/disown_runme.rb
new file mode 100644
index 000000000..60b742163
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/disown_runme.rb
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'disown'
+
+include Disown
+
+
+a = A.new
+b = B.new
+b.acquire(a)
+
diff --git a/trunk/Examples/test-suite/ruby/dynamic_cast_runme.rb b/trunk/Examples/test-suite/ruby/dynamic_cast_runme.rb
new file mode 100755
index 000000000..8239051b1
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/dynamic_cast_runme.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'dynamic_cast'
+
+f = Dynamic_cast::Foo.new
+b = Dynamic_cast::Bar.new
+
+x = f.blah
+y = b.blah
+
+a = Dynamic_cast.do_test(y)
+if a != "Bar::test"
+ puts "Failed!!"
+end
+
diff --git a/trunk/Examples/test-suite/ruby/enum_thorough_runme.rb b/trunk/Examples/test-suite/ruby/enum_thorough_runme.rb
new file mode 100755
index 000000000..e4a1ec719
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/enum_thorough_runme.rb
@@ -0,0 +1,19 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'enum_thorough'
+
+include Enum_thorough
+
+# Just test an in and out typemap for enum SWIGTYPE and const enum SWIGTYPE & typemaps
+raise RuntimeError if speedTest4(SpeedClass::Slow) != SpeedClass::Slow
+raise RuntimeError if speedTest5(SpeedClass::Slow) != SpeedClass::Slow
+
diff --git a/trunk/Examples/test-suite/ruby/enums_runme.rb b/trunk/Examples/test-suite/ruby/enums_runme.rb
new file mode 100644
index 000000000..cafac25fa
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/enums_runme.rb
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+#
+# Runtime tests for enums.i
+#
+
+require 'swig_assert'
+require 'enums'
+
+swig_assert_each_line( <<EOF )
+Enums::CSP_ITERATION_FWD == 0
+Enums::CSP_ITERATION_BWD == 11
+Enums::ABCDE == 0
+Enums::FGHJI == 1
+Enums.bar1(1)
+Enums.bar2(1)
+Enums.bar3(1)
+Enums::Boo == 0
+Enums::Hoo == 5
+Enums::Globalinstance1 == 0
+Enums::Globalinstance2 == 1
+Enums::Globalinstance3 == 30
+Enums::AnonEnum1 == 0
+Enums::AnonEnum2 == 100
+Enums::BAR1 == 0
+Enums::BAR2 == 1
+EOF
+
+#
+# @bug:
+#
+# swig_assert_each_line( <<EOF )
+# Enums::IFoo::Phoo == 50
+# Enums::IFoo::Char == 'a'[0]
+# EOF
diff --git a/trunk/Examples/test-suite/ruby/extend_template_ns_runme.rb b/trunk/Examples/test-suite/ruby/extend_template_ns_runme.rb
new file mode 100644
index 000000000..d0ccee328
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/extend_template_ns_runme.rb
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'extend_template_ns'
+
+include Extend_template_ns
+
+f = Foo_One.new
+if f.test1(37) != 37
+ raise RuntimeError
+end
+
+if f.test2(42) != 42
+ raise RuntimeError
+end
diff --git a/trunk/Examples/test-suite/ruby/extend_template_runme.rb b/trunk/Examples/test-suite/ruby/extend_template_runme.rb
new file mode 100644
index 000000000..62f22bc17
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/extend_template_runme.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'extend_template'
+
+f = Extend_template::Foo_0.new
+if f.test1(37) != 37
+ raise RuntimeError
+end
+
+if f.test2(42) != 42
+ raise RuntimeError
+end
diff --git a/trunk/Examples/test-suite/ruby/friends_runme.rb b/trunk/Examples/test-suite/ruby/friends_runme.rb
new file mode 100644
index 000000000..c5c1caa01
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/friends_runme.rb
@@ -0,0 +1,19 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'friends'
+
+
+a = Friends::A.new(2)
+
+raise RuntimeError if Friends::get_val1(a) != 2
+raise RuntimeError if Friends::get_val2(a) != 4
+raise RuntimeError if Friends::get_val3(a) != 6
diff --git a/trunk/Examples/test-suite/ruby/function_typedef_runme.rb b/trunk/Examples/test-suite/ruby/function_typedef_runme.rb
new file mode 100755
index 000000000..c17f44d19
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/function_typedef_runme.rb
@@ -0,0 +1,11 @@
+#!/usr/bin/env ruby
+#
+# Tests for function_typedef.i
+#
+#
+
+require 'swig_assert'
+require 'function_typedef'
+include Function_typedef
+
+# Hmm... not sure how to test this.
diff --git a/trunk/Examples/test-suite/ruby/grouping_runme.rb b/trunk/Examples/test-suite/ruby/grouping_runme.rb
new file mode 100644
index 000000000..ad60eec2e
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/grouping_runme.rb
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'grouping'
+
+x = Grouping.test1(42)
+if x != 42
+ raise RuntimeError
+end
+
+Grouping.test2(42)
+
+x = Grouping.do_unary(37, Grouping::NEGATE)
+if x != -37
+ raise RuntimeError
+end
+
+Grouping.test3 = 42
diff --git a/trunk/Examples/test-suite/ruby/ignore_parameter_runme.rb b/trunk/Examples/test-suite/ruby/ignore_parameter_runme.rb
new file mode 100644
index 000000000..c5466a2a6
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/ignore_parameter_runme.rb
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'ignore_parameter'
+
+include Ignore_parameter
+
+# Global function tests
+raise RuntimeError unless jaguar(0, 1.0) == "hello"
+raise RuntimeError unless lotus("foo", 1.0) == 101
+raise RuntimeError unless tvr("foo", 0) == 8.8
+raise RuntimeError unless ferrari() == 101
+
+# Member function tests
+sc = SportsCars.new
+raise RuntimeError unless sc.daimler(0, 1.0) == "hello"
+raise RuntimeError unless sc.astonmartin("foo", 1.0) == 101
+raise RuntimeError unless sc.bugatti("foo", 0) == 8.8
+raise RuntimeError unless sc.lamborghini() == 101
+
+# Constructor tests
+MiniCooper.new(0, 1.0)
+MorrisMinor.new("foo", 1.0)
+FordAnglia.new("foo", 0)
+AustinAllegro.new()
+
diff --git a/trunk/Examples/test-suite/ruby/imports_runme.rb b/trunk/Examples/test-suite/ruby/imports_runme.rb
new file mode 100755
index 000000000..8bd242e86
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/imports_runme.rb
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+# This is the import runtime testcase.
+
+require 'imports_a'
+require 'imports_b'
+
+x = Imports_b::B.new
+
+x.hello
+
diff --git a/trunk/Examples/test-suite/ruby/inherit_missing_runme.rb b/trunk/Examples/test-suite/ruby/inherit_missing_runme.rb
new file mode 100644
index 000000000..aeaec2485
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/inherit_missing_runme.rb
@@ -0,0 +1,31 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'inherit_missing'
+
+a = Inherit_missing.new_Foo()
+b = Inherit_missing::Bar.new
+c = Inherit_missing::Spam.new
+
+x = Inherit_missing.do_blah(a)
+if x != "Foo::blah"
+ puts "Whoa! Bad return #{x}"
+end
+
+x = Inherit_missing.do_blah(b)
+if x != "Bar::blah"
+ puts "Whoa! Bad return #{x}"
+end
+
+x = Inherit_missing.do_blah(c)
+if x != "Spam::blah"
+ puts "Whoa! Bad return #{x}"
+end
diff --git a/trunk/Examples/test-suite/ruby/integers_runme.rb b/trunk/Examples/test-suite/ruby/integers_runme.rb
new file mode 100755
index 000000000..b6ca45891
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/integers_runme.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+#
+# Put script description here.
+#
+
+require 'swig_assert'
+require 'integers'
+include Integers
+
+swig_assert_each_line <<EOF
+signed_char_identity(-3) == -3
+unsigned_char_identity(5) == 5
+signed_short_identity(-3) == -3
+unsigned_short_identity(5) == 5
+signed_int_identity(-3) == -3
+unsigned_int_identity(5) == 5
+signed_long_identity(-3) == -3
+unsigned_long_identity(5) == 5
+signed_long_long_identity(-3) == -3
+unsigned_long_long_identity(5) == 5
+EOF
diff --git a/trunk/Examples/test-suite/ruby/li_carrays_runme.rb b/trunk/Examples/test-suite/ruby/li_carrays_runme.rb
new file mode 100644
index 000000000..97241a0f1
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_carrays_runme.rb
@@ -0,0 +1,36 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'li_carrays'
+
+include Li_carrays
+
+#
+# Testing for %array_functions(int,intArray)
+#
+ary = new_intArray(2)
+intArray_setitem(ary, 0, 0)
+intArray_setitem(ary, 1, 1)
+intArray_getitem(ary, 0)
+intArray_getitem(ary, 1)
+delete_intArray(ary)
+
+#
+# Testing for %array_class(double, doubleArray)
+#
+ary = DoubleArray.new(2)
+ary[0] = 0.0
+ary[1] = 1.0
+ary[0]
+ary[1]
+ptr = ary.cast
+ary2 = DoubleArray.frompointer(ptr)
+
diff --git a/trunk/Examples/test-suite/ruby/li_cstring_runme.rb b/trunk/Examples/test-suite/ruby/li_cstring_runme.rb
new file mode 100755
index 000000000..a4ffcad02
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_cstring_runme.rb
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+#
+# Test for li_cstring.i
+#
+
+require 'swig_assert'
+require 'li_cstring'
+
+include Li_cstring
+
+swig_assert_each_line <<EOF
+count("hello", 'l'[0]) == 2
+test1 == 'Hello World'
+test2
+test3('hello') == 'hello-suffix'
+test4('hello') == 'hello-suffix'
+test5(5) == 'xxxxx'
+test6(6) == 'xxx'
+test7 == 'Hello world!'
+test8 == (32..32+63).map {|x| x.chr }.join
+EOF
+
diff --git a/trunk/Examples/test-suite/ruby/li_factory_runme.rb b/trunk/Examples/test-suite/ruby/li_factory_runme.rb
new file mode 100644
index 000000000..a638b6f49
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_factory_runme.rb
@@ -0,0 +1,38 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'li_factory'
+
+circle = Li_factory::Geometry.create(Li_factory::Geometry::CIRCLE)
+r = circle.radius()
+if (r != 1.5)
+ raise RuntimeError, "Invalid value for r"
+end
+
+new_circle = circle.clone()
+r = new_circle.radius()
+if (r != 1.5)
+ raise RuntimeError, "Invalid value for r"
+end
+
+point = Li_factory::Geometry.create(Li_factory::Geometry::POINT)
+w = point.width()
+
+if (w != 1.0)
+ raise RuntimeError, "Invalid value for w"
+end
+
+new_point = point.clone()
+w = new_point.width()
+
+if (w != 1.0)
+ raise RuntimeError, "Invalid value for w"
+end
diff --git a/trunk/Examples/test-suite/ruby/li_math_runme.rb b/trunk/Examples/test-suite/ruby/li_math_runme.rb
new file mode 100755
index 000000000..038278315
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_math_runme.rb
@@ -0,0 +1,13 @@
+#!/usr/bin/env ruby
+#
+# li_math.i tests
+#
+#
+
+require 'swig_assert'
+require 'li_math'
+
+swig_assert_each_line <<EOF
+Li_math.cos(-5) == Math.cos(-5)
+Li_math.sin(-5) == Math.sin(-5)
+EOF
diff --git a/trunk/Examples/test-suite/ruby/li_std_deque_runme.rb b/trunk/Examples/test-suite/ruby/li_std_deque_runme.rb
new file mode 100644
index 000000000..1c1c6a8f7
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_std_deque_runme.rb
@@ -0,0 +1,55 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'li_std_deque'
+
+include Li_std_deque
+
+# Test constructors for std::deque<int>
+intDeque = IntDeque.new
+intDeque2 = IntDeque.new(3)
+intDeque3 = IntDeque.new(4, 42)
+intDeque4 = IntDeque.new(intDeque3)
+
+# Test constructors for std::deque<double>
+doubleDeque = DoubleDeque.new
+doubleDeque2 = DoubleDeque.new(3)
+doubleDeque3 = DoubleDeque.new(4, 42.0)
+doubleDeque4 = DoubleDeque.new(doubleDeque3)
+
+# Test constructors for std::deque<Real>
+realDeque = RealDeque.new
+realDeque2 = RealDeque.new(3)
+realDeque3 = RealDeque.new(4, 42.0)
+realDeque4 = RealDeque.new(realDeque3)
+
+# average() should return the average of all values in a std::deque<int>
+intDeque << 2
+intDeque << 4
+intDeque << 6
+avg = average(intDeque)
+raise RuntimeError if avg != 4.0
+
+#
+# half() should return a std::deque<float>, where each element is half
+# the value of the corresponding element in the input deque<float>.
+# The original deque's contents are unchanged.
+#
+realDeque.clear
+realDeque << 2.0
+halfDeque = half(realDeque)
+raise RuntimeError unless halfDeque[0] == 1.0
+
+#
+# halve_in_place() should...
+#
+halve_in_place(doubleDeque)
+
diff --git a/trunk/Examples/test-suite/ruby/li_std_functors_runme.rb b/trunk/Examples/test-suite/ruby/li_std_functors_runme.rb
new file mode 100755
index 000000000..d31735c45
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_std_functors_runme.rb
@@ -0,0 +1,70 @@
+#!/usr/bin/env ruby
+#
+# This is a test of STL containers using proc
+# objects to change the sorting function used in them. Same as a
+# std::binary_predicate in C++.
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'li_std_functors'
+
+
+def _set(container)
+ swig_assert_each_line(<<EOF, binding)
+ cont = #{container}.new
+ [9,1,8,2,7,3,6,4,5].each { |x| cont.insert(x) }
+ i0 = cont.begin()
+ cont.to_a == [1,2,3,4,5,6,7,8,9]
+ cont = #{container}.new( proc { |a,b| b < a } )
+ [9,1,8,2,7,3,6,4,5].each { |x| cont.insert(x) }
+ cont.to_a == [9, 8, 7, 6, 5, 4, 3, 2, 1]
+ cont = #{container}.new( proc { |a,b| b > a } )
+ [9,1,8,2,7,3,6,4,5].each { |x| cont.insert(x) }
+ cont.to_a == [1, 2, 3, 4, 5, 6, 7, 8, 9]
+ cont = #{container}.new(proc { |a,b| b < a } )
+ cont.insert(1)
+ cont.to_a == [1]
+ i0 = cont.begin()
+ cont.erase(i0) # don't use i0 anymore, it is invalid now
+ cont.to_a == []
+EOF
+end
+
+def _map(container)
+ swig_assert_each_line(<<EOF, binding)
+ cont = #{container}.new
+ cont['z'] = 9
+ cont['y'] = 1
+ cont['x'] = 8
+ cont['w'] = 2
+ cont.to_a == [['w',2],['x',8],['y',1],['z',9]]
+
+ cont = #{container}.new(proc { |a,b| b < a } )
+ cont['z'] = 9
+ cont['y'] = 1
+ cont['x'] = 8
+ cont['w'] = 2
+ cont.to_a == [['z',9],['y',1],['x',8],['w',2]]
+EOF
+end
+
+def test
+ yield method(:_set), Li_std_functors::Set
+ yield method(:_map), Li_std_functors::Map
+end
+
+# these should fail and not segfault
+begin
+ Li_std_functors::Set.new('sd')
+rescue
+end
+
+test do |proc, container|
+ proc.call(container)
+end
+
+
diff --git a/trunk/Examples/test-suite/ruby/li_std_map_runme.rb b/trunk/Examples/test-suite/ruby/li_std_map_runme.rb
new file mode 100755
index 000000000..0ec8cac84
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_std_map_runme.rb
@@ -0,0 +1,51 @@
+#!/usr/bin/env ruby
+#
+# Tests for std::map
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'li_std_map'
+
+swig_assert_each_line(<<'EOF', binding)
+
+a1 = Li_std_map::A.new(3)
+a2 = Li_std_map::A.new(7)
+
+p0 = Li_std_map::Pairii.new(1,2)
+p1 = Li_std_map::PairA.new(1,a1)
+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.new
+m[1] = a1
+m[2] = a2
+m.respond_to?(:each_key) == true
+m.respond_to?(:each_value) == true
+
+pm ={}
+m.each_key { |k| pm[k] = m[k] }
+m.each_key { |k| swig_assert_equal("pm[k].object_id", "m[k].object_id", binding, 'only true if %trackings is on') }
+
+m = {}
+m[1] = [1,2]
+m["foo"] = "hello"
+
+pm = Li_std_map::LanguageMap.new
+m.each_key { |k| pm[k] = m[k] }
+m.each_key { |k| swig_assert_equal("pm[#{k.inspect}]", "m[#{k.inspect}]", binding) }
+EOF
+
+mii = Li_std_map::IntIntMap.new
+
+mii[1] = 1
+mii[1] = 2
+
+swig_assert( "mii[1] == 2", binding )
diff --git a/trunk/Examples/test-suite/ruby/li_std_multimap_runme.rb b/trunk/Examples/test-suite/ruby/li_std_multimap_runme.rb
new file mode 100755
index 000000000..b0c2bb359
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_std_multimap_runme.rb
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+#
+# Tests for std::multimap
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'li_std_multimap'
+
+swig_assert_each_line(<<'EOF', binding)
+
+a1 = Li_std_multimap::A.new(3)
+a2 = Li_std_multimap::A.new(7)
+
+m = Li_std_multimap::MultimapA.new
+m[0] = a1
+m[0] = a2
+m[0].size == 2
+m.respond_to?(:each) == true
+m.respond_to?(:each_key) == true
+m.respond_to?(:each_value) == true
+m.values_at(0)[0] == m[0]
+EOF
+
diff --git a/trunk/Examples/test-suite/ruby/li_std_pair_lang_object_runme.rb b/trunk/Examples/test-suite/ruby/li_std_pair_lang_object_runme.rb
new file mode 100644
index 000000000..3ce2bd3f5
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_std_pair_lang_object_runme.rb
@@ -0,0 +1,19 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'li_std_pair_lang_object'
+include Li_std_pair_lang_object
+
+swig_assert_each_line(<<'EOF', binding)
+val = ValuePair.new
+val.first = 'sd'
+val.second = [5,4,3]
+EOF
diff --git a/trunk/Examples/test-suite/ruby/li_std_pair_runme.rb b/trunk/Examples/test-suite/ruby/li_std_pair_runme.rb
new file mode 100755
index 000000000..685046fd2
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_std_pair_runme.rb
@@ -0,0 +1,57 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'li_std_pair'
+include Li_std_pair
+
+swig_assert_each_line(<<'EOF', binding)
+#
+# Because of template specializations for pair<int, int>, these should return
+# an Array of size 2, where both elements are Fixnums.
+#
+intPair = makeIntPair(7, 6)
+intPair.instance_of?(Array)
+intPair.size == 2
+intPair[0] == 7 && intPair[1] == 6
+
+intPairConstRef = makeIntPairConstRef(7, 6)
+intPairConstRef.instance_of?(Array)
+intPairConstRef[0] == 7 && intPairConstRef[1] == 6
+
+#
+# Each of these should return a reference to a wrapped
+# std::pair<int, int> object (i.e. an IntPair instance).
+#
+intPairPtr = makeIntPairPtr(7, 6)
+intPairPtr.instance_of?(IntPair)
+intPairPtr[0] == 7 && intPairPtr[1] == 6
+
+intPairRef = makeIntPairRef(7, 6)
+intPairRef.instance_of?(IntPair)
+intPairRef[0] == 7 && intPairRef[1] == 6
+#
+# Now test various input typemaps. Each of the wrapped C++ functions
+# (product1, product2 and product3) is expecting an argument of a
+# different type (see li_std_pair.i). Typemaps should be in place to
+# convert this Array into the expected argument type.
+#
+product1(intPair) == 42
+product2(intPair) == 42
+product3(intPair) == 42
+
+#
+# Similarly, each of the input typemaps should know what to do
+# with an IntPair instance.
+#
+product1(intPairPtr) == 42
+product2(intPairPtr) == 42
+product3(intPairPtr) == 42
+EOF
diff --git a/trunk/Examples/test-suite/ruby/li_std_queue_runme.rb b/trunk/Examples/test-suite/ruby/li_std_queue_runme.rb
new file mode 100755
index 000000000..63101ed6e
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_std_queue_runme.rb
@@ -0,0 +1,32 @@
+#!/usr/bin/env ruby
+#
+# A simple std::queue test
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'li_std_queue'
+include Li_std_queue
+
+swig_assert_each_line(<<'EOF', binding)
+a = IntQueue.new
+a << 1
+a << 2
+a << 3
+a.back == 3
+a.front == 1
+a.pop
+a.back == 3
+a.front == 2
+a.pop
+a.back == 3
+a.front == 3
+a.pop
+a.size == 0
+a.empty? == true
+
+EOF
diff --git a/trunk/Examples/test-suite/ruby/li_std_set_runme.rb b/trunk/Examples/test-suite/ruby/li_std_set_runme.rb
new file mode 100755
index 000000000..65354be58
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_std_set_runme.rb
@@ -0,0 +1,63 @@
+#!/usr/bin/env ruby
+#
+# Put script description here.
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'li_std_set'
+include Li_std_set
+
+swig_assert_each_line(<<'EOF', binding)
+s = Set_string.new
+
+s.push("a")
+s.push("b")
+s << "c"
+
+sum = ''
+s.each { |x| sum << x }
+sum == 'abc'
+
+b = s.begin # only if swig iterators are on
+e = s.end
+sum = ''
+while b != e; sum << b.value; b.next; end
+sum == 'abc'
+
+b = s.rbegin # only if swig iterators are on
+e = s.rend
+sum = ''
+while b != e; sum << b.value; b.next; end
+sum == 'cba'
+
+
+si = Set_int.new
+si << 1
+si.push(2)
+si.push(3)
+
+i = s.begin()
+i.next()
+s.erase(i)
+s.to_s == 'ac'
+
+b = s.begin
+e = s.end
+e - b == 2
+
+m = b + 1
+m.value == 'c'
+
+s = LanguageSet.new
+s.insert([1,2])
+s.insert(1)
+s.insert("hello")
+s.to_a == [1,[1,2],'hello'] # sort order: s.sort {|a,b| a.hash <=> b.hash}
+
+EOF
+
diff --git a/trunk/Examples/test-suite/ruby/li_std_speed2_runme.rb b/trunk/Examples/test-suite/ruby/li_std_speed2_runme.rb
new file mode 100755
index 000000000..1c4e15f2d
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_std_speed2_runme.rb
@@ -0,0 +1,67 @@
+#!/usr/bin/env ruby
+
+require 'benchmark'
+require 'li_std_speed'
+include Li_std_speed
+
+def benchmark(f, phigh, sequences)
+ print f.class
+ puts '%10s ' % 'n' + sequences.inject('') { |a,s| a << '%10s' % s.class }
+ 0.upto(phigh-1) do |p|
+ n = 2**p
+ print "%10d"%n
+ $stdout.flush
+ for s in sequences
+ cont = s.new((0..n).to_a)
+ Benchmark.benchmark { f.call(cont) }
+ end
+ end
+end
+
+def iterate(cont)
+ # expected: O(n)
+ # got: O(n**2) for set/list (vector/deque fine)
+ it = cont.begin
+ last = cont.end
+ while it != last
+ it.next
+ end
+end
+
+
+def erase(cont)
+ # expected: O(n)
+ # got: O(n**2) for vector/deque and O(n**3) for set/list
+ it = cont.end
+ # can't reuse begin since it might get invalidated
+ while it != cont.begin
+ it.previous
+ # set returns None, so need to reobtain end
+ it = cont.erase(it) or cont.end
+ end
+end
+
+def insert(cont)
+ it = cont.end
+ size = cont.size
+ if cont.kind_of? RbSet
+ # swig stl missing hint version of insert for set
+ # expected would be O(n) with iterator hint version
+ # expected: O(n*log(n))
+ # got: O(n**3*log(n))
+ size.upto(size<<1) { |x| cont.insert(x) }
+ else
+ # expected: O(n)
+ # got: O(n**3) for list (vector/deque fine)
+ size.upto(size<<1) { |x| cont.push(x) }
+ end
+end
+
+if $0 == __FILE__
+ sequences = [RbVector,RbDeque,RbSet,RbList]
+ for f,phigh in [[method(:iterate),15], [method(:insert),15],
+ [method(:erase),11]]
+ benchmark(f, phigh, sequences)
+ end
+end
+
diff --git a/trunk/Examples/test-suite/ruby/li_std_stack_runme.rb b/trunk/Examples/test-suite/ruby/li_std_stack_runme.rb
new file mode 100755
index 000000000..806bba029
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_std_stack_runme.rb
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby
+#
+# A simple std::stack test
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'li_std_stack'
+include Li_std_stack
+
+swig_assert_each_line(<<'EOF', binding)
+a = IntStack.new
+a << 1
+a << 2
+a << 3
+a.top == 3
+a.pop
+a.top == 2
+a.pop
+a.top == 1
+a.pop
+a.size == 0
+a.empty? == true
+# a.top == Qnil
+
+EOF
diff --git a/trunk/Examples/test-suite/ruby/li_std_stream_runme.rb b/trunk/Examples/test-suite/ruby/li_std_stream_runme.rb
new file mode 100755
index 000000000..80c5166f3
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_std_stream_runme.rb
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+#
+# Simple test of std::ostringstream.
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'li_std_stream'
+include Li_std_stream
+
+swig_assert_each_line(<<'EOF', binding)
+
+a = A.new
+o = Ostringstream.new
+o << a << " " << 2345 << " " << 1.435
+o.str == "A class 2345 1.435"
+
+EOF
diff --git a/trunk/Examples/test-suite/ruby/li_std_string_runme.rb b/trunk/Examples/test-suite/ruby/li_std_string_runme.rb
new file mode 100644
index 000000000..dc85b5dab
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_std_string_runme.rb
@@ -0,0 +1,144 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'li_std_string'
+
+include Li_std_string
+
+# Checking expected use of %typemap(in) std::string {}
+test_value("Fee")
+
+# Checking expected result of %typemap(out) std::string {}
+raise RuntimeError unless test_value("Fi") == "Fi"
+
+# Verify type-checking for %typemap(in) std::string {}
+exceptionRaised = false
+begin
+ test_value(0)
+rescue TypeError
+ exceptionRaised = true
+ensure
+ raise RuntimeError unless exceptionRaised
+end
+
+# Checking expected use of %typemap(in) const std::string & {}
+test_const_reference("Fo")
+
+# Checking expected result of %typemap(out) const std::string& {}
+raise RuntimeError unless test_const_reference("Fum") == "Fum"
+
+# Verify type-checking for %typemap(in) const std::string & {}
+exceptionRaised = false
+begin
+ test_const_reference(0)
+rescue TypeError
+ exceptionRaised = true
+ensure
+ raise RuntimeError unless exceptionRaised
+end
+
+#
+# Input and output typemaps for pointers and non-const references to
+# std::string are *not* supported; the following tests confirm
+# that none of these cases are slipping through.
+#
+
+exceptionRaised = false
+begin
+ test_pointer("foo")
+rescue TypeError
+ exceptionRaised = true
+ensure
+ raise RuntimeError unless exceptionRaised
+end
+
+result = test_pointer_out()
+raise RuntimeError if result.is_a? String
+
+exceptionRaised = false
+begin
+ test_const_pointer("bar")
+rescue TypeError
+ exceptionRaised = true
+ensure
+ raise RuntimeError unless exceptionRaised
+end
+
+result = test_const_pointer_out()
+raise RuntimeError if result.is_a? String
+
+exceptionRaised = false
+begin
+ test_reference("foo")
+rescue TypeError
+ exceptionRaised = true
+ensure
+ raise RuntimeError unless exceptionRaised
+end
+
+result = test_reference_out()
+raise RuntimeError if result.is_a? String
+
+
+# Member Strings
+myStructure = Structure.new
+if (myStructure.MemberString2 != "member string 2")
+ raise RuntimeError
+end
+s = "Hello"
+myStructure.MemberString2 = s
+if (myStructure.MemberString2 != s)
+ raise RuntimeError
+end
+if (myStructure.ConstMemberString != "const member string")
+ raise RuntimeError
+end
+
+
+if (Structure.StaticMemberString2 != "static member string 2")
+ raise RuntimeError
+end
+Structure.StaticMemberString2 = s
+if (Structure.StaticMemberString2 != s)
+ raise RuntimeError
+end
+if (Structure.ConstStaticMemberString != "const static member string")
+ raise RuntimeError
+end
+
+
+if (test_reference_input("hello") != "hello")
+ raise RuntimeError
+end
+s = test_reference_inout("hello")
+if (s != "hellohello")
+ raise RuntimeError
+end
+
+
+if (stdstring_empty() != "")
+ raise RuntimeError
+end
+
+if (c_empty() != "")
+ raise RuntimeError
+end
+
+
+if (c_null() != nil)
+ raise RuntimeError
+end
+
+
+if (get_null(c_null()) != nil)
+ raise RuntimeError
+end
+
diff --git a/trunk/Examples/test-suite/ruby/li_std_vector_runme.rb b/trunk/Examples/test-suite/ruby/li_std_vector_runme.rb
new file mode 100755
index 000000000..8bcad2d19
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/li_std_vector_runme.rb
@@ -0,0 +1,122 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'li_std_vector'
+
+include Li_std_vector
+
+iv = IntVector.new(4)
+
+swig_assert( "iv.respond_to? :each", binding )
+
+begin
+ iv.each
+ swig_assert( false, nil, "iv.each worked with no block!")
+rescue ArgumentError
+end
+
+swig_assert_each_line(<<'EOF', binding)
+iv.respond_to?(:each) == true
+iv.respond_to?(:each_with_index) == true
+EOF
+
+iv.each_with_index { |e,i|
+ swig_assert("#{e} == 0", binding, "for iv[#{i}] == 0")
+}
+
+0.upto(3) { |i| iv[i] = i }
+
+{ "iv[-1]" => 3,
+ "iv.slice(0,2).to_s" => "01",
+ "iv.slice(1,2).to_s" => "12",
+ "iv[0,-2]" => nil,
+ "iv[0,3].to_s" => "012",
+ "iv[0,10].to_s" => "012",
+ "iv[1..2].to_s" => '12',
+ "iv[1..3].to_s" => '123',
+ "iv[1..4].to_s" => '123',
+ "iv[1..-2].to_s" => '12',
+ "iv[2..-3]" => nil,
+}.each do |k,v|
+ swig_assert( "#{k} == #{v.inspect}", binding )
+end
+
+swig_assert_each_line(<<'EOF', binding)
+iv << 5
+iv.push 5
+iv.pop == 5
+iv.unshift(7)
+iv.shift == 7
+iv.unshift(7, 3)
+iv.insert(1,5)
+iv.insert(0, 3)
+iv.unshift(2,3,4)
+x = average(iv)
+y = average([1, 2, 3, 4])
+half([10, 10.5, 11, 11.5])
+EOF
+
+dv = DoubleVector.new(10)
+
+swig_assert( "dv.respond_to? :each_with_index", binding )
+
+dv.each_with_index { |e,i| swig_assert_equal("dv[#{i}]", 0.0, binding) }
+
+0.upto(9) { |i| dv[i] = i/2.0 }
+
+{ "dv[-1]" => 4.5,
+ "dv.slice(0,2).to_s" => "0.00.5",
+ "dv[0,-2]" => nil,
+ "dv[0,3].to_s" => "0.00.51.0",
+ "dv[3,3].to_s" => "1.52.02.5",
+}.each do |k,v|
+ swig_assert_equal( k, v.inspect, binding )
+end
+
+swig_assert_each_line(<<'EOF', binding)
+dv.delete_at(2)
+dv.delete_if { |x| x == 2.0 }
+dv.include? 3.0
+dv.find {|x| x == 3.0 }
+dv.kind_of? DoubleVector
+halved = []
+halved = dv.map { |x| x / 2 }
+halve_in_place(dv)
+halved.to_a == dv.to_a
+sv = StructVector.new
+sv << Li_std_vector::Struct.new
+sv[0].class == Li_std_vector::Struct
+sv[1] = Li_std_vector::Struct.new
+
+EOF
+
+bv = BoolVector.new(2)
+[true, false, true, true].each { |i| bv.push(i) }
+0.upto(bv.size-1) { |i| bv[i] = !bv[i] }
+bv_check = [true, true, false, true, false, false]
+for i in 0..bv.size-1 do
+ swig_assert(bv_check[i] == bv[i], binding, "bv[#{i}]")
+end
+
+swig_assert_each_line(<<'EOF', binding)
+lv = LanguageVector.new
+lv << 1
+lv << [1,2]
+lv << 'asd'
+lv[0], lv[1] = lv[1], lv[0]
+EOF
+
+
+# this should assert
+begin
+ lv = LanguageVector.new('crapola')
+rescue
+end
diff --git a/trunk/Examples/test-suite/ruby/member_pointer_runme.rb b/trunk/Examples/test-suite/ruby/member_pointer_runme.rb
new file mode 100644
index 000000000..eca6f0df8
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/member_pointer_runme.rb
@@ -0,0 +1,54 @@
+#!/usr/bin/env ruby
+#
+# Example using pointers to member functions
+#
+#
+#
+
+require 'swig_assert'
+
+require 'member_pointer'
+
+include Member_pointer
+
+def check(what, expected, actual)
+ if not expected == actual
+ raise RuntimeError, "Failed: #{what} Expected: #{expected} Actual: #{actual}"
+ end
+end
+
+# Get the pointers
+
+area_pt = Member_pointer::areapt
+perim_pt = Member_pointer::perimeterpt
+
+# Create some objects
+
+s = Member_pointer::Square.new(10)
+
+# Do some calculations
+
+check "Square area ", 100.0, Member_pointer::do_op(s, area_pt)
+check "Square perim", 40.0, Member_pointer::do_op(s, perim_pt)
+
+memberPtr = Member_pointer::areavar
+memberPtr = Member_pointer::perimetervar
+
+# Try the variables
+check "Square area ", 100.0, Member_pointer::do_op(s, Member_pointer::areavar)
+check "Square perim", 40.0, Member_pointer::do_op(s, Member_pointer::perimetervar)
+
+# Modify one of the variables
+Member_pointer::areavar = perim_pt
+
+check "Square perimeter", 40.0, Member_pointer::do_op(s, Member_pointer::areavar)
+
+# Try the constants
+
+memberPtr = Member_pointer::AREAPT
+memberPtr = Member_pointer::PERIMPT
+memberPtr = Member_pointer::NULLPT
+
+check "Square area ", 100.0, Member_pointer::do_op(s, Member_pointer::AREAPT)
+check "Square perim", 40.0, Member_pointer::do_op(s, Member_pointer::PERIMPT)
+
diff --git a/trunk/Examples/test-suite/ruby/minherit_runme.rb b/trunk/Examples/test-suite/ruby/minherit_runme.rb
new file mode 100644
index 000000000..ba41ab6fa
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/minherit_runme.rb
@@ -0,0 +1,89 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'minherit'
+
+a = Minherit::Foo.new
+b = Minherit::Bar.new
+c = Minherit::FooBar.new
+d = Minherit::Spam.new
+
+if a.xget() != 1
+ raise RuntimeError, "Bad attribute value"
+end
+
+if b.yget() != 2
+ raise RuntimeError, "Bad attribute value"
+end
+
+if c.xget() != 1 or c.yget() != 2 or c.zget() != 3
+ raise RuntimeError, "Bad attribute value"
+end
+
+if d.xget() != 1 or d.yget() != 2 or d.zget() != 3 or d.wget() != 4
+ raise RuntimeError, "Bad attribute value"
+end
+
+if Minherit.xget(a) != 1
+ raise RuntimeError, "Bad attribute value #{Minherit.xget(a)}"
+end
+
+if Minherit.yget(b) != 2
+ raise RuntimeError, "Bad attribute value #{Minherit.yget(b)}"
+end
+
+if Minherit.xget(c) != 1 or Minherit.yget(c) != 2 or Minherit.zget(c) != 3
+ raise RuntimeError, "Bad attribute value #{Minherit.xget(c)} #{Minherit.yget(c)} #{Minherit.zget(c)}"
+end
+
+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 #{Minherit.xget(d)} #{Minherit.yget(d)} #{Minherit.zget(d)} #{Minherit.wget(d)}"
+end
+
+# 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"
+end
+
+if bb.yget() != 2
+ raise RuntimeError, "Bad attribute value"
+end
+
+if cc.xget() != 1 or cc.yget() != 2 or cc.zget() != 3
+ raise RuntimeError, "Bad attribute value"
+end
+
+if dd.xget() != 1 or dd.yget() != 2 or dd.zget() != 3 or dd.wget() != 4
+ raise RuntimeError, "Bad attribute value"
+end
+
+if Minherit.xget(aa) != 1
+ raise RuntimeError, "Bad attribute value #{Minherit.xget(aa)}"
+end
+
+if Minherit.yget(bb) != 2
+ raise RuntimeError, "Bad attribute value #{Minherit.yget(bb)}"
+end
+
+if Minherit.xget(cc) != 1 or Minherit.yget(cc) != 2 or Minherit.zget(cc) != 3
+ raise RuntimeError, "Bad attribute value #{Minherit.xget(cc)} #{Minherit.yget(cc)} #{Minherit.zget(cc)}"
+end
+
+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 #{Minherit.xget(dd)} #{Minherit.yget(dd)} #{Minherit.zget(dd)} #{Minherit.wget(dd)}"
+end
+
diff --git a/trunk/Examples/test-suite/ruby/namespace_typemap_runme.rb b/trunk/Examples/test-suite/ruby/namespace_typemap_runme.rb
new file mode 100755
index 000000000..42a5e23a7
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/namespace_typemap_runme.rb
@@ -0,0 +1,44 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'namespace_typemap'
+
+include Namespace_typemap
+
+raise RuntimeError 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"
+
+begin
+ ttest1(-14)
+ raise RuntimeError
+rescue RangeError
+end
diff --git a/trunk/Examples/test-suite/ruby/newobject1_runme.rb b/trunk/Examples/test-suite/ruby/newobject1_runme.rb
new file mode 100644
index 000000000..f5dc12fb5
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/newobject1_runme.rb
@@ -0,0 +1,33 @@
+#!/usr/bin/env ruby
+#
+# Simple test of %newobject
+# * The purpose of this test is to confirm that a language module
+# * correctly handles the case when C++ class member functions (of both
+# * the static and non-static persuasion) have been tagged with the
+# * %newobject directive.
+#
+# Ruby's GC is somewhat broken in that it will mark some more stack space
+# leading to the collection of local objects to be delayed.
+# Thus, upon invokation, it sometimes you can wait up to several
+# instructions to kick in.
+# See: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/7449
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'swig_gc'
+require 'newobject1'
+
+include Newobject1
+
+GC.track_class = Foo
+GC.start
+100.times { foo1 = Foo.makeFoo; foo2 = foo1.makeMore }
+GC.stats if $VERBOSE
+swig_assert( 'Foo.fooCount == 200', binding, "but is #{Foo.fooCount}" )
+GC.start
+swig_assert( 'Foo.fooCount <= 2', binding, "but is #{Foo.fooCount}" )
+
diff --git a/trunk/Examples/test-suite/ruby/newobject2_runme.rb b/trunk/Examples/test-suite/ruby/newobject2_runme.rb
new file mode 100644
index 000000000..99bc24374
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/newobject2_runme.rb
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+#
+# Ruby's GC is somewhat broken in that it will mark some more stack space
+# leading to the collection of local objects to be delayed.
+# Thus, upon invokation, it sometimes you can wait up to several
+# instructions to kick in.
+# See: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/7449
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'swig_gc'
+require 'newobject2'
+
+include Newobject2
+
+GC.track_class = Foo
+GC.stats if $VERBOSE
+100.times { foo1 = makeFoo }
+GC.stats if $VERBOSE
+swig_assert( 'fooCount == 100', nil, "but is #{fooCount}" )
+GC.start
+swig_assert( 'fooCount <= 1', nil, "but is #{fooCount}" )
+
diff --git a/trunk/Examples/test-suite/ruby/overload_copy_runme.rb b/trunk/Examples/test-suite/ruby/overload_copy_runme.rb
new file mode 100755
index 000000000..eb184b83c
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/overload_copy_runme.rb
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'overload_copy'
+
+include Overload_copy
+
+f = Foo.new
+g = Foo.new(f)
diff --git a/trunk/Examples/test-suite/ruby/overload_extend_runme.rb b/trunk/Examples/test-suite/ruby/overload_extend_runme.rb
new file mode 100755
index 000000000..255793fb4
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/overload_extend_runme.rb
@@ -0,0 +1,19 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'overload_extend'
+
+f = Overload_extend::Foo.new
+
+raise RuntimeError if f.test(3) != 1
+raise RuntimeError if f.test("hello") != 2
+raise RuntimeError if f.test(3.5,2.5) != 6
+
diff --git a/trunk/Examples/test-suite/ruby/overload_extendc_runme.rb b/trunk/Examples/test-suite/ruby/overload_extendc_runme.rb
new file mode 100755
index 000000000..a2682bf42
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/overload_extendc_runme.rb
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'overload_extend'
+
+f = Overload_extend::Foo.new
+
+raise RuntimeError if f.test(3) != 1
+raise RuntimeError if f.test("hello") != 2
+raise RuntimeError if f.test(3.5,2.5) != 6
diff --git a/trunk/Examples/test-suite/ruby/overload_simple_runme.rb b/trunk/Examples/test-suite/ruby/overload_simple_runme.rb
new file mode 100755
index 000000000..88cee4411
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/overload_simple_runme.rb
@@ -0,0 +1,130 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'overload_simple'
+
+include Overload_simple
+
+if foo(3) != "foo:int"
+ raise RuntimeError, "foo(int)"
+end
+
+if foo(3.0) != "foo:double"
+ raise RuntimeError, "foo(double)"
+end
+
+if foo("hello") != "foo:char *"
+ raise RuntimeError, "foo(char *)"
+end
+
+f = Foo.new
+b = Bar.new
+
+if foo(f) != "foo:Foo *"
+ raise RuntimeError, "foo(Foo *)"
+end
+
+if foo(b) != "foo:Bar *"
+ raise RuntimeError, "foo(Bar *)"
+end
+
+v = malloc_void(32)
+
+if foo(v) != "foo:void *"
+ raise RuntimeError, "foo(void *)"
+end
+
+s = Spam.new
+
+if s.foo(3) != "foo:int"
+ raise RuntimeError, "Spam::foo(int)"
+end
+
+if s.foo(3.0) != "foo:double"
+ raise RuntimeError, "Spam::foo(double)"
+end
+
+if s.foo("hello") != "foo:char *"
+ raise RuntimeError, "Spam::foo(char *)"
+end
+
+if s.foo(f) != "foo:Foo *"
+ raise RuntimeError, "Spam::foo(Foo *)"
+end
+
+if s.foo(b) != "foo:Bar *"
+ raise RuntimeError, "Spam::foo(Bar *)"
+end
+
+if s.foo(v) != "foo:void *"
+ raise RuntimeError, "Spam::foo(void *)"
+end
+
+if Spam.bar(3) != "bar:int"
+ raise RuntimeError, "Spam::bar(int)"
+end
+
+if Spam.bar(3.0) != "bar:double"
+ raise RuntimeError, "Spam::bar(double)"
+end
+
+if Spam.bar("hello") != "bar:char *"
+ raise RuntimeError, "Spam::bar(char *)"
+end
+
+if Spam.bar(f) != "bar:Foo *"
+ raise RuntimeError, "Spam::bar(Foo *)"
+end
+
+if Spam.bar(b) != "bar:Bar *"
+ raise RuntimeError, "Spam::bar(Bar *)"
+end
+
+if Spam.bar(v) != "bar:void *"
+ raise RuntimeError, "Spam::bar(void *)"
+end
+
+# Test constructors
+
+s = Spam.new
+if s.type != "none"
+ raise RuntimeError, "Spam()"
+end
+
+s = Spam.new(3)
+if s.type != "int"
+ raise RuntimeError, "Spam(int)"
+end
+
+s = Spam.new(3.4)
+if s.type != "double"
+ raise RuntimeError, "Spam(double)"
+end
+
+s = Spam.new("hello")
+if s.type != "char *"
+ raise RuntimeError, "Spam(char *)"
+end
+
+s = Spam.new(f)
+if s.type != "Foo *"
+ raise RuntimeError, "Spam(Foo *)"
+end
+
+s = Spam.new(b)
+if s.type != "Bar *"
+ raise RuntimeError, "Spam(Bar *)"
+end
+
+s = Spam.new(v)
+if s.type != "void *"
+ raise RuntimeError, "Spam(void *)"
+end
diff --git a/trunk/Examples/test-suite/ruby/overload_subtype_runme.rb b/trunk/Examples/test-suite/ruby/overload_subtype_runme.rb
new file mode 100644
index 000000000..991a2e4ad
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/overload_subtype_runme.rb
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'overload_subtype'
+
+include Overload_subtype
+
+f = Foo.new
+b = Bar.new
+
+if spam(f) != 1
+ raise RuntimeError, "foo"
+end
+
+if spam(b) != 2
+ raise RuntimeError, "bar"
+end
+
diff --git a/trunk/Examples/test-suite/ruby/overload_template_runme.rb b/trunk/Examples/test-suite/ruby/overload_template_runme.rb
new file mode 100755
index 000000000..b099fd3ea
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/overload_template_runme.rb
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'overload_template'
+
+f = Overload_template.foo()
+
+a = Overload_template.maximum(3,4)
+b = Overload_template.maximum(3.4,5.2)
diff --git a/trunk/Examples/test-suite/ruby/primitive_ref_runme.rb b/trunk/Examples/test-suite/ruby/primitive_ref_runme.rb
new file mode 100755
index 000000000..5e97c7a6c
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/primitive_ref_runme.rb
@@ -0,0 +1,38 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'primitive_ref'
+
+include Primitive_ref
+
+raise RuntimeError 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(true) != true
+
+raise RuntimeError if ref_char('x') != 'x'
diff --git a/trunk/Examples/test-suite/ruby/primitive_types_runme.rb b/trunk/Examples/test-suite/ruby/primitive_types_runme.rb
new file mode 100644
index 000000000..0024c9696
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/primitive_types_runme.rb
@@ -0,0 +1,98 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'primitive_types'
+
+include Primitive_types
+
+
+raise RuntimeError if val_uchar(255) != 255
+
+fail = 0
+begin
+ val_uchar(-1)
+rescue RangeError
+ fail = 1
+end
+
+fail = 0
+begin
+ val_uchar(256)
+rescue RangeError
+ fail = 1
+end
+
+raise RuntimeError if fail != 1
+
+fail = 0
+begin
+ val_uchar(256.0)
+rescue TypeError
+ fail = 1
+end
+
+raise RuntimeError if fail != 1
+
+fail = 0
+begin
+ val_uchar("caca")
+rescue TypeError
+ fail = 1
+end
+
+raise RuntimeError if fail != 1
+
+# Test a number which won't fit in a 32 bit integer and is represented
+# as a FIXNUM by Ruby.
+raise RuntimeError if val_double(51767811298) != 51767811298
+
+raise RuntimeError if val_double_2(1.0) != 4.0
+raise RuntimeError if val_double_2(1) != 4
+raise RuntimeError if val_double_2(1,1) != 2
+
+fail = 0
+begin
+ val_double_2("1.0",1.0)
+rescue
+ fail = 1
+end
+raise RuntimeError if fail != 1
+
+
+fail = 0
+begin
+ val_double_2(1.0,"1.0")
+rescue
+ fail = 1
+end
+raise RuntimeError if fail != 1
+
+
+raise RuntimeError if val_float_2(1.0) != 4.0
+raise RuntimeError if val_float_2(1) != 4
+raise RuntimeError if val_float_2(1,1) != 2
+
+fail = 0
+begin
+ val_float_2("1.0",1.0)
+rescue
+ fail = 1
+end
+raise RuntimeError if fail != 1
+
+
+fail = 0
+begin
+ val_float_2(1.0,"1.0")
+rescue
+ fail = 1
+end
+raise RuntimeError if fail != 1
diff --git a/trunk/Examples/test-suite/ruby/profiletest_runme.rb b/trunk/Examples/test-suite/ruby/profiletest_runme.rb
new file mode 100644
index 000000000..0f6ddc7f9
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/profiletest_runme.rb
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'profiletest'
+
+a = Profiletest::A.new()
+b = Profiletest::B.new()
+
+for i in 0...1000000
+ a = b.fn(a)
+end
+
diff --git a/trunk/Examples/test-suite/ruby/refcount_runme.rb b/trunk/Examples/test-suite/ruby/refcount_runme.rb
new file mode 100644
index 000000000..7ef3c846e
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/refcount_runme.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'refcount'
+
+
+a = Refcount::A3.new;
+b1 = Refcount::B.new a;
+b2 = Refcount::B.new a;
+
+if a.ref_count() != 3
+ print "This program will crash... now\n"
+end
diff --git a/trunk/Examples/test-suite/ruby/reference_global_vars_runme.rb b/trunk/Examples/test-suite/ruby/reference_global_vars_runme.rb
new file mode 100644
index 000000000..49fbf4dfa
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/reference_global_vars_runme.rb
@@ -0,0 +1,104 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'reference_global_vars'
+
+# primitive reference variables
+Reference_global_vars.var_bool = Reference_global_vars.createref_bool(true)
+if (Reference_global_vars.value_bool(Reference_global_vars.var_bool) != true)
+ print "Runtime error test 1\n"
+ exit 1
+end
+
+Reference_global_vars.var_bool = Reference_global_vars.createref_bool(false)
+if (Reference_global_vars.value_bool(Reference_global_vars.var_bool) != false)
+ print "Runtime error test 2 \n"
+ exit 1
+end
+
+Reference_global_vars.var_char = Reference_global_vars.createref_char('w')
+if (Reference_global_vars.value_char(Reference_global_vars.var_char) != 'w')
+ print "Runtime error test 3 \n"
+ exit 1
+end
+
+Reference_global_vars.var_unsigned_char = Reference_global_vars.createref_unsigned_char(10)
+if (Reference_global_vars.value_unsigned_char(Reference_global_vars.var_unsigned_char) != 10)
+ print "Runtime error test 4 \n"
+ exit 1
+end
+
+Reference_global_vars.var_signed_char = Reference_global_vars.createref_signed_char(10)
+if (Reference_global_vars.value_signed_char(Reference_global_vars.var_signed_char) != 10)
+ print "Runtime error test 5 \n"
+ exit 1
+end
+
+Reference_global_vars.var_short = Reference_global_vars.createref_short(10)
+if (Reference_global_vars.value_short(Reference_global_vars.var_short) != 10)
+ print "Runtime error test 6 \n"
+ exit 1
+end
+
+Reference_global_vars.var_unsigned_short = Reference_global_vars.createref_unsigned_short(10)
+if (Reference_global_vars.value_unsigned_short(Reference_global_vars.var_unsigned_short) != 10)
+ print "Runtime error test 7 \n"
+ exit 1
+end
+
+Reference_global_vars.var_int = Reference_global_vars.createref_int(10)
+if (Reference_global_vars.value_int(Reference_global_vars.var_int) != 10)
+ print "Runtime error test 8 \n"
+ exit 1
+end
+
+Reference_global_vars.var_unsigned_int = Reference_global_vars.createref_unsigned_int(10)
+if (Reference_global_vars.value_unsigned_int(Reference_global_vars.var_unsigned_int) != 10)
+ print "Runtime error test 9 \n"
+ exit 1
+end
+
+Reference_global_vars.var_long = Reference_global_vars.createref_long(10)
+if (Reference_global_vars.value_long(Reference_global_vars.var_long) != 10)
+ print "Runtime error test 10 \n"
+ exit 1
+end
+
+Reference_global_vars.var_unsigned_long = Reference_global_vars.createref_unsigned_long(10)
+if (Reference_global_vars.value_unsigned_long(Reference_global_vars.var_unsigned_long) != 10)
+ print "Runtime error test 11 \n"
+ exit 1
+end
+
+Reference_global_vars.var_long_long = Reference_global_vars.createref_long_long(10)
+if (Reference_global_vars.value_long_long(Reference_global_vars.var_long_long) != 10)
+ print "Runtime error test 12 \n"
+ exit 1
+end
+
+Reference_global_vars.var_unsigned_long_long = Reference_global_vars.createref_unsigned_long_long(10)
+if (Reference_global_vars.value_unsigned_long_long(Reference_global_vars.var_unsigned_long_long) != 10)
+ print "Runtime error test 13 \n"
+ exit 1
+end
+
+Reference_global_vars.var_float = Reference_global_vars.createref_float(10.5)
+if (Reference_global_vars.value_float(Reference_global_vars.var_float) != 10.5)
+ print "Runtime error test 14 \n"
+ exit 1
+end
+
+Reference_global_vars.var_double = Reference_global_vars.createref_double(10.5)
+if (Reference_global_vars.value_double(Reference_global_vars.var_double) != 10.5)
+ print "Runtime error test 15 \n"
+ exit 1
+end
+
diff --git a/trunk/Examples/test-suite/ruby/rename_scope_runme.rb b/trunk/Examples/test-suite/ruby/rename_scope_runme.rb
new file mode 100644
index 000000000..76a14871d
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/rename_scope_runme.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'rename_scope'
+
+include Rename_scope
+
+a = Natural_UP.new
+b = Natural_BP.new
+
+raise RuntimeError if a.rtest() != 1
+
+raise RuntimeError if b.rtest() != 1
diff --git a/trunk/Examples/test-suite/ruby/ruby_keywords_runme.rb b/trunk/Examples/test-suite/ruby/ruby_keywords_runme.rb
new file mode 100644
index 000000000..9b06ecf1d
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/ruby_keywords_runme.rb
@@ -0,0 +1,159 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'ruby_keywords'
+
+kw = Ruby_keywords::Keywords.new
+
+if kw.alias != 'alias' then
+ raise RuntimeError, 'Keyword method did not work: alias'
+end
+
+if kw.and != 'and' then
+ raise RuntimeError, 'Keyword method did not work: and'
+end
+
+if kw.begin != 'begin' then
+ raise RuntimeError, 'Keyword method did not work: begin'
+end
+
+if kw.break != 'break' then
+ raise RuntimeError, 'Keyword method did not work: break'
+end
+
+if kw.case != 'case' then
+ raise RuntimeError, 'Keyword method did not work: case'
+end
+
+if kw.class != 'class' then
+ raise RuntimeError, 'Keyword method did not work: class'
+end
+
+if kw.def != 'def' then
+ raise RuntimeError, 'Keyword method did not work: def'
+end
+
+if kw.defined? != 'defined?' then
+ raise RuntimeError, 'Keyword method did not work: defined?'
+end
+
+if kw.do != 'do' then
+ raise RuntimeError, 'Keyword method did not work: do'
+end
+
+if kw.else != 'else' then
+ raise RuntimeError, 'Keyword method did not work: else'
+end
+
+if kw.elsif != 'elsif' then
+ raise RuntimeError, 'Keyword method did not work: elsif'
+end
+
+if kw.end != 'end' then
+ raise RuntimeError, 'Keyword method did not work: end'
+end
+
+if kw.ensure != 'ensure' then
+ raise RuntimeError, 'Keyword method did not work: ensure'
+end
+
+if kw.false != 'false' then
+ raise RuntimeError, 'Keyword method did not work: false'
+end
+
+if kw.for != 'for' then
+ raise RuntimeError, 'Keyword method did not work: for'
+end
+
+if kw.if != 'if' then
+ raise RuntimeError, 'Keyword method did not work: if'
+end
+
+if kw.in != 'in' then
+ raise RuntimeError, 'Keyword method did not work: in'
+end
+
+if kw.module != 'module' then
+ raise RuntimeError, 'Keyword method did not work: module'
+end
+
+if kw.next != 'next' then
+ raise RuntimeError, 'Keyword method did not work: next'
+end
+
+if kw.nil != 'nil' then
+ raise RuntimeError, 'Keyword method did not work: nil'
+end
+
+if kw.not != 'not' then
+ raise RuntimeError, 'Keyword method did not work: not'
+end
+
+if kw.or != 'or' then
+ raise RuntimeError, 'Keyword method did not work: or'
+end
+
+if kw.redo != 'redo' then
+ raise RuntimeError, 'Keyword method did not work: redo'
+end
+
+if kw.rescue != 'rescue' then
+ raise RuntimeError, 'Keyword method did not work: rescue'
+end
+
+if kw.retry != 'retry' then
+ raise RuntimeError, 'Keyword method did not work: retry'
+end
+
+if kw.return != 'return' then
+ raise RuntimeError, 'Keyword method did not work: return'
+end
+
+if kw.self != 'self' then
+ raise RuntimeError, 'Keyword method did not work: self'
+end
+
+if kw.super != 'super' then
+ raise RuntimeError, 'Keyword method did not work: super'
+end
+
+if kw.then != 'then' then
+ raise RuntimeError, 'Keyword method did not work: then'
+end
+
+if kw.true != 'true' then
+ raise RuntimeError, 'Keyword method did not work: true'
+end
+
+if kw.under != 'under' then
+ raise RuntimeError, 'Keyword method did not work: under'
+end
+
+if kw.unless != 'unless' then
+ raise RuntimeError, 'Keyword method did not work: unless'
+end
+
+if kw.until != 'until' then
+ raise RuntimeError, 'Keyword method did not work: until'
+end
+
+if kw.when != 'when' then
+ raise RuntimeError, 'Keyword method did not work: when'
+end
+
+if kw.while != 'while' then
+ raise RuntimeError, 'Keyword method did not work: while'
+end
+
+if kw.yield != 'yield' then
+ raise RuntimeError, 'Keyword method did not work: yield'
+end
+
diff --git a/trunk/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb b/trunk/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb
new file mode 100755
index 000000000..e79cb46a8
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb
@@ -0,0 +1,82 @@
+#!/usr/bin/env ruby
+#
+# This is a simple speed benchmark suite for std containers,
+# to verify their O(n) performance.
+# It is not part of the standard tests.
+
+
+require 'benchmark'
+require 'mathn'
+require 'ruby_li_std_speed'
+include Ruby_li_std_speed
+
+
+def benchmark(f, phigh, sequences)
+ puts f
+ print '%10s' % 'n'
+ maxlen = sequences.max { |a,b| a.to_s.size <=> b.to_s.size }
+ maxlen = maxlen.to_s.size - 12
+ sequences.each { |s| print "%#{maxlen}s" % "#{s.to_s.sub(/.*::/,'')}" }
+ puts
+ o_perf = Array.new(sequences.size, 0)
+ last_t = Array.new(sequences.size, nil)
+ 1.upto(phigh) do |p|
+ n = 2**(p-1)
+ print "%10d" % n
+ sequences.each_with_index do |s, i|
+ cont = s.new((0..n).to_a)
+ Benchmark.benchmark('',0,"%#{maxlen-2}.6r") { |x|
+ t = x.report { f.call(cont) }
+ o_perf[i] += last_t[i] ? (t.real / last_t[i]) : t.real
+ last_t[i] = t.real
+ }
+ end
+ puts
+ end
+
+ print " avg. O(n)"
+ base = 1.0 / Math.log(2.0)
+ sequences.each_with_index do |s, i|
+ o_perf[i] /= phigh
+ # o_perf[i] = 1 if o_perf[i] < 1
+ o_perf[i] = Math.log(o_perf[i]) * base
+ print "%#{maxlen-1}.2f " % o_perf[i]
+ end
+ puts
+end
+
+def iterate(cont)
+ it = cont.begin
+ last = cont.end
+ while it != last
+ it.next
+ end
+end
+
+
+def erase(cont)
+ it = cont.end
+ # can't reuse begin since it might get invalidated
+ while it != cont.begin
+ it.previous
+ # set returns None, so need to reobtain end
+ it = cont.erase(it) || cont.end
+ end
+end
+
+def insert(cont)
+ size = cont.size
+ size.upto((size<<1) - 1) { |x| cont.push(x) }
+end
+
+if $0 == __FILE__
+ GC.disable
+ sequences = [RbVector,RbDeque,RbSet,RbList,
+ RbFloatVector,RbFloatDeque,RbFloatSet,RbFloatList]
+ n = 17
+ for f,phigh in [[method(:iterate),n], [method(:insert),n],
+ [method(:erase),n-4]]
+ benchmark(f, phigh, sequences)
+ end
+end
+
diff --git a/trunk/Examples/test-suite/ruby/ruby_naming_runme.rb b/trunk/Examples/test-suite/ruby/ruby_naming_runme.rb
new file mode 100644
index 000000000..8ea5f13d3
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/ruby_naming_runme.rb
@@ -0,0 +1,115 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'ruby_naming'
+
+# Check class names
+if not Ruby_naming
+ raise RuntimeError, 'Invalid module name for Ruby_naming'
+end
+
+if not Ruby_naming::MyClass
+ raise RuntimeError, 'Invalid class name for MyClass'
+end
+
+
+# Check constant names / values
+if Ruby_naming::CONSTANT1 != 1
+ raise RuntimeError, "Incorrect value for CONSTANT1"
+end
+
+if Ruby_naming::CONSTANT2 != 2
+ raise RuntimeError, "Incorrect value for CONSTANT2"
+end
+
+# Check constant names / values
+if Ruby_naming::CONSTANT3 != 3
+ raise RuntimeError, "Incorrect value for CONSTANT3"
+end
+
+if not Ruby_naming::methods.include?("constant4")
+ raise RuntimeError, "Incorrect mapping for constant4"
+end
+
+if not Ruby_naming::methods.include?("constant5")
+ raise RuntimeError, "Incorrect mapping for constant5"
+end
+
+if not Ruby_naming::methods.include?("constant6")
+ raise RuntimeError, "Incorrect mapping for constant6"
+end
+
+if not Ruby_naming::TestConstants.instance_methods.include?("constant7")
+ raise RuntimeError, "Incorrect mapping for constant7"
+end
+
+if not Ruby_naming::TestConstants.methods.include?("constant8")
+ raise RuntimeError, "Incorrect mapping for constant8"
+end
+
+# There is no constant9 because it is illegal C++
+#if not Ruby_naming::TestConstants.instance_methods.include?("constant9")
+# raise RuntimeError, "Incorrect mapping for constant9"
+#end
+
+if Ruby_naming::TestConstants::CONSTANT10 != 10
+ raise RuntimeError, "Incorrect value for CONSTANT10"
+end
+
+if not Ruby_naming::methods.include?("constant11")
+ raise RuntimeError, "Incorrect mapping for constant11"
+end
+
+
+# Check enums
+if Ruby_naming::constants.include?("Color")
+ raise RuntimeError, "Color enum should not be exposed to Ruby"
+end
+
+if Ruby_naming::Red != 0
+ raise RuntimeError, "Incorrect value for enum RED"
+end
+
+if Ruby_naming::Green != 1
+ raise RuntimeError, "Incorrect value for enum GREEN"
+end
+
+if Ruby_naming::Blue != 2
+ raise RuntimeError, "Incorrect value for enum BLUE"
+end
+
+
+# Check method names
+my_class = Ruby_naming::MyClass.new()
+
+if my_class.method_one != 1
+ raise RuntimeError, "Incorrect value for method_one"
+end
+
+if my_class.method_two != 2
+ raise RuntimeError, "Incorrect value for method_two"
+end
+
+if my_class.method_three != 3
+ raise RuntimeError, "Incorrect value for method_three"
+end
+
+if my_class.method_44_4 != 4
+ raise RuntimeError, "Incorrect value for method_44_4"
+end
+
+if my_class.predicate_method? != true
+ raise RuntimeError, "Incorrect value for predicate_method?"
+end
+
+if my_class.bang_method! != true
+ raise RuntimeError, "Incorrect value for bang_method!"
+end
diff --git a/trunk/Examples/test-suite/ruby/ruby_track_objects_directors_runme.rb b/trunk/Examples/test-suite/ruby/ruby_track_objects_directors_runme.rb
new file mode 100644
index 000000000..fb55323a8
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/ruby_track_objects_directors_runme.rb
@@ -0,0 +1,39 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'ruby_track_objects_directors'
+
+class MyFoo < Ruby_track_objects_directors::Foo
+ def ping
+ "MyFoo::ping()"
+ end
+end
+
+a = MyFoo.new
+
+raise RuntimeError if a.ping != "MyFoo::ping()"
+raise RuntimeError if a.pong != "Foo::pong();MyFoo::ping()"
+
+b = Ruby_track_objects_directors::Foo.new
+
+raise RuntimeError if b.ping != "Foo::ping()"
+raise RuntimeError if b.pong != "Foo::pong();Foo::ping()"
+
+container = Ruby_track_objects_directors::Container.new
+foo = MyFoo.new
+container.set_foo(foo)
+
+myFoo1 = container.get_foo
+myFoo2 = container.get_foo
+
+if not myFoo1.equal?(myFoo2)
+ raise RuntimeError, "MyFoo's should be the same"
+end
diff --git a/trunk/Examples/test-suite/ruby/ruby_track_objects_runme.rb b/trunk/Examples/test-suite/ruby/ruby_track_objects_runme.rb
new file mode 100644
index 000000000..7bc67a478
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/ruby_track_objects_runme.rb
@@ -0,0 +1,117 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'ruby_track_objects'
+
+def test_same_ruby_object(foo1, foo2)
+ if not foo1.equal?(foo2)
+ raise "Ruby objects should be the same."
+ end
+end
+
+def test_same_cpp_object(foo1, foo2)
+ if not foo1.cpp_equal(foo2)
+ raise "C++ objects should be the same"
+ end
+end
+
+bar = Ruby_track_objects::Bar.new
+foo1 = Ruby_track_objects::Foo.new()
+bar.set_unowned_foo(foo1)
+
+# test_simple_identity
+foo2 = Ruby_track_objects::Foo.new()
+foo3 = foo2
+
+test_same_ruby_object(foo2, foo3)
+test_same_cpp_object(foo2, foo3)
+
+# test_unowned_foo_identity
+foo4 = bar.get_unowned_foo()
+
+test_same_ruby_object(foo1, foo4)
+test_same_cpp_object(foo1, foo4)
+
+# test_owned_foo_identity
+foo5 = bar.get_owned_foo()
+foo6 = bar.get_owned_foo()
+
+test_same_ruby_object(foo5, foo6)
+test_same_cpp_object(foo5, foo6)
+
+# test_new_foo_identity
+foo7 = Ruby_track_objects::Bar.get_new_foo()
+foo8 = Ruby_track_objects::Bar.get_new_foo()
+
+if foo7.equal?(foo8)
+ raise "Ruby objects should be different."
+end
+
+if foo7.cpp_equal(foo8)
+ raise "C++ objects should be different."
+end
+
+# test_set_owned_identity
+foo9 = Ruby_track_objects::Foo.new
+bar.set_owned_foo(foo9)
+foo10 = bar.get_owned_foo()
+
+test_same_ruby_object(foo9, foo10)
+test_same_cpp_object(foo9, foo10)
+
+# test_set_owned_identity2
+begin
+ foo11 = Ruby_track_objects::Foo.new
+ bar.set_owned_foo(foo11)
+ foo11 = nil
+end
+
+GC.start
+
+foo12 = bar.get_owned_foo()
+
+if not (foo12.say_hello == "Hello")
+ raise "Invalid C++ object returned."
+end
+
+# test_set_owned_identity3
+foo13 = bar.get_owned_foo_by_argument()
+foo14 = bar.get_owned_foo_by_argument()
+
+test_same_ruby_object(foo13, foo14)
+test_same_cpp_object(foo13, foo14)
+
+# Now create the factory
+factory = Ruby_track_objects::Factory.new
+
+# Create itemA which is really an itemB
+itemA = factory.createItem
+
+# Check class
+if itemA.class != Ruby_track_objects::ItemA
+ raise RuntimeError, 'Item should have an ItemA class'
+end
+
+# Now downcast
+itemB = Ruby_track_objects.downcast(itemA)
+
+if itemB.class != Ruby_track_objects::ItemB
+ raise RuntimeError, 'Item should have an ItemB class'
+end
+
+if itemA.eql?(itemB)
+ raise RuntimeError, 'Items should be different'
+end
+
+
+
+
+
diff --git a/trunk/Examples/test-suite/ruby/smart_pointer_const_runme.rb b/trunk/Examples/test-suite/ruby/smart_pointer_const_runme.rb
new file mode 100644
index 000000000..b6565ad76
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/smart_pointer_const_runme.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'smart_pointer_const'
+
+include Smart_pointer_const
+
+f = Foo.new
+b = Bar.new(f)
+
+b.x = 3
+raise RuntimeError if b.getx() != 3
+
+fp = b.__deref__()
+fp.x = 4
+raise RuntimeError if fp.getx() != 4
diff --git a/trunk/Examples/test-suite/ruby/smart_pointer_multi_runme.rb b/trunk/Examples/test-suite/ruby/smart_pointer_multi_runme.rb
new file mode 100644
index 000000000..a899ae758
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/smart_pointer_multi_runme.rb
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'smart_pointer_multi'
+
+include Smart_pointer_multi
+
+f = Foo.new
+b = Bar.new(f)
+s = Spam.new(b)
+g = Grok.new(b)
+
+s.x = 3
+raise RuntimeError if s.getx() != 3
+
+g.x = 4
+raise RuntimeError if g.getx() != 4
+
diff --git a/trunk/Examples/test-suite/ruby/smart_pointer_multi_typedef_runme.rb b/trunk/Examples/test-suite/ruby/smart_pointer_multi_typedef_runme.rb
new file mode 100644
index 000000000..d07da0d2e
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/smart_pointer_multi_typedef_runme.rb
@@ -0,0 +1,25 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'smart_pointer_multi_typedef'
+
+include Smart_pointer_multi_typedef
+
+f = Foo.new
+b = Bar.new(f)
+s = Spam.new(b)
+g = Grok.new(b)
+
+s.x = 3
+raise RuntimeError if s.getx() != 3
+
+g.x = 4
+raise RuntimeError if g.getx() != 4
diff --git a/trunk/Examples/test-suite/ruby/smart_pointer_not_runme.rb b/trunk/Examples/test-suite/ruby/smart_pointer_not_runme.rb
new file mode 100644
index 000000000..4324908f0
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/smart_pointer_not_runme.rb
@@ -0,0 +1,55 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'smart_pointer_not'
+
+include Smart_pointer_not
+
+f = Foo.new
+b = Bar.new(f)
+s = Spam.new(f)
+g = Grok.new(f)
+
+begin
+ x = b.x
+ puts "Error! b.x"
+rescue NameError
+end
+
+begin
+ x = s.x
+ puts "Error! s.x"
+rescue NameError
+end
+
+begin
+ x = g.x
+ puts "Error! g.x"
+rescue NameError
+end
+
+begin
+ x = b.getx()
+ puts "Error! b.getx()"
+rescue NameError
+end
+
+begin
+ x = s.getx()
+ puts "Error! s.getx()"
+rescue NameError
+end
+
+begin
+ x = g.getx()
+ puts "Error! g.getx()"
+rescue NameError
+end
diff --git a/trunk/Examples/test-suite/ruby/smart_pointer_overload_runme.rb b/trunk/Examples/test-suite/ruby/smart_pointer_overload_runme.rb
new file mode 100644
index 000000000..24c343ac7
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/smart_pointer_overload_runme.rb
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'smart_pointer_overload'
+
+include Smart_pointer_overload
+
+f = Foo.new
+b = Bar.new(f)
+
+
+raise RuntimeError 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
+
diff --git a/trunk/Examples/test-suite/ruby/smart_pointer_rename_runme.rb b/trunk/Examples/test-suite/ruby/smart_pointer_rename_runme.rb
new file mode 100644
index 000000000..167e55444
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/smart_pointer_rename_runme.rb
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'smart_pointer_rename'
+
+include Smart_pointer_rename
+
+f = Foo.new
+b = Bar.new(f)
+
+raise RuntimeError if b.test() != 3
+
+raise RuntimeError if b.ftest1(1) != 1
+
+raise RuntimeError if b.ftest2(2,3) != 2
diff --git a/trunk/Examples/test-suite/ruby/smart_pointer_simple_runme.rb b/trunk/Examples/test-suite/ruby/smart_pointer_simple_runme.rb
new file mode 100644
index 000000000..bdfbf9cd8
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/smart_pointer_simple_runme.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'smart_pointer_simple'
+
+include Smart_pointer_simple
+
+f = Foo.new
+b = Bar.new(f)
+
+b.x = 3
+raise RuntimeError if b.getx() != 3
+
+fp = b.__deref__()
+fp.x = 4
+raise RuntimeError if fp.getx() != 4
diff --git a/trunk/Examples/test-suite/ruby/smart_pointer_typedef_runme.rb b/trunk/Examples/test-suite/ruby/smart_pointer_typedef_runme.rb
new file mode 100644
index 000000000..168471234
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/smart_pointer_typedef_runme.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'smart_pointer_typedef'
+
+include Smart_pointer_typedef
+
+f = Foo.new
+b = Bar.new(f)
+
+b.x = 3
+raise RuntimeError if b.getx() != 3
+
+fp = b.__deref__()
+fp.x = 4
+raise RuntimeError if fp.getx() != 4
diff --git a/trunk/Examples/test-suite/ruby/sneaky1_runme.rb b/trunk/Examples/test-suite/ruby/sneaky1_runme.rb
new file mode 100755
index 000000000..c30fdaf2a
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/sneaky1_runme.rb
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require '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/ruby/static_const_member_2_runme.rb b/trunk/Examples/test-suite/ruby/static_const_member_2_runme.rb
new file mode 100644
index 000000000..0ba970ed8
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/static_const_member_2_runme.rb
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'static_const_member_2'
+
+include Static_const_member_2
+
+c = Test_int.new
+a = Test_int::Forward_field # should be available as a class constant
+a = Test_int::Current_profile # should be available as a class constant
+a = Test_int::RightIndex # should be available as a class constant
+a = Test_int::Backward_field # should be available as a class constant
+a = Test_int::LeftIndex # should be available as a class constant
+a = Test_int.cavity_flags
+
diff --git a/trunk/Examples/test-suite/ruby/std_containers_runme.rb b/trunk/Examples/test-suite/ruby/std_containers_runme.rb
new file mode 100755
index 000000000..73d443218
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/std_containers_runme.rb
@@ -0,0 +1,119 @@
+#!/usr/bin/env ruby
+#
+# Standard containers test suite. Tests:
+# std::complex, std::vector, std::set and std::map,
+# and IN/OUT functions for them.
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'std_containers'
+include Std_containers
+
+swig_assert_each_line(<<'EOF', binding)
+
+cube = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
+
+icube = cident(cube)
+icube.each_index { |i| swig_assert_equal("cube[#{i}]","icube[#{i}]", binding, 'cident') }
+
+
+p = [1,2]
+p == pident(p)
+
+v = [1,2,3,4,5,6]
+iv = vident(v)
+iv.each_index { |i| swig_assert_equal("iv[#{i}]","v[#{i}]", binding, 'vident') }
+
+
+
+iv = videntu(v)
+iv.each_index { |i| swig_assert_equal("iv[#{i}]","v[#{i}]", binding, 'videntu') }
+
+
+vu = Vector_ui.new(v)
+vu[2] == videntu(vu)[2]
+
+v[0,3][1] == vu[0,3][1]
+
+m = [[1,2,3],[2,3],[3,4]]
+im = midenti(m)
+
+0.upto(m.size-1){ |i| 0.upto(m[i].size-1) { |j| swig_assert_equal("m[#{i}][#{j}]","im[#{i}][#{j}]", binding, 'getslice') } }
+
+
+m = [[1,0,1],[1,1],[1,1]]
+im = midentb(m)
+
+0.upto(m.size-1){ |i| 0.upto(m[i].size-1) { |j| swig_assert_equal("(m[#{i}][#{j}]==1)","im[#{i}][#{j}]", binding, 'getslice') } }
+
+mi = Imatrix.new(m)
+mc = Cmatrix.new(m)
+mi[0][0] == mc[0][0] # or bad matrix
+
+map ={}
+map['hello'] = 1
+map['hi'] = 2
+map['3'] = 2
+
+imap = Std_containers.mapident(map)
+map.each_key { |k| swig_assert_equal("map['#{k}']", "imap['#{k}']", binding) }
+
+mapc ={}
+c1 = C.new
+c2 = C.new
+mapc[1] = c1
+mapc[2] = c2
+
+mapidentc(mapc)
+
+vi = Vector_i.new([2,2,3,4])
+v1 = vi.dup
+v1.class == vi.class
+v1 != vi
+v1.object_id != vi.object_id
+
+v = [1,2]
+v1 = v_inout(vi)
+vi[1] == v1[1]
+# vi.class == v1.class # only if SWIG_RUBY_EXTRA_NATIVE_CONTAINERS was set
+
+v1,v2 = [[1,2],[3,4]]
+v1,v2 = v_inout2(v1,v2)
+v2 == [1,2]
+v1 == [3,4]
+
+a1 = A.new(1)
+a2 = A.new(2)
+
+p1 = [1,a1]
+p2 = [2,a2]
+v = [p1,p2]
+v2 = 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 = Set_i.new
+s.push(1)
+s.push(2)
+s.push(3)
+j = 1
+s.each { |i| swig_assert_equal("#{i}","#{j}", binding, "for s[#{i}]"); j += 1 }
+
+
+EOF
+
diff --git a/trunk/Examples/test-suite/ruby/stl_new_runme.rb b/trunk/Examples/test-suite/ruby/stl_new_runme.rb
new file mode 100755
index 000000000..80d4ceab3
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/stl_new_runme.rb
@@ -0,0 +1,117 @@
+#!/usr/bin/env ruby
+#
+# This is a test of STL containers, iterators and using proc
+# objects to change the sorting function used in them. Same as a
+# std::binary_predicate in C++.
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'stl_new'
+
+
+def _sequence(container)
+ swig_assert_each_line(<<'EOF', binding)
+cont = container.new([9,1,8,2,7,3,6,4,5])
+cont.to_a == [9,1,8,2,7,3,6,4,5]
+cont.size == 9
+i = cont.begin
+i.class == Stl_new::Iterator
+cont.end - cont.begin == cont.size
+cont.begin.value == 9
+(cont.end-1).value == 5
+cont[0],cont[1] = cont[1],cont[0]
+cont.to_a == [1,9,8,2,7,3,6,4,5]
+i0 = cont.begin
+i1 = i0+1
+tmp = i0.value # tmp = 1
+tmp == 1
+i0.value = i1.value # elem[0] = 9
+i1.value = tmp # elem[1] = 1
+cont.to_a == [9,1,8,2,7,3,6,4,5]
+i0 += 8
+prev = i0.value
+i0 -= 8
+cur = i0.value
+i0.value = prev
+prev = cur
+i0 += 8
+cur = i0.value
+i0.value = prev
+cont.to_a == [5,1,8,2,7,3,6,4,9]
+i0 == cont.end-1
+i0 != cont.end
+EOF
+end
+
+def _random_iterator(container)
+ swig_assert_each_line(<<EOF, binding)
+ cont = #{container}.new([9,1,8,2,7,3,6,4,5])
+ Stl_new.nth_element(cont.begin,cont.begin+cont.size/2,cont.end)
+ cont.to_a == [3, 1, 2, 4, 5, 6, 7, 8, 9]
+ Stl_new.nth_element(cont.begin,cont.begin+1,cont.end, proc { |a,b| b<a } )
+ cont.to_a == [9, 8, 7, 6, 5, 4, 2, 1, 3]
+EOF
+end
+
+def _set(container)
+ swig_assert_each_line(<<EOF, binding)
+ cont = #{container}.new
+ [9,1,8,2,7,3,6,4,5].each { |x| cont.insert(x) }
+ i0 = cont.begin()
+ cont.to_a == [1,2,3,4,5,6,7,8,9]
+ cont = #{container}.new( proc { |a,b| b < a } )
+ [9,1,8,2,7,3,6,4,5].each { |x| cont.insert(x) }
+ cont.to_a == [9, 8, 7, 6, 5, 4, 3, 2, 1]
+ cont = #{container}.new( proc { |a,b| b > a } )
+ [9,1,8,2,7,3,6,4,5].each { |x| cont.insert(x) }
+ cont.to_a == [1, 2, 3, 4, 5, 6, 7, 8, 9]
+ cont = #{container}.new(proc { |a,b| b < a } )
+ cont.insert(1)
+ cont.to_a == [1]
+ i0 = cont.begin()
+ cont.erase(i0) # don't use i0 anymore, it is invalid now
+ cont.to_a == []
+EOF
+end
+
+def _map(container)
+ swig_assert_each_line(<<EOF, binding)
+ cont = #{container}.new
+ cont['z'] = 9
+ cont['y'] = 1
+ cont['x'] = 8
+ cont['w'] = 2
+ cont.to_a == [['w',2],['x',8],['y',1],['z',9]]
+
+ cont = #{container}.new(proc { |a,b| b < a } )
+ cont['z'] = 9
+ cont['y'] = 1
+ cont['x'] = 8
+ cont['w'] = 2
+ cont.to_a == [['z',9],['y',1],['x',8],['w',2]]
+
+ #cont.iterator.to_a == [['w',2],['x',8],['y',1],['z',9]]
+EOF
+end
+
+def test
+ for container in [Stl_new::Vector, Stl_new::Deque, Stl_new::List]
+ yield method(:_sequence), container
+ end
+ yield method(:_set), Stl_new::Set
+ yield method(:_map), Stl_new::Map
+# for container in [Stl_new::Vector, Stl_new::Deque]
+# yield method(:_random_iterator), container
+# end
+end
+
+
+test do |proc, container|
+ proc.call(container)
+end
+
+
diff --git a/trunk/Examples/test-suite/ruby/struct_value_runme.rb b/trunk/Examples/test-suite/ruby/struct_value_runme.rb
new file mode 100644
index 000000000..afed41803
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/struct_value_runme.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'struct_value'
+
+b = Struct_value::Bar.new
+
+b.a.x = 3
+raise RuntimeError if b.a.x != 3
+
+b.b.x = 3
+raise RuntimeError if b.b.x != 3
+
diff --git a/trunk/Examples/test-suite/ruby/swig_assert.rb b/trunk/Examples/test-suite/ruby/swig_assert.rb
new file mode 100755
index 000000000..200b08384
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/swig_assert.rb
@@ -0,0 +1,141 @@
+#!/usr/bin/env ruby
+#
+# A simple function to create useful asserts
+#
+#
+#
+#
+#
+
+
+#
+# Exception raised when some swig binding test fails
+#
+class SwigRubyError < RuntimeError
+end
+
+
+#
+# Asserts whether a and b are equal.
+#
+# scope - optional Binding where to run the code
+# msg - optional additional message to print
+#
+def swig_assert_equal( a, b, scope = nil, msg = nil )
+ begin
+ check = "#{a} == #{b}"
+ if scope.kind_of? Binding
+ ok = eval(check.to_s, scope)
+ else
+ ok = eval(check.to_s)
+ if !msg
+ msg = scope
+ scope = nil
+ end
+ end
+ rescue => e
+ raise
+ end
+
+ unless ok
+ valA = eval(a, scope)
+ valB = eval(b, scope)
+ raise SwigRubyError.new("FAILED EQUALITY: #{check} was #{valA} not #{valB}")
+ end
+
+ if $VERBOSE
+ $stdout.puts "\tPASSED EQUALITY #{check} #{msg}"
+ end
+
+ return ok
+rescue => e
+ trace = e.backtrace[1..-1]
+ $stderr.puts "#{trace[0,1]}: #{e}"
+ if trace.size > 1
+ $stderr.puts "\tfrom #{trace[1..-1].join("\n\t ")}"
+ end
+ exit(1)
+end
+
+
+#
+# Asserts whether an expression runs properly and is true
+#
+# scope - optional Binding where to run the code
+# msg - optional additional message to print
+#
+def swig_assert( expr, scope = nil, msg = nil )
+ begin
+ if scope.kind_of? Binding
+ ok = eval(expr.to_s, scope)
+ else
+ ok = eval(expr.to_s)
+ msg = scope if !msg
+ end
+ rescue
+ raise
+ end
+
+ raise SwigRubyError.new("FAILED: #{expr.to_s} - #{msg}") unless ok
+
+ if $VERBOSE
+ $stdout.puts "\tPASSED #{expr} #{msg}"
+ end
+rescue => e
+ trace = e.backtrace[1..-1]
+ $stderr.puts "#{trace[0,1]}: #{e}"
+ if trace.size > 1
+ $stderr.puts "\tfrom #{trace[1..-1].join("\n\t ")}"
+ end
+ exit(1)
+end
+
+#
+# Asserts whether an expression runs properly
+#
+# scope - optional Binding where to run the code
+# msg - optional additional message to print
+#
+def swig_eval( expr, scope = nil, msg = nil )
+ begin
+ if scope.kind_of? Binding
+ eval(expr.to_s, scope)
+ else
+ eval(expr.to_s)
+ msg = scope if !msg
+ end
+ rescue => e
+ raise SwigRubyError.new("Wrong assert: #{expr.to_s} - #{e}")
+ end
+ if $VERBOSE
+ $stdout.puts "\tPASSED #{expr} #{msg}"
+ end
+rescue => e
+ trace = e.backtrace[1..-1]
+ $stderr.puts "#{trace[0,1]}: #{e}"
+ if trace.size > 1
+ $stderr.puts "\tfrom #{trace[1..-1].join("\n\t ")}"
+ end
+ exit(1)
+end
+
+
+#
+# Given a set of lines as text, runs each of them, asserting them.
+# Lines that are of the form:
+# a == b are run with swig_assert_equal
+# others are run with swig_eval.
+#
+# scope - optional Binding where to run the code
+# msg - optional additional message to print
+#
+def swig_assert_each_line( lines, scope = nil, msg = nil )
+ lines.split("\n").each do |line|
+ next if line.empty? or line =~ /^\s*#.*/
+ if line =~ /^\s*([^\s]*)\s*==\s*(.*)\s*$/
+ swig_assert_equal($1, $2, scope, msg)
+ else
+ swig_eval(line, scope, msg)
+ end
+ end
+end
diff --git a/trunk/Examples/test-suite/ruby/swig_gc.rb b/trunk/Examples/test-suite/ruby/swig_gc.rb
new file mode 100755
index 000000000..30f6dfa42
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/swig_gc.rb
@@ -0,0 +1,70 @@
+#!/usr/bin/env ruby
+#
+#
+# VERY nice function from Robert Klemme to check memory leaks
+# and check on what GC has collected since last call.
+#
+# Usage can be:
+#
+# require 'swig_gc'
+#
+# GC.stats
+# # do some stuff..
+# GC.start # collect and report stats
+# # do some more...
+# GC.stats # just report stats
+#
+# or:
+#
+# require 'swig_gc'
+#
+# GC.track_class = String # track just String classes
+# GC.stats
+# # do some stuff..
+# GC.start # collect and report stats
+# # do some more...
+# GC.stats # just report stats
+#
+#
+#
+#
+#
+
+module GC
+
+ class << self
+
+ attr :last_stat
+ attr_accessor :track_class
+
+ alias :_start :start
+
+ def start
+ _start
+ stats if $VERBOSE
+ end
+
+ def stats
+ stats = Hash.new(0)
+ ObjectSpace.each_object {|o| stats[o.class] += 1}
+
+ if track_class
+ v = stats[track_class]
+ printf "\t%-30s %10d", track_class.to_s, v
+ if last_stat
+ printf " | delta %10d", (v - last_stat[track_class])
+ end
+ puts
+ else
+ stats.sort {|(k1,v1),(k2,v2)| v2 <=> v1}.each do |k,v|
+ printf "\t%-30s %10d", k, v
+ printf " | delta %10d", (v - last_stat[k]) if last_stat
+ puts
+ end
+ end
+
+ last_stat = stats
+ end
+ end
+
+end
diff --git a/trunk/Examples/test-suite/ruby/template_construct_runme.rb b/trunk/Examples/test-suite/ruby/template_construct_runme.rb
new file mode 100644
index 000000000..4acebfe29
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/template_construct_runme.rb
@@ -0,0 +1,13 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'template_construct'
+
diff --git a/trunk/Examples/test-suite/ruby/template_extend1_runme.rb b/trunk/Examples/test-suite/ruby/template_extend1_runme.rb
new file mode 100644
index 000000000..999b181ba
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/template_extend1_runme.rb
@@ -0,0 +1,19 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'template_extend1'
+
+a = Template_extend1::LBaz.new
+b = Template_extend1::DBaz.new
+
+raise RuntimeError unless a.foo() == "lBaz::foo"
+raise RuntimeError unless b.foo() == "dBaz::foo"
+
diff --git a/trunk/Examples/test-suite/ruby/template_extend2_runme.rb b/trunk/Examples/test-suite/ruby/template_extend2_runme.rb
new file mode 100644
index 000000000..89082b97c
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/template_extend2_runme.rb
@@ -0,0 +1,19 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'template_extend2'
+
+a = Template_extend2::LBaz.new
+b = Template_extend2::DBaz.new
+
+raise RuntimeError unless a.foo() == "lBaz::foo"
+raise RuntimeError unless b.foo() == "dBaz::foo"
+
diff --git a/trunk/Examples/test-suite/ruby/template_inherit_runme.rb b/trunk/Examples/test-suite/ruby/template_inherit_runme.rb
new file mode 100755
index 000000000..609508891
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/template_inherit_runme.rb
@@ -0,0 +1,51 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'template_inherit'
+
+include Template_inherit
+
+a = FooInt.new
+b = FooDouble.new
+c = BarInt.new
+d = BarDouble.new
+e = FooUInt.new
+f = BarUInt.new
+
+raise ValueError 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"
diff --git a/trunk/Examples/test-suite/ruby/template_ns4_runme.rb b/trunk/Examples/test-suite/ruby/template_ns4_runme.rb
new file mode 100755
index 000000000..bf2c5f566
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/template_ns4_runme.rb
@@ -0,0 +1,15 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'template_ns4'
+
+d = Template_ns4.make_Class_DD()
+raise RuntimeError if d.test() != "test"
diff --git a/trunk/Examples/test-suite/ruby/template_ns_runme.rb b/trunk/Examples/test-suite/ruby/template_ns_runme.rb
new file mode 100755
index 000000000..6446127cd
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/template_ns_runme.rb
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'template_ns'
+
+include Template_ns
+
+p1 = Pairii.new(2, 3)
+p2 = Pairii.new(p1)
+
+raise RuntimeError if p2.first != 2
+raise RuntimeError if p2.second != 3
+
+p3 = Pairdd.new(3.5, 2.5)
+p4 = Pairdd.new(p3)
+
+raise RuntimeError if p4.first != 3.5
+raise RuntimeError if p4.second != 2.5
diff --git a/trunk/Examples/test-suite/ruby/template_rename_runme.rb b/trunk/Examples/test-suite/ruby/template_rename_runme.rb
new file mode 100755
index 000000000..18cfd4caa
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/template_rename_runme.rb
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'template_rename'
+
+i = Template_rename::IFoo.new
+d = Template_rename::DFoo.new
+
+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/ruby/template_tbase_template_runme.rb b/trunk/Examples/test-suite/ruby/template_tbase_template_runme.rb
new file mode 100644
index 000000000..43f055532
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/template_tbase_template_runme.rb
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'template_tbase_template'
+
+include Template_tbase_template
+
+a = make_Class_dd()
+raise RuntimeError unless a.test() == "test"
+
diff --git a/trunk/Examples/test-suite/ruby/template_type_namespace_runme.rb b/trunk/Examples/test-suite/ruby/template_type_namespace_runme.rb
new file mode 100644
index 000000000..6db2fc424
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/template_type_namespace_runme.rb
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'template_type_namespace'
+
+include Template_type_namespace
+
+result = foo()
+raise RuntimeError unless result[0].is_a? String
+
diff --git a/trunk/Examples/test-suite/ruby/template_typedef_cplx2_runme.rb b/trunk/Examples/test-suite/ruby/template_typedef_cplx2_runme.rb
new file mode 100644
index 000000000..a6eb04943
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/template_typedef_cplx2_runme.rb
@@ -0,0 +1,81 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'template_typedef_cplx2'
+
+include Template_typedef_cplx2
+
+#
+# double case
+#
+
+
+d = make_Identity_double()
+raise RuntimeError, "#{d} is not an instance" if d.is_a? SWIG::Pointer
+
+classname = d.class.name.split(/::/).last
+unless classname =~ /ArithUnaryFunction/
+ raise RuntimeError, "#{d} is not an ArithUnaryFunction"
+end
+
+e = make_Multiplies_double_double_double_double(d, d)
+raise RuntimeError, "#{e} is not an instance" if e.is_a? SWIG::Pointer
+
+classname = e.class.name.split(/::/).last
+unless classname =~ /ArithUnaryFunction/
+ raise RuntimeError, "#{e} is not an ArithUnaryFunction"
+end
+
+
+#
+# complex case
+#
+
+c = make_Identity_complex()
+raise RuntimeError, "#{c}is not an instance" if c.is_a? SWIG::Pointer
+
+classname = c.class.name.split(/::/).last
+unless classname =~ /ArithUnaryFunction/
+ raise RuntimeError, "#{c} is not an ArithUnaryFunction"
+end
+
+f = make_Multiplies_complex_complex_complex_complex(c, c)
+raise RuntimeError, "{f} is not an instance" if f.is_a? SWIG::Pointer
+
+classname = f.class.name.split(/::/).last
+unless classname =~ /ArithUnaryFunction/
+ raise RuntimeError, "#{f} is not an ArithUnaryFunction"
+end
+
+#
+# Mix case
+#
+
+g = make_Multiplies_double_double_complex_complex(d, c)
+raise RuntimeError, "#{g} is not an instance" if g.is_a? SWIG::Pointer
+
+classname = g.class.name.split(/::/).last
+unless classname =~ /ArithUnaryFunction/
+ raise RuntimeError, "#{g} is not an ArithUnaryFunction"
+end
+
+# This should raise NoMethodError if it fails
+g.get_value()
+
+h = make_Multiplies_complex_complex_double_double(c, d)
+raise RuntimeError, "#{h} is not an instance" if h.is_a? SWIG::Pointer
+
+classname = h.class.name.split(/::/).last
+unless classname =~ /ArithUnaryFunction/
+ raise RuntimeError, "#{h} is not an ArithUnaryFunction"
+end
+
+
diff --git a/trunk/Examples/test-suite/ruby/template_typedef_cplx3_runme.rb b/trunk/Examples/test-suite/ruby/template_typedef_cplx3_runme.rb
new file mode 100644
index 000000000..98a880326
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/template_typedef_cplx3_runme.rb
@@ -0,0 +1,46 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'template_typedef_cplx3'
+
+include Template_typedef_cplx3
+
+#
+# this is OK
+#
+
+
+s = Sin.new
+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.new
+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/ruby/template_typedef_cplx4_runme.rb b/trunk/Examples/test-suite/ruby/template_typedef_cplx4_runme.rb
new file mode 100644
index 000000000..d67e3cd3e
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/template_typedef_cplx4_runme.rb
@@ -0,0 +1,46 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'template_typedef_cplx4'
+
+include Template_typedef_cplx4
+
+#
+# this is OK
+#
+
+
+s = Sin.new
+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.new
+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/ruby/template_typedef_cplx_runme.rb b/trunk/Examples/test-suite/ruby/template_typedef_cplx_runme.rb
new file mode 100644
index 000000000..eac337a2f
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/template_typedef_cplx_runme.rb
@@ -0,0 +1,77 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'template_typedef_cplx'
+
+include Template_typedef_cplx
+
+#
+# double case
+#
+
+
+d = make_Identity_double()
+raise RuntimeError, "#{d} is not an instance" if d.is_a? SWIG::Pointer
+
+classname = d.class.name.split(/::/).last
+unless classname =~ /ArithUnaryFunction/
+ raise RuntimeError, "#{d} is not an ArithUnaryFunction"
+end
+
+e = make_Multiplies_double_double_double_double(d, d)
+raise RuntimeError, "#{e} is not an instance" if e.is_a? SWIG::Pointer
+
+classname = e.class.name.split(/::/).last
+unless classname =~ /ArithUnaryFunction/
+ raise RuntimeError, "#{e} is not an ArithUnaryFunction"
+end
+
+
+#
+# complex case
+#
+
+c = make_Identity_complex()
+raise RuntimeError, "#{c}is not an instance" if c.is_a? SWIG::Pointer
+
+classname = c.class.name.split(/::/).last
+unless classname =~ /ArithUnaryFunction/
+ raise RuntimeError, "#{c} is not an ArithUnaryFunction"
+end
+
+f = make_Multiplies_complex_complex_complex_complex(c, c)
+raise RuntimeError, "{f} is not an instance" if f.is_a? SWIG::Pointer
+
+classname = f.class.name.split(/::/).last
+unless classname =~ /ArithUnaryFunction/
+ raise RuntimeError, "#{f} is not an ArithUnaryFunction"
+end
+
+#
+# Mix case
+#
+
+g = make_Multiplies_double_double_complex_complex(d, c)
+raise RuntimeError, "#{g} is not an instance" if g.is_a? SWIG::Pointer
+
+classname = g.class.name.split(/::/).last
+unless classname =~ /ArithUnaryFunction/
+ raise RuntimeError, "#{g} is not an ArithUnaryFunction"
+end
+
+h = make_Multiplies_complex_complex_double_double(c, d)
+raise RuntimeError, "#{h} is not an instance" if h.is_a? SWIG::Pointer
+
+classname = h.class.name.split(/::/).last
+unless classname =~ /ArithUnaryFunction/
+ raise RuntimeError, "#{h} is not an ArithUnaryFunction"
+end
+
diff --git a/trunk/Examples/test-suite/ruby/throw_exception_runme.rb b/trunk/Examples/test-suite/ruby/throw_exception_runme.rb
new file mode 100644
index 000000000..f21ff9484
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/throw_exception_runme.rb
@@ -0,0 +1,41 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'throw_exception'
+
+include Throw_exception
+
+foo = Foo.new
+
+begin
+ foo.test_int
+rescue => ex
+ raise RuntimeError if ex.message != "37"
+end
+
+begin
+ foo.test_msg
+rescue => ex
+ raise RuntimeError if ex.message != "Dead"
+end
+
+begin
+ foo.test_multi(1)
+rescue => ex
+ raise RuntimeError if ex.message != "37"
+end
+
+begin
+ foo.test_multi(2)
+rescue => ex
+ raise RuntimeError if ex.message != "Dead"
+end
+
diff --git a/trunk/Examples/test-suite/ruby/typedef_inherit_runme.rb b/trunk/Examples/test-suite/ruby/typedef_inherit_runme.rb
new file mode 100755
index 000000000..029b80c70
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/typedef_inherit_runme.rb
@@ -0,0 +1,38 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'typedef_inherit'
+
+a = Typedef_inherit::Foo.new
+b = Typedef_inherit::Bar.new
+
+x = Typedef_inherit.do_blah(a)
+if x != "Foo::blah"
+ puts "Whoa! Bad return #{x}"
+end
+
+x = Typedef_inherit.do_blah(b)
+if x != "Bar::blah"
+ puts "Whoa! Bad return #{x}"
+end
+
+c = Typedef_inherit::Spam.new
+d = Typedef_inherit::Grok.new
+
+x = Typedef_inherit.do_blah2(c)
+if x != "Spam::blah"
+ puts "Whoa! Bad return #{x}"
+end
+
+x = Typedef_inherit.do_blah2(d)
+if x != "Grok::blah"
+ puts "Whoa! Bad return #{x}"
+end
diff --git a/trunk/Examples/test-suite/ruby/typedef_scope_runme.rb b/trunk/Examples/test-suite/ruby/typedef_scope_runme.rb
new file mode 100755
index 000000000..4858a2ef6
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/typedef_scope_runme.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'typedef_scope'
+
+b = Typedef_scope::Bar.new
+
+x = b.test1(42, "hello")
+if x != 42
+ puts "Failed!!"
+end
+
+x = b.test2(42, "hello")
+if x != "hello"
+ puts "Failed!!"
+end
diff --git a/trunk/Examples/test-suite/ruby/typemap_namespace_runme.rb b/trunk/Examples/test-suite/ruby/typemap_namespace_runme.rb
new file mode 100755
index 000000000..09eb57e39
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/typemap_namespace_runme.rb
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'typemap_namespace'
+
+include Typemap_namespace
+
+raise RuntimeError if test1("hello") != "hello"
+
+raise RuntimeError if test2("hello") != "hello"
diff --git a/trunk/Examples/test-suite/ruby/typemap_ns_using_runme.rb b/trunk/Examples/test-suite/ruby/typemap_ns_using_runme.rb
new file mode 100644
index 000000000..80f38c322
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/typemap_ns_using_runme.rb
@@ -0,0 +1,15 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'typemap_ns_using'
+
+raise RuntimeError unless Typemap_ns_using.spam(37) == 37
+
diff --git a/trunk/Examples/test-suite/ruby/typename_runme.rb b/trunk/Examples/test-suite/ruby/typename_runme.rb
new file mode 100755
index 000000000..65de7334d
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/typename_runme.rb
@@ -0,0 +1,25 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'typename'
+
+f = Typename::Foo.new
+b = Typename::Bar.new
+
+x = Typename.twoFoo(f)
+unless x.is_a? Float
+ puts "Wrong return type!"
+end
+
+y = Typename.twoBar(b)
+unless y.is_a? Integer
+ puts "Wrong return type!"
+end
diff --git a/trunk/Examples/test-suite/ruby/unions_runme.rb b/trunk/Examples/test-suite/ruby/unions_runme.rb
new file mode 100644
index 000000000..00a8703f9
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/unions_runme.rb
@@ -0,0 +1,65 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+
+# This is the union runtime testcase. It ensures that values within a
+# union embedded within a struct can be set and read correctly.
+
+require 'unions'
+
+# Create new instances of SmallStruct and BigStruct for later use
+small = Unions::SmallStruct.new()
+small.jill = 200
+
+big = Unions::BigStruct.new()
+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.new()
+
+# 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 , "\n"
+ exit 1
+end
+
+Num1 = eut.number
+if (Num1 != 1)
+ print "Runtime test2 failed. eut.number=" , Num1 , "\n"
+ exit 1
+end
+
+# 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 , "\n"
+ exit 1
+end
+
+Jill2 = eut.uni.big.smallstruct.jill
+if (Jill2 != 200)
+ print "Runtime test4 failed. eut.uni.big.smallstruct.jill=" , Jill2 , "\n"
+ exit 1
+end
+
+Num2 = eut.number
+if (Num2 != 2)
+ print "Runtime test5 failed. eut.number=" , Num2 , "\n"
+ exit 1
+end
+
diff --git a/trunk/Examples/test-suite/ruby/using1_runme.rb b/trunk/Examples/test-suite/ruby/using1_runme.rb
new file mode 100644
index 000000000..44fcf129b
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/using1_runme.rb
@@ -0,0 +1,15 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'using1'
+
+raise RuntimeError unless Using1.spam(37) == 37
+
diff --git a/trunk/Examples/test-suite/ruby/using2_runme.rb b/trunk/Examples/test-suite/ruby/using2_runme.rb
new file mode 100644
index 000000000..1eb72c16f
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/using2_runme.rb
@@ -0,0 +1,15 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'using2'
+
+raise RuntimeError unless Using2.spam(37) == 37
+
diff --git a/trunk/Examples/test-suite/ruby/using_composition_runme.rb b/trunk/Examples/test-suite/ruby/using_composition_runme.rb
new file mode 100644
index 000000000..b9500cb27
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/using_composition_runme.rb
@@ -0,0 +1,56 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'using_composition'
+
+include Using_composition
+
+f = FooBar.new
+if f.blah(3) != 3
+ raise RuntimeError,"FooBar::blah(int)"
+end
+
+if f.blah(3.5) != 3.5
+ raise RuntimeError,"FooBar::blah(double)"
+end
+
+if f.blah("hello") != "hello"
+ raise RuntimeError,"FooBar::blah(char *)"
+end
+
+
+f = FooBar2.new
+if f.blah(3) != 3
+ raise RuntimeError,"FooBar2::blah(int)"
+end
+
+if f.blah(3.5) != 3.5
+ raise RuntimeError,"FooBar2::blah(double)"
+end
+
+if f.blah("hello") != "hello"
+ raise RuntimeError,"FooBar2::blah(char *)"
+end
+
+
+f = FooBar3.new
+if f.blah(3) != 3
+ raise RuntimeError,"FooBar3::blah(int)"
+end
+
+if f.blah(3.5) != 3.5
+ raise RuntimeError,"FooBar3::blah(double)"
+end
+
+if f.blah("hello") != "hello"
+ raise RuntimeError,"FooBar3::blah(char *)"
+end
+
diff --git a/trunk/Examples/test-suite/ruby/using_extend_runme.rb b/trunk/Examples/test-suite/ruby/using_extend_runme.rb
new file mode 100644
index 000000000..4caaa5bb6
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/using_extend_runme.rb
@@ -0,0 +1,36 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'using_extend'
+
+include Using_extend
+
+f = FooBar.new
+if f.blah(3) != 3
+ raise RuntimeError,"blah(int)"
+end
+
+if f.blah(3.5) != 3.5
+ raise RuntimeError,"blah(double)"
+end
+
+if f.blah("hello") != "hello"
+ raise RuntimeError,"blah(char *)"
+end
+
+if f.blah(3,4) != 7
+ raise RuntimeError,"blah(int,int)"
+end
+
+if f.blah(3.5,7.5) != (3.5+7.5)
+ raise RuntimeError,"blah(double,double)"
+end
+
diff --git a/trunk/Examples/test-suite/ruby/using_inherit_runme.rb b/trunk/Examples/test-suite/ruby/using_inherit_runme.rb
new file mode 100644
index 000000000..1b7e4043a
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/using_inherit_runme.rb
@@ -0,0 +1,74 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'using_inherit'
+
+include Using_inherit
+
+b = Bar.new
+if b.test(3) != 3
+ raise RuntimeError,"Bar::test(int)"
+end
+
+if b.test(3.5) != 3.5
+ raise RuntimeError, "Bar::test(double)"
+end
+
+b = Bar2.new
+if b.test(3) != 6
+ raise RuntimeError,"Bar2::test(int)"
+end
+
+if b.test(3.5) != 7.0
+ raise RuntimeError, "Bar2::test(double)"
+end
+
+
+b = Bar3.new
+if b.test(3) != 6
+ raise RuntimeError,"Bar3::test(int)"
+end
+
+if b.test(3.5) != 7.0
+ raise RuntimeError, "Bar3::test(double)"
+end
+
+
+b = Bar4.new
+if b.test(3) != 6
+ raise RuntimeError,"Bar4::test(int)"
+end
+
+if b.test(3.5) != 7.0
+ raise RuntimeError, "Bar4::test(double)"
+end
+
+
+b = Fred1.new
+if b.test(3) != 3
+ raise RuntimeError,"Fred1::test(int)"
+end
+
+if b.test(3.5) != 7.0
+ raise RuntimeError, "Fred1::test(double)"
+end
+
+
+b = Fred2.new
+if b.test(3) != 3
+ raise RuntimeError,"Fred2::test(int)"
+end
+
+if b.test(3.5) != 7.0
+ raise RuntimeError, "Fred2::test(double)"
+end
+
+
diff --git a/trunk/Examples/test-suite/ruby/using_private_runme.rb b/trunk/Examples/test-suite/ruby/using_private_runme.rb
new file mode 100644
index 000000000..cf6928ce8
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/using_private_runme.rb
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'using_private'
+
+include Using_private
+
+f = FooBar.new
+f.x = 3
+
+if f.blah(4) != 4
+ raise RuntimeError, "blah(int)"
+end
+
+if f.defaulted() != -1
+ raise RuntimeError, "defaulted()"
+end
+
+if f.defaulted(222) != 222
+ raise RuntimeError, "defaulted(hi)"
+end
+
diff --git a/trunk/Examples/test-suite/ruby/using_protected_runme.rb b/trunk/Examples/test-suite/ruby/using_protected_runme.rb
new file mode 100644
index 000000000..3b4f88b55
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/using_protected_runme.rb
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'using_protected'
+
+include Using_protected
+
+f = FooBar.new
+f.x = 3
+
+if f.blah(4) != 4
+ raise RuntimeError, "blah(int)"
+end
+
diff --git a/trunk/Examples/test-suite/ruby/varargs_runme.rb b/trunk/Examples/test-suite/ruby/varargs_runme.rb
new file mode 100644
index 000000000..9825c2511
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/varargs_runme.rb
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'varargs'
+
+if Varargs.test("Hello") != "Hello"
+ raise RuntimeError, "Failed"
+end
+
+f = Varargs::Foo.new("Greetings")
+if f.str != "Greetings"
+ raise RuntimeError, "Failed"
+end
+
+if f.test("Hello") != "Hello"
+ raise RuntimeError, "Failed"
+end
+
diff --git a/trunk/Examples/test-suite/ruby/virtual_derivation_runme.rb b/trunk/Examples/test-suite/ruby/virtual_derivation_runme.rb
new file mode 100644
index 000000000..a739ddfe2
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/virtual_derivation_runme.rb
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'virtual_derivation'
+
+b = Virtual_derivation::B.new 3
+
+if b.get_a() != b.get_b()
+ print "something is still wrong ", b.get_a(), b.get_b(), "\n"
+end
diff --git a/trunk/Examples/test-suite/ruby/virtual_poly_runme.rb b/trunk/Examples/test-suite/ruby/virtual_poly_runme.rb
new file mode 100644
index 000000000..38752cc3f
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/virtual_poly_runme.rb
@@ -0,0 +1,33 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'virtual_poly'
+
+d = Virtual_poly::NDouble.new(3.5)
+i = Virtual_poly::NInt.new(2)
+
+#
+# polymorphic return type working
+#
+dc = d.copy
+ic = i.copy
+
+raise RuntimeError if d.get != dc.get
+raise RuntimeError if i.get != ic.get
+
+#
+# 'narrowing' working ('nnumber' returns a NNumber)
+#
+ddc = Virtual_poly::NDouble.narrow(dc.nnumber)
+raise RuntimeError if d.get != ddc.get
+
+dic = Virtual_poly::NInt.narrow(ic.nnumber)
+raise RuntimeError if i.get != dic.get
diff --git a/trunk/Examples/test-suite/ruby/voidtest_runme.rb b/trunk/Examples/test-suite/ruby/voidtest_runme.rb
new file mode 100644
index 000000000..33cffe6f7
--- /dev/null
+++ b/trunk/Examples/test-suite/ruby/voidtest_runme.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'voidtest'
+
+Voidtest.globalfunc()
+f = Voidtest::Foo.new
+f.memberfunc()
+
+Voidtest::Foo.staticmemberfunc()
+
+v1 = Voidtest::vfunc1(f)
+v3 = Voidtest::vfunc3(v1)
+
+v3.memberfunc()
+