PageRenderTime 14ms CodeModel.GetById 2ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Objective C | 90 lines | 63 code | 27 blank | 0 comment | 34 complexity | 0e355ba00609a3d30e0bced599c9a28d MD5 | raw file
 1li_std_wstring
 2
 3x="h";
 4
 5if (li_std_wstring.test_wcvalue(x) != x)
 6  error("bad string mapping")
 7endif
 8
 9x="hello";
10if (li_std_wstring.test_ccvalue(x) != x)
11  error("bad string mapping")
12endif
13
14if (li_std_wstring.test_cvalue(x) != x)
15  error("bad string mapping")
16endif
17
18if (li_std_wstring.test_value(x) != x)
19  error("bad string mapping")
20endif
21
22if (li_std_wstring.test_const_reference(x) != x)
23  error("bad string mapping")
24endif
25
26
27s = li_std_wstring.wstring("he");
28s = s + "llo";
29
30if (s != x)
31  error("bad string mapping")
32endif
33
34if (s(1:4) != x(1:4))
35  error("bad string mapping")
36endif
37
38if (li_std_wstring.test_value(s) != x)
39  error("bad string mapping")
40endif
41
42if (li_std_wstring.test_const_reference(s) != x)
43  error("bad string mapping")
44endif
45
46a = li_std_wstring.A(s);
47
48if (li_std_wstring.test_value(a) != x)
49  error("bad string mapping")
50endif
51
52if (li_std_wstring.test_const_reference(a) != x)
53  error("bad string mapping")
54endif
55
56b = li_std_wstring.wstring(" world");
57
58if (a + b != "hello world")
59  error("bad string mapping")
60endif
61  
62if (a + " world" != "hello world")
63  error("bad string mapping")
64endif
65
66if ("hello" + b != "hello world")
67  error("bad string mapping")
68endif
69
70c = "hello" + b;
71if (c.find_last_of("l") != 9)
72  error("bad string mapping")
73endif
74  
75s = "hello world";
76
77b = li_std_wstring.B("hi");
78
79b.name = li_std_wstring.wstring("hello");
80if (b.name != "hello")
81  error("bad string mapping")
82endif
83
84
85b.a = li_std_wstring.A("hello");
86if (b.a != "hello")
87  error("bad string mapping")
88endif
89
90