PageRenderTime 36ms CodeModel.GetById 2ms app.highlight 30ms RepoModel.GetById 2ms app.codeStats 0ms

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

#
Objective C | 162 lines | 121 code | 41 blank | 0 comment | 63 complexity | e2bd7c88c28d152495c6ceb9536b875b MD5 | raw file
  1li_std_string_extra
  2
  3x="hello";
  4
  5
  6
  7if (li_std_string_extra.test_ccvalue(x) != x)
  8  error("bad string mapping")
  9endif
 10
 11if (li_std_string_extra.test_cvalue(x) != x)
 12  error("bad string mapping")
 13endif
 14
 15if (li_std_string_extra.test_value(x) != x)
 16  error("bad string mapping: %s, %s", x, li_std_string_extra.test_value(x))
 17endif
 18
 19if (li_std_string_extra.test_const_reference(x) != x)
 20  error("bad string mapping")
 21endif
 22
 23
 24s = li_std_string_extra.string("he");
 25#s += "ll"
 26#s.append("ll")
 27s = s + "llo";
 28
 29if (s != x)
 30  error("bad string mapping: %s, %s", s, x);
 31endif
 32
 33#if (s(1:4) != x(1:4))
 34#  error("bad string mapping")
 35#endif
 36
 37if (li_std_string_extra.test_value(s) != x)
 38  error("bad string mapping")
 39endif
 40
 41if (li_std_string_extra.test_const_reference(s) != x)
 42  error("bad string mapping")
 43endif
 44
 45a = li_std_string_extra.A(s);
 46
 47if (li_std_string_extra.test_value(a) != x)
 48  error("bad string mapping")
 49endif
 50
 51if (li_std_string_extra.test_const_reference(a) != x)
 52  error("bad string mapping")
 53endif
 54
 55b = li_std_string_extra.string(" world");
 56
 57s = a + b;
 58if (a + b != "hello world")
 59  error("bad string mapping: %s", a + b)
 60endif
 61  
 62if (a + " world" != "hello world")
 63  error("bad string mapping")
 64endif
 65
 66#if ("hello" + b != "hello world")
 67#  error("bad string mapping")
 68#endif
 69
 70c = (li_std_string_extra.string("hello") + b);
 71if (c.find_last_of("l") != 9)
 72  error("bad string mapping")
 73endif
 74  
 75s = "hello world";
 76
 77b = li_std_string_extra.B("hi");
 78
 79b.name = li_std_string_extra.string("hello");
 80if (b.name != "hello")
 81  error("bad string mapping")
 82endif
 83
 84
 85b.a = li_std_string_extra.A("hello");
 86if (b.a != "hello")
 87  error("bad string mapping")
 88endif
 89
 90
 91if (li_std_string_extra.test_value_basic1(x) != x)
 92  error("bad string mapping")
 93endif
 94
 95if (li_std_string_extra.test_value_basic2(x) != x)
 96  error("bad string mapping")
 97endif
 98
 99
100if (li_std_string_extra.test_value_basic3(x) != x)
101  error("bad string mapping")
102endif
103
104# Global variables
105s = "initial string";
106if (li_std_string_extra.cvar.GlobalString2 != "global string 2")
107  error("GlobalString2 test 1")
108endif
109li_std_string_extra.cvar.GlobalString2 = s;
110if (li_std_string_extra.cvar.GlobalString2 != s)
111  error("GlobalString2 test 2")
112endif
113if (li_std_string_extra.cvar.ConstGlobalString != "const global string")
114  error("ConstGlobalString test")
115endif
116
117# Member variables
118myStructure = li_std_string_extra.Structure();
119if (myStructure.MemberString2 != "member string 2")
120  error("MemberString2 test 1")
121endif
122myStructure.MemberString2 = s;
123if (myStructure.MemberString2 != s)
124  error("MemberString2 test 2")
125endif
126if (myStructure.ConstMemberString != "const member string")
127  error("ConstMemberString test")
128endif
129
130if (li_std_string_extra.cvar.Structure_StaticMemberString2 != "static member string 2")
131  error("StaticMemberString2 test 1")
132endif
133li_std_string_extra.cvar.Structure_StaticMemberString2 = s;
134if (li_std_string_extra.cvar.Structure_StaticMemberString2 != s)
135  error("StaticMemberString2 test 2")
136endif
137if (li_std_string_extra.cvar.Structure_ConstStaticMemberString != "const static member string")
138  error("ConstStaticMemberString test")
139endif
140
141
142if (li_std_string_extra.test_reference_input("hello") != "hello")
143  error
144endif
145s = li_std_string_extra.test_reference_inout("hello");
146if (s != "hellohello")
147  error
148endif
149
150
151if (li_std_string_extra.stdstring_empty() != "")
152  error
153endif
154
155
156if (li_std_string_extra.c_empty() != "")
157  error
158endif
159
160#if (li_std_string_extra.c_null() != None)
161#  error
162#endif