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

/trunk/Examples/test-suite/csharp/li_std_wstring_runme.cs

#
C# | 76 lines | 50 code | 26 blank | 0 comment | 32 complexity | 6bea6a30073f7fa02b449162d62dab7a MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. using System;
  2. using li_std_wstringNamespace;
  3. public class runme
  4. {
  5. static void Main()
  6. {
  7. char y='h';
  8. if (li_std_wstring.test_wcvalue(y) != y)
  9. throw new Exception("bad string mapping:" + li_std_wstring.test_wcvalue(y));
  10. if (li_std_wstring.test_wcvalue_w() != 'W')
  11. throw new Exception("bad string mapping:" + li_std_wstring.test_wcvalue_w());
  12. string x="hello";
  13. if (li_std_wstring.test_ccvalue(x) != x)
  14. throw new Exception("bad string mapping");
  15. if (li_std_wstring.test_cvalue(x) != x)
  16. throw new Exception("bad string mapping");
  17. if (li_std_wstring.test_value(x) != x)
  18. throw new Exception("bad string mapping: " + x + li_std_wstring.test_value(x));
  19. if (li_std_wstring.test_const_reference(x) != x)
  20. throw new Exception("bad string mapping");
  21. string s = "he";
  22. s = s + "llo";
  23. if (s != x)
  24. throw new Exception("bad string mapping: " + s + x);
  25. if (li_std_wstring.test_value(s) != x)
  26. throw new Exception("bad string mapping");
  27. if (li_std_wstring.test_const_reference(s) != x)
  28. throw new Exception("bad string mapping");
  29. string a = s;
  30. if (li_std_wstring.test_value(a) != x)
  31. throw new Exception("bad string mapping");
  32. if (li_std_wstring.test_const_reference(a) != x)
  33. throw new Exception("bad string mapping");
  34. string b = " world";
  35. if (a + b != "hello world")
  36. throw new Exception("bad string mapping");
  37. if (a + " world" != "hello world")
  38. throw new Exception("bad string mapping");
  39. if ("hello" + b != "hello world")
  40. throw new Exception("bad string mapping");
  41. s = "hello world";
  42. B myB = new B("hi");
  43. myB.name = "hello";
  44. if (myB.name != "hello")
  45. throw new Exception("bad string mapping");
  46. myB.a = "hello";
  47. if (myB.a != "hello")
  48. throw new Exception("bad string mapping");
  49. }
  50. }