PageRenderTime 19ms CodeModel.GetById 13ms app.highlight 5ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-26/SWIG/Examples/test-suite/ruby/template_typedef_cplx2_runme.rb

#
Ruby | 70 lines | 39 code | 21 blank | 10 comment | 1 complexity | 249c08a67e95ecfba551c996603cc24a MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
 1require 'template_typedef_cplx2'
 2
 3include Template_typedef_cplx2
 4
 5#
 6# double case
 7#
 8
 9
10d = make_Identity_double()
11raise RuntimeError, "#{d} is not an instance" if d.is_a? SWIG::Pointer
12
13classname = d.class.name.split(/::/).last
14unless classname =~ /ArithUnaryFunction/
15  raise RuntimeError, "#{d} is not an ArithUnaryFunction"
16end
17
18e = make_Multiplies_double_double_double_double(d, d)
19raise RuntimeError, "#{e} is not an instance" if e.is_a? SWIG::Pointer
20
21classname = e.class.name.split(/::/).last
22unless classname =~ /ArithUnaryFunction/
23  raise RuntimeError, "#{e} is not an ArithUnaryFunction"
24end
25
26
27#
28# complex case
29#
30
31c = make_Identity_complex()
32raise RuntimeError, "#{c}is not an instance" if c.is_a? SWIG::Pointer
33
34classname = c.class.name.split(/::/).last
35unless classname =~ /ArithUnaryFunction/
36  raise RuntimeError, "#{c} is not an ArithUnaryFunction"
37end
38
39f = make_Multiplies_complex_complex_complex_complex(c, c)
40raise RuntimeError, "{f} is not an instance" if f.is_a? SWIG::Pointer
41
42classname = f.class.name.split(/::/).last
43unless classname =~ /ArithUnaryFunction/
44  raise RuntimeError, "#{f} is not an ArithUnaryFunction"
45end
46
47#
48# Mix case
49#
50
51g = make_Multiplies_double_double_complex_complex(d, c)
52raise RuntimeError, "#{g} is not an instance" if g.is_a? SWIG::Pointer
53
54classname = g.class.name.split(/::/).last
55unless classname =~ /ArithUnaryFunction/
56  raise RuntimeError, "#{g} is not an ArithUnaryFunction"
57end
58
59# This should raise NoMethodError if it fails
60g.get_value()
61  
62h = make_Multiplies_complex_complex_double_double(c, d)
63raise RuntimeError, "#{h} is not an instance" if h.is_a? SWIG::Pointer
64
65classname = h.class.name.split(/::/).last
66unless classname =~ /ArithUnaryFunction/
67  raise RuntimeError, "#{h} is not an ArithUnaryFunction"
68end
69
70