diff options
author | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
commit | b2afb8800bb033a04bb3ecdf0363068d56648ef1 (patch) | |
tree | 3568129b5bbddb47cd39d622b4137a8fbff4abaf /linden/indra/test/llsdserialize_tut.cpp | |
parent | Second Life viewer sources 1.14.0.1 (diff) | |
download | meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.zip meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.gz meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.bz2 meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.xz |
Second Life viewer sources 1.15.0.2
Diffstat (limited to 'linden/indra/test/llsdserialize_tut.cpp')
-rw-r--r-- | linden/indra/test/llsdserialize_tut.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/linden/indra/test/llsdserialize_tut.cpp b/linden/indra/test/llsdserialize_tut.cpp index c87d7d1..80a4336 100644 --- a/linden/indra/test/llsdserialize_tut.cpp +++ b/linden/indra/test/llsdserialize_tut.cpp | |||
@@ -5,6 +5,7 @@ | |||
5 | * | 5 | * |
6 | * Copyright (c) 2006-2007, Linden Research, Inc. | 6 | * Copyright (c) 2006-2007, Linden Research, Inc. |
7 | * | 7 | * |
8 | * Second Life Viewer Source Code | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | 9 | * The source code in this file ("Source Code") is provided by Linden Lab |
9 | * to you under the terms of the GNU General Public License, version 2.0 | 10 | * to you under the terms of the GNU General Public License, version 2.0 |
10 | * ("GPL"), unless you have obtained a separate licensing agreement | 11 | * ("GPL"), unless you have obtained a separate licensing agreement |
@@ -33,7 +34,7 @@ | |||
33 | #include "llsd.h" | 34 | #include "llsd.h" |
34 | #include "llsdserialize.h" | 35 | #include "llsdserialize.h" |
35 | #include "lltut.h" | 36 | #include "lltut.h" |
36 | 37 | #include "llformat.h" | |
37 | 38 | ||
38 | namespace tut | 39 | namespace tut |
39 | { | 40 | { |
@@ -212,6 +213,7 @@ namespace tut | |||
212 | { | 213 | { |
213 | std::stringstream stream; | 214 | std::stringstream stream; |
214 | mFormatter->format(v, stream); | 215 | mFormatter->format(v, stream); |
216 | //llinfos << "checkRoundTrip: length " << stream.str().length() << llendl; | ||
215 | LLSD w; | 217 | LLSD w; |
216 | mParser->parse(stream, w); | 218 | mParser->parse(stream, w); |
217 | 219 | ||
@@ -226,6 +228,22 @@ namespace tut | |||
226 | throw; | 228 | throw; |
227 | } | 229 | } |
228 | } | 230 | } |
231 | |||
232 | static void fillmap(LLSD& root, U32 width, U32 depth) | ||
233 | { | ||
234 | if(depth == 0) | ||
235 | { | ||
236 | root["foo"] = "bar"; | ||
237 | return; | ||
238 | } | ||
239 | |||
240 | for(U32 i = 0; i < width; ++i) | ||
241 | { | ||
242 | std::string key = llformat("child %d", i); | ||
243 | root[key] = LLSD::emptyMap(); | ||
244 | fillmap(root[key], width, depth - 1); | ||
245 | } | ||
246 | } | ||
229 | 247 | ||
230 | void TestLLSDSerializeData::doRoundTripTests(const std::string& msg) | 248 | void TestLLSDSerializeData::doRoundTripTests(const std::string& msg) |
231 | { | 249 | { |
@@ -389,6 +407,10 @@ namespace tut | |||
389 | v[0][0] = true; | 407 | v[0][0] = true; |
390 | v[1][0] = false; | 408 | v[1][0] = false; |
391 | checkRoundTrip(msg + " nested arrays", v); | 409 | checkRoundTrip(msg + " nested arrays", v); |
410 | |||
411 | v = LLSD::emptyMap(); | ||
412 | fillmap(v, 10, 6); // 10^6 maps | ||
413 | checkRoundTrip(msg + " many nested maps", v); | ||
392 | } | 414 | } |
393 | 415 | ||
394 | typedef tut::test_group<TestLLSDSerializeData> TestLLSDSerialzeGroup; | 416 | typedef tut::test_group<TestLLSDSerializeData> TestLLSDSerialzeGroup; |
@@ -547,7 +569,6 @@ namespace tut | |||
547 | "</array></llsd>", v); | 569 | "</array></llsd>", v); |
548 | } | 570 | } |
549 | 571 | ||
550 | |||
551 | /* | 572 | /* |
552 | TODO: | 573 | TODO: |
553 | test XML parsing | 574 | test XML parsing |