PageRenderTime 25ms CodeModel.GetById 0ms 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
  1. require 'template_typedef_cplx2'
  2. include Template_typedef_cplx2
  3. #
  4. # double case
  5. #
  6. d = make_Identity_double()
  7. raise RuntimeError, "#{d} is not an instance" if d.is_a? SWIG::Pointer
  8. classname = d.class.name.split(/::/).last
  9. unless classname =~ /ArithUnaryFunction/
  10. raise RuntimeError, "#{d} is not an ArithUnaryFunction"
  11. end
  12. e = make_Multiplies_double_double_double_double(d, d)
  13. raise RuntimeError, "#{e} is not an instance" if e.is_a? SWIG::Pointer
  14. classname = e.class.name.split(/::/).last
  15. unless classname =~ /ArithUnaryFunction/
  16. raise RuntimeError, "#{e} is not an ArithUnaryFunction"
  17. end
  18. #
  19. # complex case
  20. #
  21. c = make_Identity_complex()
  22. raise RuntimeError, "#{c}is not an instance" if c.is_a? SWIG::Pointer
  23. classname = c.class.name.split(/::/).last
  24. unless classname =~ /ArithUnaryFunction/
  25. raise RuntimeError, "#{c} is not an ArithUnaryFunction"
  26. end
  27. f = make_Multiplies_complex_complex_complex_complex(c, c)
  28. raise RuntimeError, "{f} is not an instance" if f.is_a? SWIG::Pointer
  29. classname = f.class.name.split(/::/).last
  30. unless classname =~ /ArithUnaryFunction/
  31. raise RuntimeError, "#{f} is not an ArithUnaryFunction"
  32. end
  33. #
  34. # Mix case
  35. #
  36. g = make_Multiplies_double_double_complex_complex(d, c)
  37. raise RuntimeError, "#{g} is not an instance" if g.is_a? SWIG::Pointer
  38. classname = g.class.name.split(/::/).last
  39. unless classname =~ /ArithUnaryFunction/
  40. raise RuntimeError, "#{g} is not an ArithUnaryFunction"
  41. end
  42. # This should raise NoMethodError if it fails
  43. g.get_value()
  44. h = make_Multiplies_complex_complex_double_double(c, d)
  45. raise RuntimeError, "#{h} is not an instance" if h.is_a? SWIG::Pointer
  46. classname = h.class.name.split(/::/).last
  47. unless classname =~ /ArithUnaryFunction/
  48. raise RuntimeError, "#{h} is not an ArithUnaryFunction"
  49. end