PageRenderTime 959ms CodeModel.GetById 30ms RepoModel.GetById 3ms app.codeStats 0ms

/tags/rel-1-3-25/SWIG/Examples/test-suite/python/template_typedef_cplx2_runme.py

#
Python | 95 lines | 67 code | 19 blank | 9 comment | 13 complexity | 49e4dce72e8b6254cf821a35e77f1c68 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. import string
  2. from template_typedef_cplx2 import *
  3. #
  4. # double case
  5. #
  6. try:
  7. d = make_Identity_double()
  8. a = d.this
  9. except:
  10. print d, "is not an instance"
  11. raise RuntimeError
  12. s = '%s' % d
  13. if string.find(s, 'ArithUnaryFunction') == -1:
  14. print d, "is not an ArithUnaryFunction"
  15. raise RuntimeError
  16. try:
  17. e = make_Multiplies_double_double_double_double(d, d)
  18. a = e.this
  19. except:
  20. print e, "is not an instance"
  21. raise RuntimeError
  22. s = '%s' % e
  23. if string.find(s, 'ArithUnaryFunction') == -1:
  24. print e, "is not an ArithUnaryFunction"
  25. raise RuntimeError
  26. #
  27. # complex case
  28. #
  29. try:
  30. c = make_Identity_complex()
  31. a = c.this
  32. except:
  33. print c, "is not an instance"
  34. raise RuntimeError
  35. s = '%s' % c
  36. if string.find(s, 'ArithUnaryFunction') == -1:
  37. print c, "is not an ArithUnaryFunction"
  38. raise RuntimeError
  39. try:
  40. f = make_Multiplies_complex_complex_complex_complex(c, c)
  41. a = f.this
  42. except:
  43. print f, "is not an instance"
  44. raise RuntimeError
  45. s = '%s' % f
  46. if string.find(s, 'ArithUnaryFunction') == -1:
  47. print f, "is not an ArithUnaryFunction"
  48. raise RuntimeError
  49. #
  50. # Mix case
  51. #
  52. try:
  53. g = make_Multiplies_double_double_complex_complex(d, c)
  54. a = g.this
  55. except:
  56. print g, "is not an instance"
  57. raise RuntimeError
  58. s = '%s' % g
  59. if string.find(s, 'ArithUnaryFunction') == -1:
  60. print g, "is not an ArithUnaryFunction"
  61. raise RuntimeError
  62. try:
  63. h = make_Multiplies_complex_complex_double_double(c, d)
  64. a = h.this
  65. except:
  66. print h, "is not an instance"
  67. raise RuntimeError
  68. s = '%s' % h
  69. if string.find(s, 'ArithUnaryFunction') == -1:
  70. print h, "is not an ArithUnaryFunction"
  71. raise RuntimeError
  72. try:
  73. a = g.get_value()
  74. except:
  75. print g, "has not get_value() method"
  76. raise RuntimeError