PageRenderTime 24ms CodeModel.GetById 14ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/ruby/cpp_namespace_runme.rb

#
Ruby | 62 lines | 39 code | 14 blank | 9 comment | 20 complexity | fc83da01607e4208ec3d3c916bdaed8a MD5 | raw file
 1#!/usr/bin/env ruby
 2#
 3# Put description here
 4#
 5# 
 6# 
 7# 
 8#
 9
10require 'swig_assert'
11
12# Note: This example assumes that namespaces are flattened
13require 'cpp_namespace'
14
15n = Cpp_namespace.fact(4)
16if n != 24
17  raise "Bad return value!"
18end
19
20if Cpp_namespace.Foo != 42
21  raise "Bad variable value!"
22end
23
24t = Cpp_namespace::Test.new
25if t.method() != "Test::method"
26  raise "Bad method return value!"
27end
28
29if Cpp_namespace.do_method(t) != "Test::method"
30  raise "Bad return value!"
31end
32
33if Cpp_namespace.do_method2(t) != "Test::method"
34  raise "Bad return value!"
35end
36    
37Cpp_namespace.weird("hello", 4)
38
39t2 = Cpp_namespace::Test2.new
40t3 = Cpp_namespace::Test3.new
41t4 = Cpp_namespace::Test4.new
42t5 = Cpp_namespace::Test5.new
43
44if Cpp_namespace.foo3(42) != 42
45  raise "Bad return value!"
46end
47
48if Cpp_namespace.do_method3(t2, 40) != "Test2::method"
49  raise "Bad return value!"
50end
51
52if Cpp_namespace.do_method3(t3, 40) != "Test3::method"
53  raise "Bad return value!"
54end
55
56if Cpp_namespace.do_method3(t4, 40) != "Test4::method"
57  raise "Bad return value!"
58end
59
60if Cpp_namespace.do_method3(t5, 40) != "Test5::method"
61  raise "Bad return value!"
62end