aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/ruby')
-rw-r--r--Examples/test-suite/ruby/.cvsignore3
-rw-r--r--Examples/test-suite/ruby/Makefile41
-rw-r--r--Examples/test-suite/ruby/README4
-rwxr-xr-xExamples/test-suite/ruby/class_ignore_runme.rb10
-rwxr-xr-xExamples/test-suite/ruby/constover_runme.rb44
-rwxr-xr-xExamples/test-suite/ruby/cpp_namespace_runme.rb51
-rwxr-xr-xExamples/test-suite/ruby/default_constructor_runme.rb94
-rwxr-xr-xExamples/test-suite/ruby/dynamic_cast_runme.rb13
-rwxr-xr-xExamples/test-suite/ruby/enum_runme.rb6
-rw-r--r--Examples/test-suite/ruby/extend_template_ns_runme.rb12
-rw-r--r--Examples/test-suite/ruby/extend_template_runme.rb10
-rw-r--r--Examples/test-suite/ruby/grouping_runme.rb15
-rwxr-xr-xExamples/test-suite/ruby/imports_runme.rb9
-rw-r--r--Examples/test-suite/ruby/inherit_missing_runme.rb20
-rwxr-xr-xExamples/test-suite/ruby/lib_std_vector_runme.rb17
-rwxr-xr-xExamples/test-suite/ruby/namespace_typemap_runme.rb33
-rw-r--r--Examples/test-suite/ruby/newobject1_runme.rb15
-rw-r--r--Examples/test-suite/ruby/newobject2_runme.rb15
-rwxr-xr-xExamples/test-suite/ruby/overload_copy_runme.rb6
-rwxr-xr-xExamples/test-suite/ruby/overload_extend_runme.rb8
-rwxr-xr-xExamples/test-suite/ruby/overload_extendc_runme.rb7
-rwxr-xr-xExamples/test-suite/ruby/overload_simple_runme.rb119
-rw-r--r--Examples/test-suite/ruby/overload_subtype_runme.rb15
-rwxr-xr-xExamples/test-suite/ruby/overload_template_runme.rb6
-rwxr-xr-xExamples/test-suite/ruby/primitive_ref_runme.rb27
-rw-r--r--Examples/test-suite/ruby/rename_scope_runme.rb10
-rw-r--r--Examples/test-suite/ruby/smart_pointer_const_runme.rb13
-rw-r--r--Examples/test-suite/ruby/smart_pointer_multi_runme.rb15
-rw-r--r--Examples/test-suite/ruby/smart_pointer_multi_typedef_runme.rb14
-rw-r--r--Examples/test-suite/ruby/smart_pointer_not_runme.rb44
-rw-r--r--Examples/test-suite/ruby/smart_pointer_overload_runme.rb16
-rw-r--r--Examples/test-suite/ruby/smart_pointer_rename_runme.rb12
-rw-r--r--Examples/test-suite/ruby/smart_pointer_simple_runme.rb13
-rw-r--r--Examples/test-suite/ruby/smart_pointer_typedef_runme.rb13
-rwxr-xr-xExamples/test-suite/ruby/sneaky1_runme.rb6
-rwxr-xr-xExamples/test-suite/ruby/template_inherit_runme.rb40
-rwxr-xr-xExamples/test-suite/ruby/template_ns4_runme.rb4
-rwxr-xr-xExamples/test-suite/ruby/template_ns_runme.rb15
-rwxr-xr-xExamples/test-suite/ruby/template_rename_runme.rb12
-rwxr-xr-xExamples/test-suite/ruby/typedef_inherit_runme.rb27
-rwxr-xr-xExamples/test-suite/ruby/typedef_scope_runme.rb13
-rwxr-xr-xExamples/test-suite/ruby/typemap_namespace_runme.rb7
-rwxr-xr-xExamples/test-suite/ruby/typename_runme.rb14
-rw-r--r--Examples/test-suite/ruby/unions_runme.rb54
44 files changed, 942 insertions, 0 deletions
diff --git a/Examples/test-suite/ruby/.cvsignore b/Examples/test-suite/ruby/.cvsignore
new file mode 100644
index 000000000..09e0b6c2e
--- /dev/null
+++ b/Examples/test-suite/ruby/.cvsignore
@@ -0,0 +1,3 @@
+*wrap*
+*.so
+*.dll
diff --git a/Examples/test-suite/ruby/Makefile b/Examples/test-suite/ruby/Makefile
new file mode 100644
index 000000000..eec1f10a4
--- /dev/null
+++ b/Examples/test-suite/ruby/Makefile
@@ -0,0 +1,41 @@
+#######################################################################
+# $Header$
+# Makefile for ruby test-suite
+#######################################################################
+
+LANGUAGE = ruby
+SCRIPTSUFFIX = _runme.rb
+
+include ../common.mk
+
+# Overridden variables here
+
+# 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 $*\_runme.rb ]; then ( \
+ ruby $*\_runme.rb;) \
+ fi;
+
+# Clean
+%.clean:
+
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile ruby_clean
diff --git a/Examples/test-suite/ruby/README b/Examples/test-suite/ruby/README
new file mode 100644
index 000000000..c4ace93e6
--- /dev/null
+++ b/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/Examples/test-suite/ruby/class_ignore_runme.rb b/Examples/test-suite/ruby/class_ignore_runme.rb
new file mode 100755
index 000000000..0b47a7fad
--- /dev/null
+++ b/Examples/test-suite/ruby/class_ignore_runme.rb
@@ -0,0 +1,10 @@
+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/Examples/test-suite/ruby/constover_runme.rb b/Examples/test-suite/ruby/constover_runme.rb
new file mode 100755
index 000000000..04d516b75
--- /dev/null
+++ b/Examples/test-suite/ruby/constover_runme.rb
@@ -0,0 +1,44 @@
+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/Examples/test-suite/ruby/cpp_namespace_runme.rb b/Examples/test-suite/ruby/cpp_namespace_runme.rb
new file mode 100755
index 000000000..db44b45f0
--- /dev/null
+++ b/Examples/test-suite/ruby/cpp_namespace_runme.rb
@@ -0,0 +1,51 @@
+# 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/Examples/test-suite/ruby/default_constructor_runme.rb b/Examples/test-suite/ruby/default_constructor_runme.rb
new file mode 100755
index 000000000..fc1f42937
--- /dev/null
+++ b/Examples/test-suite/ruby/default_constructor_runme.rb
@@ -0,0 +1,94 @@
+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
+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
+end
+
+# C's constructor is protected, so this should raise an exception
+begin
+ c = C.new
+ print "Whoa. new C created."
+rescue NoConstructorError
+ # 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
+end
+
+# DD shouldn't get a default constructor, so this should fail
+begin
+ dd = DD.new
+ puts "Whoa. new DD created"
+rescue NoConstructorError
+ # 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
+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
+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/Examples/test-suite/ruby/dynamic_cast_runme.rb b/Examples/test-suite/ruby/dynamic_cast_runme.rb
new file mode 100755
index 000000000..a7f327bb6
--- /dev/null
+++ b/Examples/test-suite/ruby/dynamic_cast_runme.rb
@@ -0,0 +1,13 @@
+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/Examples/test-suite/ruby/enum_runme.rb b/Examples/test-suite/ruby/enum_runme.rb
new file mode 100755
index 000000000..9ea9a29e2
--- /dev/null
+++ b/Examples/test-suite/ruby/enum_runme.rb
@@ -0,0 +1,6 @@
+require 'enum'
+
+Enum.bar2(1)
+Enum.bar3(1)
+Enum.bar1(1)
+
diff --git a/Examples/test-suite/ruby/extend_template_ns_runme.rb b/Examples/test-suite/ruby/extend_template_ns_runme.rb
new file mode 100644
index 000000000..a30959bb2
--- /dev/null
+++ b/Examples/test-suite/ruby/extend_template_ns_runme.rb
@@ -0,0 +1,12 @@
+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/Examples/test-suite/ruby/extend_template_runme.rb b/Examples/test-suite/ruby/extend_template_runme.rb
new file mode 100644
index 000000000..8787de7dc
--- /dev/null
+++ b/Examples/test-suite/ruby/extend_template_runme.rb
@@ -0,0 +1,10 @@
+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/Examples/test-suite/ruby/grouping_runme.rb b/Examples/test-suite/ruby/grouping_runme.rb
new file mode 100644
index 000000000..13cf48943
--- /dev/null
+++ b/Examples/test-suite/ruby/grouping_runme.rb
@@ -0,0 +1,15 @@
+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/Examples/test-suite/ruby/imports_runme.rb b/Examples/test-suite/ruby/imports_runme.rb
new file mode 100755
index 000000000..0290bbad2
--- /dev/null
+++ b/Examples/test-suite/ruby/imports_runme.rb
@@ -0,0 +1,9 @@
+# This is the import runtime testcase.
+
+require 'imports_a'
+require 'imports_b'
+
+x = Imports_b::B.new
+
+x.hello
+
diff --git a/Examples/test-suite/ruby/inherit_missing_runme.rb b/Examples/test-suite/ruby/inherit_missing_runme.rb
new file mode 100644
index 000000000..476ef0f7c
--- /dev/null
+++ b/Examples/test-suite/ruby/inherit_missing_runme.rb
@@ -0,0 +1,20 @@
+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/Examples/test-suite/ruby/lib_std_vector_runme.rb b/Examples/test-suite/ruby/lib_std_vector_runme.rb
new file mode 100755
index 000000000..587495f8d
--- /dev/null
+++ b/Examples/test-suite/ruby/lib_std_vector_runme.rb
@@ -0,0 +1,17 @@
+require 'lib_std_vector'
+
+include Lib_std_vector
+
+iv = IntVector.new(4)
+0.upto(3) { |i| iv[i] = i }
+
+x = average(iv)
+y = average([1, 2, 3, 4])
+
+a = half([10, 10.5, 11, 11.5])
+
+dv = DoubleVector.new(10)
+0.upto(9) { |i| dv[i] = i/2.0 }
+
+halve_in_place(dv)
+
diff --git a/Examples/test-suite/ruby/namespace_typemap_runme.rb b/Examples/test-suite/ruby/namespace_typemap_runme.rb
new file mode 100755
index 000000000..6416d615a
--- /dev/null
+++ b/Examples/test-suite/ruby/namespace_typemap_runme.rb
@@ -0,0 +1,33 @@
+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/Examples/test-suite/ruby/newobject1_runme.rb b/Examples/test-suite/ruby/newobject1_runme.rb
new file mode 100644
index 000000000..35f77faa2
--- /dev/null
+++ b/Examples/test-suite/ruby/newobject1_runme.rb
@@ -0,0 +1,15 @@
+require 'newobject1'
+
+include Newobject1
+
+foo1 = Foo.makeFoo
+raise RuntimeError if Foo.fooCount != 1
+
+foo2 = foo1.makeMore
+raise RuntimeError if Foo.fooCount != 2
+
+foo1 = nil ; GC.start
+raise RuntimeError if Foo.fooCount != 1
+
+foo2 = nil ; GC.start
+raise RuntimeError if Foo.fooCount != 0
diff --git a/Examples/test-suite/ruby/newobject2_runme.rb b/Examples/test-suite/ruby/newobject2_runme.rb
new file mode 100644
index 000000000..4519b123e
--- /dev/null
+++ b/Examples/test-suite/ruby/newobject2_runme.rb
@@ -0,0 +1,15 @@
+require 'newobject2'
+
+include Newobject2
+
+foo1 = makeFoo
+raise RuntimeError if fooCount != 1
+
+foo2 = makeFoo
+raise RuntimeError if fooCount != 2
+
+foo1 = nil ; GC.start
+raise RuntimeError if fooCount != 1
+
+foo2 = nil ; GC.start
+raise RuntimeError if fooCount != 0
diff --git a/Examples/test-suite/ruby/overload_copy_runme.rb b/Examples/test-suite/ruby/overload_copy_runme.rb
new file mode 100755
index 000000000..2c555a62b
--- /dev/null
+++ b/Examples/test-suite/ruby/overload_copy_runme.rb
@@ -0,0 +1,6 @@
+require 'overload_copy'
+
+include Overload_copy
+
+f = Foo.new
+g = Foo.new(f)
diff --git a/Examples/test-suite/ruby/overload_extend_runme.rb b/Examples/test-suite/ruby/overload_extend_runme.rb
new file mode 100755
index 000000000..2d252a62a
--- /dev/null
+++ b/Examples/test-suite/ruby/overload_extend_runme.rb
@@ -0,0 +1,8 @@
+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) != 3
+
diff --git a/Examples/test-suite/ruby/overload_extendc_runme.rb b/Examples/test-suite/ruby/overload_extendc_runme.rb
new file mode 100755
index 000000000..354062a5d
--- /dev/null
+++ b/Examples/test-suite/ruby/overload_extendc_runme.rb
@@ -0,0 +1,7 @@
+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) != 3
diff --git a/Examples/test-suite/ruby/overload_simple_runme.rb b/Examples/test-suite/ruby/overload_simple_runme.rb
new file mode 100755
index 000000000..3fd292a76
--- /dev/null
+++ b/Examples/test-suite/ruby/overload_simple_runme.rb
@@ -0,0 +1,119 @@
+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/Examples/test-suite/ruby/overload_subtype_runme.rb b/Examples/test-suite/ruby/overload_subtype_runme.rb
new file mode 100644
index 000000000..9737c851c
--- /dev/null
+++ b/Examples/test-suite/ruby/overload_subtype_runme.rb
@@ -0,0 +1,15 @@
+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/Examples/test-suite/ruby/overload_template_runme.rb b/Examples/test-suite/ruby/overload_template_runme.rb
new file mode 100755
index 000000000..d01887bf4
--- /dev/null
+++ b/Examples/test-suite/ruby/overload_template_runme.rb
@@ -0,0 +1,6 @@
+require 'overload_template'
+
+f = Overload_template.foo()
+
+a = Overload_template.max(3,4)
+b = Overload_template.max(3.4,5.2)
diff --git a/Examples/test-suite/ruby/primitive_ref_runme.rb b/Examples/test-suite/ruby/primitive_ref_runme.rb
new file mode 100755
index 000000000..11bf37439
--- /dev/null
+++ b/Examples/test-suite/ruby/primitive_ref_runme.rb
@@ -0,0 +1,27 @@
+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/Examples/test-suite/ruby/rename_scope_runme.rb b/Examples/test-suite/ruby/rename_scope_runme.rb
new file mode 100644
index 000000000..ea4fa94a6
--- /dev/null
+++ b/Examples/test-suite/ruby/rename_scope_runme.rb
@@ -0,0 +1,10 @@
+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/Examples/test-suite/ruby/smart_pointer_const_runme.rb b/Examples/test-suite/ruby/smart_pointer_const_runme.rb
new file mode 100644
index 000000000..cb852cfe0
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_const_runme.rb
@@ -0,0 +1,13 @@
+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/Examples/test-suite/ruby/smart_pointer_multi_runme.rb b/Examples/test-suite/ruby/smart_pointer_multi_runme.rb
new file mode 100644
index 000000000..96b937a85
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_multi_runme.rb
@@ -0,0 +1,15 @@
+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/Examples/test-suite/ruby/smart_pointer_multi_typedef_runme.rb b/Examples/test-suite/ruby/smart_pointer_multi_typedef_runme.rb
new file mode 100644
index 000000000..52ddb44f4
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_multi_typedef_runme.rb
@@ -0,0 +1,14 @@
+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/Examples/test-suite/ruby/smart_pointer_not_runme.rb b/Examples/test-suite/ruby/smart_pointer_not_runme.rb
new file mode 100644
index 000000000..fcc306115
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_not_runme.rb
@@ -0,0 +1,44 @@
+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/Examples/test-suite/ruby/smart_pointer_overload_runme.rb b/Examples/test-suite/ruby/smart_pointer_overload_runme.rb
new file mode 100644
index 000000000..c32991331
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_overload_runme.rb
@@ -0,0 +1,16 @@
+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/Examples/test-suite/ruby/smart_pointer_rename_runme.rb b/Examples/test-suite/ruby/smart_pointer_rename_runme.rb
new file mode 100644
index 000000000..0ff378a4c
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_rename_runme.rb
@@ -0,0 +1,12 @@
+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/Examples/test-suite/ruby/smart_pointer_simple_runme.rb b/Examples/test-suite/ruby/smart_pointer_simple_runme.rb
new file mode 100644
index 000000000..b2a54b819
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_simple_runme.rb
@@ -0,0 +1,13 @@
+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/Examples/test-suite/ruby/smart_pointer_typedef_runme.rb b/Examples/test-suite/ruby/smart_pointer_typedef_runme.rb
new file mode 100644
index 000000000..137723078
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_typedef_runme.rb
@@ -0,0 +1,13 @@
+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/Examples/test-suite/ruby/sneaky1_runme.rb b/Examples/test-suite/ruby/sneaky1_runme.rb
new file mode 100755
index 000000000..731e27b97
--- /dev/null
+++ b/Examples/test-suite/ruby/sneaky1_runme.rb
@@ -0,0 +1,6 @@
+require 'sneaky1'
+
+x = Sneaky1.add(3, 4)
+y = Sneaky1.sub(3, 4)
+z = Sneaky1.mul(3, 4)
+w = Sneaky1.divide(3, 4)
diff --git a/Examples/test-suite/ruby/template_inherit_runme.rb b/Examples/test-suite/ruby/template_inherit_runme.rb
new file mode 100755
index 000000000..e2c947495
--- /dev/null
+++ b/Examples/test-suite/ruby/template_inherit_runme.rb
@@ -0,0 +1,40 @@
+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/Examples/test-suite/ruby/template_ns4_runme.rb b/Examples/test-suite/ruby/template_ns4_runme.rb
new file mode 100755
index 000000000..5c55ff94f
--- /dev/null
+++ b/Examples/test-suite/ruby/template_ns4_runme.rb
@@ -0,0 +1,4 @@
+require 'template_ns4'
+
+d = Template_ns4.make_Class_DD()
+raise RuntimeError if d.test() != "test"
diff --git a/Examples/test-suite/ruby/template_ns_runme.rb b/Examples/test-suite/ruby/template_ns_runme.rb
new file mode 100755
index 000000000..d69e8e3d4
--- /dev/null
+++ b/Examples/test-suite/ruby/template_ns_runme.rb
@@ -0,0 +1,15 @@
+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/Examples/test-suite/ruby/template_rename_runme.rb b/Examples/test-suite/ruby/template_rename_runme.rb
new file mode 100755
index 000000000..04be6c94d
--- /dev/null
+++ b/Examples/test-suite/ruby/template_rename_runme.rb
@@ -0,0 +1,12 @@
+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.grok_test(6)
+
+x = d.blah_test(7)
+y = d.spam(8)
+z = d.grok_test(9)
diff --git a/Examples/test-suite/ruby/typedef_inherit_runme.rb b/Examples/test-suite/ruby/typedef_inherit_runme.rb
new file mode 100755
index 000000000..591b9efdb
--- /dev/null
+++ b/Examples/test-suite/ruby/typedef_inherit_runme.rb
@@ -0,0 +1,27 @@
+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/Examples/test-suite/ruby/typedef_scope_runme.rb b/Examples/test-suite/ruby/typedef_scope_runme.rb
new file mode 100755
index 000000000..db7a9f2c9
--- /dev/null
+++ b/Examples/test-suite/ruby/typedef_scope_runme.rb
@@ -0,0 +1,13 @@
+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/Examples/test-suite/ruby/typemap_namespace_runme.rb b/Examples/test-suite/ruby/typemap_namespace_runme.rb
new file mode 100755
index 000000000..57986348d
--- /dev/null
+++ b/Examples/test-suite/ruby/typemap_namespace_runme.rb
@@ -0,0 +1,7 @@
+require 'typemap_namespace'
+
+include Typemap_namespace
+
+raise RuntimeError if test1("hello") != "hello"
+
+raise RuntimeError if test2("hello") != "hello"
diff --git a/Examples/test-suite/ruby/typename_runme.rb b/Examples/test-suite/ruby/typename_runme.rb
new file mode 100755
index 000000000..689499f12
--- /dev/null
+++ b/Examples/test-suite/ruby/typename_runme.rb
@@ -0,0 +1,14 @@
+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/Examples/test-suite/ruby/unions_runme.rb b/Examples/test-suite/ruby/unions_runme.rb
new file mode 100644
index 000000000..17344f7e5
--- /dev/null
+++ b/Examples/test-suite/ruby/unions_runme.rb
@@ -0,0 +1,54 @@
+
+# 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
+