PageRenderTime 41ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
MATLAB | 55 lines | 40 code | 15 blank | 0 comment | 10 complexity | 091e3ad09e6dff5bfced20e1f5df8847 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. # Note: This example assumes that namespaces are flattened
  2. cpp_namespace
  3. n = cpp_namespace.fact(4);
  4. if (n != 24)
  5. error("Bad return value!")
  6. endif
  7. if (cpp_namespace.cvar.Foo != 42)
  8. error("Bad variable value!")
  9. endif
  10. t = cpp_namespace.Test();
  11. if (!strcmp(t.method(),"Test::method"))
  12. error("Bad method return value!")
  13. endif
  14. if (!strcmp(cpp_namespace.do_method(t),"Test::method"))
  15. error("Bad return value!")
  16. endif
  17. if (!strcmp(cpp_namespace.do_method2(t),"Test::method"))
  18. error("Bad return value!")
  19. endif
  20. cpp_namespace.weird("hello", 4);
  21. clear t;
  22. t2 = cpp_namespace.Test2();
  23. t3 = cpp_namespace.Test3();
  24. t4 = cpp_namespace.Test4();
  25. t5 = cpp_namespace.Test5();
  26. if (cpp_namespace.foo3(42) != 42)
  27. error("Bad return value!")
  28. endif
  29. if (!strcmp(cpp_namespace.do_method3(t2,40),"Test2::method"))
  30. error("Bad return value!")
  31. endif
  32. if (!strcmp(cpp_namespace.do_method3(t3,40),"Test3::method"))
  33. error("Bad return value!")
  34. endif
  35. if (!strcmp(cpp_namespace.do_method3(t4,40),"Test4::method"))
  36. error("Bad return value!")
  37. endif
  38. if (!strcmp(cpp_namespace.do_method3(t5,40),"Test5::method"))
  39. error("Bad return value!")
  40. endif