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

/trunk/Examples/test-suite/octave/template_default_arg_runme.m

#
MATLAB | 117 lines | 84 code | 33 blank | 0 comment | 19 complexity | f80ca7e03599fb86c48b7cf76b3e5af4 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. template_default_arg
  2. helloInt = template_default_arg.Hello_int();
  3. helloInt.foo(template_default_arg.Hello_int_hi);
  4. x = template_default_arg.X_int();
  5. if (x.meth(20.0, 200) != 200)
  6. error("X_int test 1 failed")
  7. endif
  8. if (x.meth(20) != 20)
  9. error("X_int test 2 failed")
  10. endif
  11. if (x.meth() != 0)
  12. error("X_int test 3 failed")
  13. endif
  14. y = template_default_arg.Y_unsigned();
  15. if (y.meth(20.0, 200) != 200)
  16. error("Y_unsigned test 1 failed")
  17. endif
  18. if (y.meth(20) != 20)
  19. error("Y_unsigned test 2 failed")
  20. endif
  21. if (y.meth() != 0)
  22. error("Y_unsigned test 3 failed")
  23. endif
  24. x = template_default_arg.X_longlong();
  25. x = template_default_arg.X_longlong(20.0);
  26. x = template_default_arg.X_longlong(20.0, 200);
  27. x = template_default_arg.X_int();
  28. x = template_default_arg.X_int(20.0);
  29. x = template_default_arg.X_int(20.0, 200);
  30. x = template_default_arg.X_hello_unsigned();
  31. x = template_default_arg.X_hello_unsigned(20.0);
  32. x = template_default_arg.X_hello_unsigned(20.0, template_default_arg.Hello_int());
  33. y = template_default_arg.Y_hello_unsigned();
  34. y.meth(20.0, template_default_arg.Hello_int());
  35. y.meth(template_default_arg.Hello_int());
  36. y.meth();
  37. fz = template_default_arg.Foo_Z_8();
  38. x = template_default_arg.X_Foo_Z_8();
  39. fzc = x.meth(fz);
  40. # Templated functions
  41. # plain function: int ott(Foo<int>)
  42. if (template_default_arg.ott(template_default_arg.Foo_int()) != 30)
  43. error("ott test 1 failed")
  44. endif
  45. # %template(ott) ott<int, int>
  46. if (template_default_arg.ott() != 10)
  47. error("ott test 2 failed")
  48. endif
  49. if (template_default_arg.ott(1) != 10)
  50. error("ott test 3 failed")
  51. endif
  52. if (template_default_arg.ott(1, 1) != 10)
  53. error("ott test 4 failed")
  54. endif
  55. if (template_default_arg.ott("hi") != 20)
  56. error("ott test 5 failed")
  57. endif
  58. if (template_default_arg.ott("hi", 1) != 20)
  59. error("ott test 6 failed")
  60. endif
  61. if (template_default_arg.ott("hi", 1, 1) != 20)
  62. error("ott test 7 failed")
  63. endif
  64. # %template(ott) ott<const char *>
  65. if (template_default_arg.ottstring(template_default_arg.Hello_int(), "hi") != 40)
  66. error("ott test 8 failed")
  67. endif
  68. if (template_default_arg.ottstring(template_default_arg.Hello_int()) != 40)
  69. error("ott test 9 failed")
  70. endif
  71. # %template(ott) ott<int>
  72. if (template_default_arg.ottint(template_default_arg.Hello_int(), 1) != 50)
  73. error("ott test 10 failed")
  74. endif
  75. if (template_default_arg.ottint(template_default_arg.Hello_int()) != 50)
  76. error("ott test 11 failed")
  77. endif
  78. # %template(ott) ott<double>
  79. if (template_default_arg.ott(template_default_arg.Hello_int(), 1.0) != 60)
  80. error("ott test 12 failed")
  81. endif
  82. if (template_default_arg.ott(template_default_arg.Hello_int()) != 60)
  83. error("ott test 13 failed")
  84. endif