PageRenderTime 25ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
Ruby | 54 lines | 31 code | 15 blank | 8 comment | 6 complexity | 713b16b5a958ed8102402992c4e5fb62 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. #!/usr/bin/env ruby
  2. #
  3. # Put description here
  4. #
  5. #
  6. #
  7. #
  8. #
  9. require 'swig_assert'
  10. require 'director_detect'
  11. class MyBar < Director_detect::Bar
  12. def initialize(v)
  13. @val = v
  14. end
  15. def get_value
  16. @val = @val + 1
  17. end
  18. def get_class
  19. @val = @val + 1
  20. Director_detect::A
  21. end
  22. def just_do_it
  23. @val = @val + 1
  24. end
  25. def clone
  26. MyBar.new(@val)
  27. end
  28. def val
  29. @val
  30. end
  31. end
  32. b = MyBar.new(2)
  33. f = b
  34. v = f.get_value
  35. a = f.get_class
  36. f.just_do_it
  37. c = b.clone
  38. vc = c.get_value
  39. raise RuntimeError if (v != 3) || (b.val != 5) || (vc != 6)