PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
MATLAB | 90 lines | 63 code | 27 blank | 0 comment | 17 complexity | 0e355ba00609a3d30e0bced599c9a28d MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. li_std_wstring
  2. x="h";
  3. if (li_std_wstring.test_wcvalue(x) != x)
  4. error("bad string mapping")
  5. endif
  6. x="hello";
  7. if (li_std_wstring.test_ccvalue(x) != x)
  8. error("bad string mapping")
  9. endif
  10. if (li_std_wstring.test_cvalue(x) != x)
  11. error("bad string mapping")
  12. endif
  13. if (li_std_wstring.test_value(x) != x)
  14. error("bad string mapping")
  15. endif
  16. if (li_std_wstring.test_const_reference(x) != x)
  17. error("bad string mapping")
  18. endif
  19. s = li_std_wstring.wstring("he");
  20. s = s + "llo";
  21. if (s != x)
  22. error("bad string mapping")
  23. endif
  24. if (s(1:4) != x(1:4))
  25. error("bad string mapping")
  26. endif
  27. if (li_std_wstring.test_value(s) != x)
  28. error("bad string mapping")
  29. endif
  30. if (li_std_wstring.test_const_reference(s) != x)
  31. error("bad string mapping")
  32. endif
  33. a = li_std_wstring.A(s);
  34. if (li_std_wstring.test_value(a) != x)
  35. error("bad string mapping")
  36. endif
  37. if (li_std_wstring.test_const_reference(a) != x)
  38. error("bad string mapping")
  39. endif
  40. b = li_std_wstring.wstring(" world");
  41. if (a + b != "hello world")
  42. error("bad string mapping")
  43. endif
  44. if (a + " world" != "hello world")
  45. error("bad string mapping")
  46. endif
  47. if ("hello" + b != "hello world")
  48. error("bad string mapping")
  49. endif
  50. c = "hello" + b;
  51. if (c.find_last_of("l") != 9)
  52. error("bad string mapping")
  53. endif
  54. s = "hello world";
  55. b = li_std_wstring.B("hi");
  56. b.name = li_std_wstring.wstring("hello");
  57. if (b.name != "hello")
  58. error("bad string mapping")
  59. endif
  60. b.a = li_std_wstring.A("hello");
  61. if (b.a != "hello")
  62. error("bad string mapping")
  63. endif