diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/test/common.cpp | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r-- | linden/indra/test/common.cpp | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/linden/indra/test/common.cpp b/linden/indra/test/common.cpp index 25e2897..0bf0de4 100644 --- a/linden/indra/test/common.cpp +++ b/linden/indra/test/common.cpp | |||
@@ -66,7 +66,7 @@ namespace tut | |||
66 | std::string str = resp.str(); | 66 | std::string str = resp.str(); |
67 | LLMemoryStream mstr((U8*)str.c_str(), str.size()); | 67 | LLMemoryStream mstr((U8*)str.c_str(), str.size()); |
68 | LLSD response; | 68 | LLSD response; |
69 | S32 count = LLSDSerialize::fromNotation(response, mstr); | 69 | S32 count = LLSDSerialize::fromNotation(response, mstr, str.size()); |
70 | ensure("stream parsed", response.isDefined()); | 70 | ensure("stream parsed", response.isDefined()); |
71 | ensure_equals("stream parse count", count, 13); | 71 | ensure_equals("stream parse count", count, 13); |
72 | ensure_equals("sd type", response.type(), LLSD::TypeMap); | 72 | ensure_equals("sd type", response.type(), LLSD::TypeMap); |
@@ -96,7 +96,7 @@ namespace tut | |||
96 | std::string actual(str.str()); | 96 | std::string actual(str.str()); |
97 | ensure_equals("formatted binary encoding", actual, streamed); | 97 | ensure_equals("formatted binary encoding", actual, streamed); |
98 | sd.clear(); | 98 | sd.clear(); |
99 | LLSDSerialize::fromNotation(sd, str); | 99 | LLSDSerialize::fromNotation(sd, str, str.str().size()); |
100 | std::vector<U8> after; | 100 | std::vector<U8> after; |
101 | after = sd.asBinary(); | 101 | after = sd.asBinary(); |
102 | ensure_equals("binary decoded size", after.size(), decoded.size()); | 102 | ensure_equals("binary decoded size", after.size(), decoded.size()); |
@@ -126,7 +126,7 @@ namespace tut | |||
126 | sd.clear(); | 126 | sd.clear(); |
127 | ensure_equals("format count", count, 1); | 127 | ensure_equals("format count", count, 1); |
128 | LLSD sd2; | 128 | LLSD sd2; |
129 | count = LLSDSerialize::fromNotation(sd2, str); | 129 | count = LLSDSerialize::fromNotation(sd2, str, str.str().size()); |
130 | ensure_equals("parse count", count, 1); | 130 | ensure_equals("parse count", count, 1); |
131 | buf_t dest = sd2.asBinary(); | 131 | buf_t dest = sd2.asBinary(); |
132 | str.str(""); | 132 | str.str(""); |
@@ -149,7 +149,10 @@ namespace tut | |||
149 | serialized << "'" << LLSDNotationFormatter::escapeString(expected) | 149 | serialized << "'" << LLSDNotationFormatter::escapeString(expected) |
150 | << "'"; | 150 | << "'"; |
151 | LLSD sd; | 151 | LLSD sd; |
152 | S32 count = LLSDSerialize::fromNotation(sd, serialized); | 152 | S32 count = LLSDSerialize::fromNotation( |
153 | sd, | ||
154 | serialized, | ||
155 | serialized.str().size()); | ||
153 | ensure_equals("parse count", count, 1); | 156 | ensure_equals("parse count", count, 1); |
154 | ensure_equals("String streaming", sd.asString(), expected); | 157 | ensure_equals("String streaming", sd.asString(), expected); |
155 | } | 158 | } |
@@ -173,7 +176,7 @@ namespace tut | |||
173 | str.write((const char*)&source[0], size); | 176 | str.write((const char*)&source[0], size); |
174 | str << "\""; | 177 | str << "\""; |
175 | LLSD sd; | 178 | LLSD sd; |
176 | S32 count = LLSDSerialize::fromNotation(sd, str); | 179 | S32 count = LLSDSerialize::fromNotation(sd, str, str.str().size()); |
177 | ensure_equals("binary parse", count, 1); | 180 | ensure_equals("binary parse", count, 1); |
178 | buf_t actual = sd.asBinary(); | 181 | buf_t actual = sd.asBinary(); |
179 | ensure_equals("binary size", actual.size(), (size_t)size); | 182 | ensure_equals("binary size", actual.size(), (size_t)size); |
@@ -190,7 +193,7 @@ namespace tut | |||
190 | str.write(expected.c_str(), expected.size()); | 193 | str.write(expected.c_str(), expected.size()); |
191 | str << "'"; | 194 | str << "'"; |
192 | LLSD sd; | 195 | LLSD sd; |
193 | S32 count = LLSDSerialize::fromNotation(sd, str); | 196 | S32 count = LLSDSerialize::fromNotation(sd, str, str.str().size()); |
194 | ensure_equals("parse count", count, 1); | 197 | ensure_equals("parse count", count, 1); |
195 | std::string actual = sd.asString(); | 198 | std::string actual = sd.asString(); |
196 | ensure_equals("string sizes", actual.size(), expected.size()); | 199 | ensure_equals("string sizes", actual.size(), expected.size()); |
@@ -207,7 +210,10 @@ namespace tut | |||
207 | << " 'look_at':[r0,r1,r0]," | 210 | << " 'look_at':[r0,r1,r0]," |
208 | << " 'agent_access':'PG'}"; | 211 | << " 'agent_access':'PG'}"; |
209 | LLSD sd; | 212 | LLSD sd; |
210 | S32 count = LLSDSerialize::fromNotation(sd, stream); | 213 | S32 count = LLSDSerialize::fromNotation( |
214 | sd, | ||
215 | stream, | ||
216 | stream.str().size()); | ||
211 | ensure_equals("parse count", count, 12); | 217 | ensure_equals("parse count", count, 12); |
212 | ensure_equals("bool value", sd["connect"].asBoolean(), true); | 218 | ensure_equals("bool value", sd["connect"].asBoolean(), true); |
213 | ensure_equals("message value", sd["message"].asString(), msg); | 219 | ensure_equals("message value", sd["message"].asString(), msg); |
@@ -225,7 +231,10 @@ namespace tut | |||
225 | std::stringstream resp; | 231 | std::stringstream resp; |
226 | resp << "{'label':'short string test', 'singlechar':'a', 'empty':'', 'endoftest':'end' }"; | 232 | resp << "{'label':'short string test', 'singlechar':'a', 'empty':'', 'endoftest':'end' }"; |
227 | LLSD response; | 233 | LLSD response; |
228 | S32 count = LLSDSerialize::fromNotation(response, resp); | 234 | S32 count = LLSDSerialize::fromNotation( |
235 | response, | ||
236 | resp, | ||
237 | resp.str().size()); | ||
229 | ensure_equals("parse count", count, 5); | 238 | ensure_equals("parse count", count, 5); |
230 | ensure_equals("sd type", response.type(), LLSD::TypeMap); | 239 | ensure_equals("sd type", response.type(), LLSD::TypeMap); |
231 | ensure_equals("map element count", response.size(), 4); | 240 | ensure_equals("map element count", response.size(), 4); |
@@ -241,7 +250,7 @@ namespace tut | |||
241 | std::string str = resp.str(); | 250 | std::string str = resp.str(); |
242 | LLSD sd; | 251 | LLSD sd; |
243 | LLMemoryStream mstr((U8*)str.c_str(), str.size()); | 252 | LLMemoryStream mstr((U8*)str.c_str(), str.size()); |
244 | S32 count = LLSDSerialize::fromNotation(sd, mstr); | 253 | S32 count = LLSDSerialize::fromNotation(sd, mstr, str.size()); |
245 | ensure_equals("parse count", count, 5); | 254 | ensure_equals("parse count", count, 5); |
246 | ensure("sd created", sd.isDefined()); | 255 | ensure("sd created", sd.isDefined()); |
247 | ensure_equals("sd type", sd.type(), LLSD::TypeMap); | 256 | ensure_equals("sd type", sd.type(), LLSD::TypeMap); |
@@ -274,7 +283,7 @@ namespace tut | |||
274 | std::string actual_str = str.str(); | 283 | std::string actual_str = str.str(); |
275 | ensure_equals("stream contents", actual_str, expected_str); | 284 | ensure_equals("stream contents", actual_str, expected_str); |
276 | LLSD sd; | 285 | LLSD sd; |
277 | S32 count = LLSDSerialize::fromNotation(sd, str); | 286 | S32 count = LLSDSerialize::fromNotation(sd, str, actual_str.size()); |
278 | ensure_equals("parse count", count, 2); | 287 | ensure_equals("parse count", count, 2); |
279 | ensure("valid parse", sd.isDefined()); | 288 | ensure("valid parse", sd.isDefined()); |
280 | std::string actual = sd["message"].asString(); | 289 | std::string actual = sd["message"].asString(); |
@@ -288,7 +297,7 @@ namespace tut | |||
288 | std::stringstream str; | 297 | std::stringstream str; |
289 | str << "'" << LLSDNotationFormatter::escapeString(expected) << "'"; | 298 | str << "'" << LLSDNotationFormatter::escapeString(expected) << "'"; |
290 | LLSD sd; | 299 | LLSD sd; |
291 | S32 count = LLSDSerialize::fromNotation(sd, str); | 300 | S32 count = LLSDSerialize::fromNotation(sd, str, str.str().size()); |
292 | ensure_equals("parse count", count, 1); | 301 | ensure_equals("parse count", count, 1); |
293 | ensure_equals("string value", sd.asString(), expected); | 302 | ensure_equals("string value", sd.asString(), expected); |
294 | } | 303 | } |
@@ -300,7 +309,7 @@ namespace tut | |||
300 | std::stringstream str; | 309 | std::stringstream str; |
301 | str << "'" << LLSDNotationFormatter::escapeString(expected) << "'"; | 310 | str << "'" << LLSDNotationFormatter::escapeString(expected) << "'"; |
302 | LLSD sd; | 311 | LLSD sd; |
303 | S32 count = LLSDSerialize::fromNotation(sd, str); | 312 | S32 count = LLSDSerialize::fromNotation(sd, str, str.str().size()); |
304 | ensure_equals("parse count", count, 1); | 313 | ensure_equals("parse count", count, 1); |
305 | ensure_equals("string value", sd.asString(), expected); | 314 | ensure_equals("string value", sd.asString(), expected); |
306 | } | 315 | } |
@@ -321,7 +330,7 @@ namespace tut | |||
321 | std::stringstream str; | 330 | std::stringstream str; |
322 | str << "'" << LLSDNotationFormatter::escapeString(expected) << "'"; | 331 | str << "'" << LLSDNotationFormatter::escapeString(expected) << "'"; |
323 | LLSD sd; | 332 | LLSD sd; |
324 | S32 count = LLSDSerialize::fromNotation(sd, str); | 333 | S32 count = LLSDSerialize::fromNotation(sd, str, expected.size()); |
325 | ensure_equals("parse count", count, 1); | 334 | ensure_equals("parse count", count, 1); |
326 | std::string actual = sd.asString(); | 335 | std::string actual = sd.asString(); |
327 | /* | 336 | /* |
@@ -364,7 +373,7 @@ namespace tut | |||
364 | std::istringstream istr; | 373 | std::istringstream istr; |
365 | istr.str(param); | 374 | istr.str(param); |
366 | LLSD param_sd; | 375 | LLSD param_sd; |
367 | LLSDSerialize::fromNotation(param_sd, istr); | 376 | LLSDSerialize::fromNotation(param_sd, istr, param.size()); |
368 | ensure_equals("parsed type", param_sd.type(), LLSD::TypeArray); | 377 | ensure_equals("parsed type", param_sd.type(), LLSD::TypeArray); |
369 | LLSD version_sd = param_sd[0]; | 378 | LLSD version_sd = param_sd[0]; |
370 | ensure_equals("version type", version_sd.type(), LLSD::TypeMap); | 379 | ensure_equals("version type", version_sd.type(), LLSD::TypeMap); |
@@ -383,7 +392,7 @@ namespace tut | |||
383 | std::istringstream istr; | 392 | std::istringstream istr; |
384 | istr.str(val); | 393 | istr.str(val); |
385 | LLSD sd; | 394 | LLSD sd; |
386 | LLSDSerialize::fromNotation(sd, istr); | 395 | LLSDSerialize::fromNotation(sd, istr, val.size()); |
387 | ensure_equals("parsed type", sd.type(), LLSD::TypeArray); | 396 | ensure_equals("parsed type", sd.type(), LLSD::TypeArray); |
388 | ensure_equals("parsed size", sd.size(), 1); | 397 | ensure_equals("parsed size", sd.size(), 1); |
389 | LLSD failures = sd[0]["failures"]; | 398 | LLSD failures = sd[0]["failures"]; |
@@ -401,7 +410,7 @@ namespace tut | |||
401 | std::istringstream istr; | 410 | std::istringstream istr; |
402 | istr.str(val); | 411 | istr.str(val); |
403 | LLSD sd; | 412 | LLSD sd; |
404 | LLSDSerialize::fromNotation(sd, istr); | 413 | LLSDSerialize::fromNotation(sd, istr, val.size()); |
405 | ensure_equals("parsed type", sd.type(), LLSD::TypeArray); | 414 | ensure_equals("parsed type", sd.type(), LLSD::TypeArray); |
406 | ensure_equals("parsed size", sd.size(), 5); | 415 | ensure_equals("parsed size", sd.size(), 5); |
407 | ensure_equals("element 0 false", sd[0].asBoolean(), false); | 416 | ensure_equals("element 0 false", sd[0].asBoolean(), false); |