diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/test/common.cpp | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to '')
-rw-r--r-- | linden/indra/test/common.cpp | 447 |
1 files changed, 447 insertions, 0 deletions
diff --git a/linden/indra/test/common.cpp b/linden/indra/test/common.cpp new file mode 100644 index 0000000..1be0931 --- /dev/null +++ b/linden/indra/test/common.cpp | |||
@@ -0,0 +1,447 @@ | |||
1 | /** | ||
2 | * @file common.cpp | ||
3 | * @author Phoenix | ||
4 | * @date 2005-10-12 | ||
5 | * @brief Common templates for test framework | ||
6 | * | ||
7 | * Copyright (c) 2005-2007, Linden Research, Inc. | ||
8 | * | ||
9 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
10 | * to you under the terms of the GNU General Public License, version 2.0 | ||
11 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
12 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
13 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
14 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
15 | * | ||
16 | * There are special exceptions to the terms and conditions of the GPL as | ||
17 | * it is applied to this Source Code. View the full text of the exception | ||
18 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
19 | * online at http://secondlife.com/developers/opensource/flossexception | ||
20 | * | ||
21 | * By copying, modifying or distributing this software, you acknowledge | ||
22 | * that you have read and understood your obligations described above, | ||
23 | * and agree to abide by those obligations. | ||
24 | * | ||
25 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
26 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
27 | * COMPLETENESS OR PERFORMANCE. | ||
28 | */ | ||
29 | |||
30 | /** | ||
31 | * | ||
32 | * THOROUGH_DESCRIPTION of common.cpp | ||
33 | * | ||
34 | */ | ||
35 | |||
36 | #include "linden_common.h" | ||
37 | #include "lltut.h" | ||
38 | |||
39 | #include <algorithm> | ||
40 | #include <iomanip> | ||
41 | #include <iterator> | ||
42 | |||
43 | #include "llmemorystream.h" | ||
44 | #include "llsd.h" | ||
45 | #include "llsdserialize.h" | ||
46 | |||
47 | namespace tut | ||
48 | { | ||
49 | struct sd_data | ||
50 | { | ||
51 | }; | ||
52 | typedef test_group<sd_data> sd_test; | ||
53 | typedef sd_test::object sd_object; | ||
54 | tut::sd_test sd("llsd"); | ||
55 | |||
56 | template<> template<> | ||
57 | void sd_object::test<1>() | ||
58 | { | ||
59 | std::ostringstream resp; | ||
60 | resp << "{'connect':true, 'position':[r128,r128,r128], 'look_at':[r0,r1,r0], 'agent_access':'M', 'region_x':i8192, 'region_y':i8192}"; | ||
61 | std::string str = resp.str(); | ||
62 | LLMemoryStream mstr((U8*)str.c_str(), str.size()); | ||
63 | LLSD response; | ||
64 | S32 count = LLSDSerialize::fromNotation(response, mstr); | ||
65 | ensure("stream parsed", response.isDefined()); | ||
66 | ensure_equals("stream parse count", count, 13); | ||
67 | ensure_equals("sd type", response.type(), LLSD::TypeMap); | ||
68 | ensure_equals("map element count", response.size(), 6); | ||
69 | ensure_equals("value connect", response["connect"].asBoolean(), true); | ||
70 | ensure_equals("value region_x", response["region_x"].asInteger(),8192); | ||
71 | ensure_equals("value region_y", response["region_y"].asInteger(),8192); | ||
72 | } | ||
73 | |||
74 | template<> template<> | ||
75 | void sd_object::test<2>() | ||
76 | { | ||
77 | const std::string decoded("random"); | ||
78 | //const std::string encoded("cmFuZG9t\n"); | ||
79 | const std::string streamed("b(6)\"random\""); | ||
80 | typedef std::vector<U8> buf_t; | ||
81 | buf_t buf; | ||
82 | std::copy( | ||
83 | decoded.begin(), | ||
84 | decoded.end(), | ||
85 | std::back_insert_iterator<buf_t>(buf)); | ||
86 | LLSD sd; | ||
87 | sd = buf; | ||
88 | std::stringstream str; | ||
89 | S32 count = LLSDSerialize::toNotation(sd, str); | ||
90 | ensure_equals("output count", count, 1); | ||
91 | std::string actual(str.str()); | ||
92 | ensure_equals("formatted binary encoding", actual, streamed); | ||
93 | sd.clear(); | ||
94 | LLSDSerialize::fromNotation(sd, str); | ||
95 | std::vector<U8> after; | ||
96 | after = sd.asBinary(); | ||
97 | ensure_equals("binary decoded size", after.size(), decoded.size()); | ||
98 | ensure("binary decoding", (0 == memcmp( | ||
99 | &after[0], | ||
100 | decoded.c_str(), | ||
101 | decoded.size()))); | ||
102 | } | ||
103 | |||
104 | template<> template<> | ||
105 | void sd_object::test<3>() | ||
106 | { | ||
107 | for(S32 i = 0; i < 100; ++i) | ||
108 | { | ||
109 | // gen up a starting point | ||
110 | typedef std::vector<U8> buf_t; | ||
111 | buf_t source; | ||
112 | srand(i); | ||
113 | S32 size = rand() % 1000 + 10; | ||
114 | std::generate_n( | ||
115 | std::back_insert_iterator<buf_t>(source), | ||
116 | size, | ||
117 | rand); | ||
118 | LLSD sd(source); | ||
119 | std::stringstream str; | ||
120 | S32 count = LLSDSerialize::toNotation(sd, str); | ||
121 | sd.clear(); | ||
122 | ensure_equals("format count", count, 1); | ||
123 | LLSD sd2; | ||
124 | count = LLSDSerialize::fromNotation(sd2, str); | ||
125 | ensure_equals("parse count", count, 1); | ||
126 | buf_t dest = sd2.asBinary(); | ||
127 | str.str(""); | ||
128 | str << "binary encoding size " << i; | ||
129 | ensure_equals(str.str().c_str(), dest.size(), source.size()); | ||
130 | str.str(""); | ||
131 | str << "binary encoding " << i; | ||
132 | ensure(str.str().c_str(), (source == dest)); | ||
133 | } | ||
134 | } | ||
135 | |||
136 | template<> template<> | ||
137 | void sd_object::test<4>() | ||
138 | { | ||
139 | std::ostringstream ostr; | ||
140 | ostr << "{'task_id':u1fd77b79-a8e7-25a5-9454-02a4d948ba1c}\n" | ||
141 | << "{\n\tname\tObject|\n}\n"; | ||
142 | std::string expected = ostr.str(); | ||
143 | std::stringstream serialized; | ||
144 | serialized << "'" << LLSDNotationFormatter::escapeString(expected) | ||
145 | << "'"; | ||
146 | LLSD sd; | ||
147 | S32 count = LLSDSerialize::fromNotation(sd, serialized); | ||
148 | ensure_equals("parse count", count, 1); | ||
149 | ensure_equals("String streaming", sd.asString(), expected); | ||
150 | } | ||
151 | |||
152 | template<> template<> | ||
153 | void sd_object::test<5>() | ||
154 | { | ||
155 | for(S32 i = 0; i < 100; ++i) | ||
156 | { | ||
157 | // gen up a starting point | ||
158 | typedef std::vector<U8> buf_t; | ||
159 | buf_t source; | ||
160 | srand(666 + i); | ||
161 | S32 size = rand() % 1000 + 10; | ||
162 | std::generate_n( | ||
163 | std::back_insert_iterator<buf_t>(source), | ||
164 | size, | ||
165 | rand); | ||
166 | std::stringstream str; | ||
167 | str << "b(" << size << ")\""; | ||
168 | str.write((const char*)&source[0], size); | ||
169 | str << "\""; | ||
170 | LLSD sd; | ||
171 | S32 count = LLSDSerialize::fromNotation(sd, str); | ||
172 | ensure_equals("binary parse", count, 1); | ||
173 | buf_t actual = sd.asBinary(); | ||
174 | ensure_equals("binary size", actual.size(), (size_t)size); | ||
175 | ensure("binary data", (0 == memcmp(&source[0], &actual[0], size))); | ||
176 | } | ||
177 | } | ||
178 | |||
179 | template<> template<> | ||
180 | void sd_object::test<6>() | ||
181 | { | ||
182 | std::string expected("'{\"task_id\":u1fd77b79-a8e7-25a5-9454-02a4d948ba1c}'\t\n\t\t"); | ||
183 | std::stringstream str; | ||
184 | str << "s(" << expected.size() << ")'"; | ||
185 | str.write(expected.c_str(), expected.size()); | ||
186 | str << "'"; | ||
187 | LLSD sd; | ||
188 | S32 count = LLSDSerialize::fromNotation(sd, str); | ||
189 | ensure_equals("parse count", count, 1); | ||
190 | std::string actual = sd.asString(); | ||
191 | ensure_equals("string sizes", actual.size(), expected.size()); | ||
192 | ensure_equals("string content", actual, expected); | ||
193 | } | ||
194 | |||
195 | template<> template<> | ||
196 | void sd_object::test<7>() | ||
197 | { | ||
198 | std::string msg("come on in"); | ||
199 | std::stringstream stream; | ||
200 | stream << "{'connect':1, 'message':'" << msg << "'," | ||
201 | << " 'position':[r45.65,r100.1,r25.5]," | ||
202 | << " 'look_at':[r0,r1,r0]," | ||
203 | << " 'agent_access':'PG'}"; | ||
204 | LLSD sd; | ||
205 | S32 count = LLSDSerialize::fromNotation(sd, stream); | ||
206 | ensure_equals("parse count", count, 12); | ||
207 | ensure_equals("bool value", sd["connect"].asBoolean(), true); | ||
208 | ensure_equals("message value", sd["message"].asString(), msg); | ||
209 | ensure_equals("pos x", sd["position"][0].asReal(), 45.65); | ||
210 | ensure_equals("pos y", sd["position"][1].asReal(), 100.1); | ||
211 | ensure_equals("pos z", sd["position"][2].asReal(), 25.5); | ||
212 | ensure_equals("look x", sd["look_at"][0].asReal(), 0.0); | ||
213 | ensure_equals("look y", sd["look_at"][1].asReal(), 1.0); | ||
214 | ensure_equals("look z", sd["look_at"][2].asReal(), 0.0); | ||
215 | } | ||
216 | |||
217 | template<> template<> | ||
218 | void sd_object::test<8>() | ||
219 | { | ||
220 | std::stringstream resp; | ||
221 | resp << "{'label':'short string test', 'singlechar':'a', 'empty':'', 'endoftest':'end' }"; | ||
222 | LLSD response; | ||
223 | S32 count = LLSDSerialize::fromNotation(response, resp); | ||
224 | ensure_equals("parse count", count, 5); | ||
225 | ensure_equals("sd type", response.type(), LLSD::TypeMap); | ||
226 | ensure_equals("map element count", response.size(), 4); | ||
227 | ensure_equals("singlechar", response["singlechar"].asString(), "a"); | ||
228 | ensure_equals("empty", response["empty"].asString(), ""); | ||
229 | } | ||
230 | |||
231 | template<> template<> | ||
232 | void sd_object::test<9>() | ||
233 | { | ||
234 | std::ostringstream resp; | ||
235 | resp << "{'label':'short binary test', 'singlebinary':b(1)\"A\", 'singlerawstring':s(1)\"A\", 'endoftest':'end' }"; | ||
236 | std::string str = resp.str(); | ||
237 | LLSD sd; | ||
238 | LLMemoryStream mstr((U8*)str.c_str(), str.size()); | ||
239 | S32 count = LLSDSerialize::fromNotation(sd, mstr); | ||
240 | ensure_equals("parse count", count, 5); | ||
241 | ensure("sd created", sd.isDefined()); | ||
242 | ensure_equals("sd type", sd.type(), LLSD::TypeMap); | ||
243 | ensure_equals("map element count", sd.size(), 4); | ||
244 | ensure_equals( | ||
245 | "label", | ||
246 | sd["label"].asString(), | ||
247 | "short binary test"); | ||
248 | std::vector<U8> bin = sd["singlebinary"].asBinary(); | ||
249 | std::vector<U8> expected; | ||
250 | expected.resize(1); | ||
251 | expected[0] = 'A'; | ||
252 | ensure("single binary", (0 == memcmp(&bin[0], &expected[0], 1))); | ||
253 | ensure_equals( | ||
254 | "single string", | ||
255 | sd["singlerawstring"].asString(), | ||
256 | std::string("A")); | ||
257 | ensure_equals("end", sd["endoftest"].asString(), "end"); | ||
258 | } | ||
259 | |||
260 | template<> template<> | ||
261 | void sd_object::test<10>() | ||
262 | { | ||
263 | |||
264 | std::string message("parcel '' is naughty."); | ||
265 | std::stringstream str; | ||
266 | str << "{'message':'" << LLSDNotationFormatter::escapeString(message) | ||
267 | << "'}"; | ||
268 | std::string expected_str("{'message':'parcel \\'\\' is naughty.'}"); | ||
269 | std::string actual_str = str.str(); | ||
270 | ensure_equals("stream contents", actual_str, expected_str); | ||
271 | LLSD sd; | ||
272 | S32 count = LLSDSerialize::fromNotation(sd, str); | ||
273 | ensure_equals("parse count", count, 2); | ||
274 | ensure("valid parse", sd.isDefined()); | ||
275 | std::string actual = sd["message"].asString(); | ||
276 | ensure_equals("message contents", actual, message); | ||
277 | } | ||
278 | |||
279 | template<> template<> | ||
280 | void sd_object::test<11>() | ||
281 | { | ||
282 | std::string expected("\"\"\"\"''''''\""); | ||
283 | std::stringstream str; | ||
284 | str << "'" << LLSDNotationFormatter::escapeString(expected) << "'"; | ||
285 | LLSD sd; | ||
286 | S32 count = LLSDSerialize::fromNotation(sd, str); | ||
287 | ensure_equals("parse count", count, 1); | ||
288 | ensure_equals("string value", sd.asString(), expected); | ||
289 | } | ||
290 | |||
291 | template<> template<> | ||
292 | void sd_object::test<12>() | ||
293 | { | ||
294 | std::string expected("mytest\\"); | ||
295 | std::stringstream str; | ||
296 | str << "'" << LLSDNotationFormatter::escapeString(expected) << "'"; | ||
297 | LLSD sd; | ||
298 | S32 count = LLSDSerialize::fromNotation(sd, str); | ||
299 | ensure_equals("parse count", count, 1); | ||
300 | ensure_equals("string value", sd.asString(), expected); | ||
301 | } | ||
302 | |||
303 | template<> template<> | ||
304 | void sd_object::test<13>() | ||
305 | { | ||
306 | for(S32 i = 0; i < 10000; ++i) | ||
307 | { | ||
308 | // gen up a starting point | ||
309 | std::string expected; | ||
310 | srand(1337 + i); | ||
311 | S32 size = rand() % 30 + 5; | ||
312 | std::generate_n( | ||
313 | std::back_insert_iterator<std::string>(expected), | ||
314 | size, | ||
315 | rand); | ||
316 | std::stringstream str; | ||
317 | str << "'" << LLSDNotationFormatter::escapeString(expected) << "'"; | ||
318 | LLSD sd; | ||
319 | S32 count = LLSDSerialize::fromNotation(sd, str); | ||
320 | ensure_equals("parse count", count, 1); | ||
321 | std::string actual = sd.asString(); | ||
322 | /* | ||
323 | if(actual != expected) | ||
324 | { | ||
325 | llwarns << "iteration " << i << llendl; | ||
326 | std::ostringstream e_str; | ||
327 | std::string::iterator iter = expected.begin(); | ||
328 | std::string::iterator end = expected.end(); | ||
329 | for(; iter != end; ++iter) | ||
330 | { | ||
331 | e_str << (S32)((U8)(*iter)) << " "; | ||
332 | } | ||
333 | e_str << std::endl; | ||
334 | llsd_serialize_string(e_str, expected); | ||
335 | llwarns << "expected size: " << expected.size() << llendl; | ||
336 | llwarns << "expected: " << e_str.str() << llendl; | ||
337 | |||
338 | std::ostringstream a_str; | ||
339 | iter = actual.begin(); | ||
340 | end = actual.end(); | ||
341 | for(; iter != end; ++iter) | ||
342 | { | ||
343 | a_str << (S32)((U8)(*iter)) << " "; | ||
344 | } | ||
345 | a_str << std::endl; | ||
346 | llsd_serialize_string(a_str, actual); | ||
347 | llwarns << "actual size: " << actual.size() << llendl; | ||
348 | llwarns << "actual: " << a_str.str() << llendl; | ||
349 | } | ||
350 | */ | ||
351 | ensure_equals("string value", actual, expected); | ||
352 | } | ||
353 | } | ||
354 | |||
355 | template<> template<> | ||
356 | void sd_object::test<14>() | ||
357 | { | ||
358 | std::string param = "[{'version':i1},{'data':{'binary_bucket':b(0)\"\"},'from_id':u3c115e51-04f4-523c-9fa6-98aff1034730,'from_name':'Phoenix Linden','id':u004e45e5-5576-277a-fba7-859d6a4cb5c8,'message':'hey','offline':i0,'timestamp':i0,'to_id':u3c5f1bb4-5182-7546-6401-1d329b4ff2f8,'type':i0},{'agent_id':u3c115e51-04f4-523c-9fa6-98aff1034730,'god_level':i0,'limited_to_estate':i1}]"; | ||
359 | std::istringstream istr; | ||
360 | istr.str(param); | ||
361 | LLSD param_sd; | ||
362 | LLSDSerialize::fromNotation(param_sd, istr); | ||
363 | ensure_equals("parsed type", param_sd.type(), LLSD::TypeArray); | ||
364 | LLSD version_sd = param_sd[0]; | ||
365 | ensure_equals("version type", version_sd.type(), LLSD::TypeMap); | ||
366 | ensure("has version", version_sd.has("version")); | ||
367 | ensure_equals("version number", version_sd["version"].asInteger(), 1); | ||
368 | LLSD src_sd = param_sd[1]; | ||
369 | ensure_equals("src type", src_sd.type(), LLSD::TypeMap); | ||
370 | LLSD dst_sd = param_sd[2]; | ||
371 | ensure_equals("dst type", dst_sd.type(), LLSD::TypeMap); | ||
372 | } | ||
373 | |||
374 | template<> template<> | ||
375 | void sd_object::test<15>() | ||
376 | { | ||
377 | std::string val = "[{'failures':!,'successfuls':[u3c115e51-04f4-523c-9fa6-98aff1034730]}]"; | ||
378 | std::istringstream istr; | ||
379 | istr.str(val); | ||
380 | LLSD sd; | ||
381 | LLSDSerialize::fromNotation(sd, istr); | ||
382 | ensure_equals("parsed type", sd.type(), LLSD::TypeArray); | ||
383 | ensure_equals("parsed size", sd.size(), 1); | ||
384 | LLSD failures = sd[0]["failures"]; | ||
385 | ensure("no failures.", failures.isUndefined()); | ||
386 | LLSD success = sd[0]["successfuls"]; | ||
387 | ensure_equals("success type", success.type(), LLSD::TypeArray); | ||
388 | ensure_equals("success size", success.size(), 1); | ||
389 | ensure_equals("success instance type", success[0].type(), LLSD::TypeUUID); | ||
390 | } | ||
391 | |||
392 | template<> template<> | ||
393 | void sd_object::test<16>() | ||
394 | { | ||
395 | std::string val = "[f,t,0,1,{'foo':t,'bar':f}]"; | ||
396 | std::istringstream istr; | ||
397 | istr.str(val); | ||
398 | LLSD sd; | ||
399 | LLSDSerialize::fromNotation(sd, istr); | ||
400 | ensure_equals("parsed type", sd.type(), LLSD::TypeArray); | ||
401 | ensure_equals("parsed size", sd.size(), 5); | ||
402 | ensure_equals("element 0 false", sd[0].asBoolean(), false); | ||
403 | ensure_equals("element 1 true", sd[1].asBoolean(), true); | ||
404 | ensure_equals("element 2 false", sd[2].asBoolean(), false); | ||
405 | ensure_equals("element 3 true", sd[3].asBoolean(), true); | ||
406 | LLSD map = sd[4]; | ||
407 | ensure_equals("element 4 type", map.type(), LLSD::TypeMap); | ||
408 | ensure_equals("map foo type", map["foo"].type(), LLSD::TypeBoolean); | ||
409 | ensure_equals("map foo value", map["foo"].asBoolean(), true); | ||
410 | ensure_equals("map bar type", map["bar"].type(), LLSD::TypeBoolean); | ||
411 | ensure_equals("map bar value", map["bar"].asBoolean(), false); | ||
412 | } | ||
413 | |||
414 | /* | ||
415 | template<> template<> | ||
416 | void sd_object::test<16>() | ||
417 | { | ||
418 | } | ||
419 | */ | ||
420 | } | ||
421 | |||
422 | #if 0 | ||
423 | '{\'task_id\':u1fd77b79-a8e7-25a5-9454-02a4d948ba1c}\n{\n\tname\tObject|\n\tpermissions 0\n\t{\n\t\tbase_mask\t7fffffff\n\t\towner_mask\t7fffffff\n\t\tgroup_mask\t00000000\n\t\teveryone_mask\t00000000\n\t\tnext_owner_mask\t00082000\n\t\tcreator_id\t3c115e51-04f4-523c-9fa6-98aff1034730\n\t\towner_id\t3c115e51-04f4-523c-9fa6-98aff1034730\n\t\tlast_owner_id\t00000000-0000-0000-0000-000000000000\n\t\tgroup_id\t00000000-0000-0000-0000-000000000000\n\t}\n\tlocal_id\t10284\n\ttotal_crc\t35\n\ttype\t1\n\ttask_valid\t2\n\ttravel_access\t21\n\tdisplayopts\t2\n\tdisplaytype\tv\n\tpos\t0\t0\t0\n\toldpos\t0\t0\t0\n\trotation\t4.371139183945160766597837e-08\t1\t4.371139183945160766597837e-08\t0\n\tvelocity\t0\t0\t0\n\tangvel\t0\t0\t0\n\tscale\t0.2816932\t0.2816932\t0.2816932\n\tsit_offset\t0\t0\t0\n\tcamera_eye_offset\t0\t0\t0\n\tcamera_at_offset\t0\t0\t0\n\tsit_quat\t0\t0\t0\t1\n\tsit_hint\t0\n\tstate\t80\n\tmaterial\t3\n\tsoundid\t00000000-0000-0000-0000-000000000000\n\tsoundgain\t0\n\tsoundradius\t0\n\tsoundflags\t0\n\ttextcolor\t0 0 0 1\n\tselected\t0\n\tselector\t00000000-0000-0000-0000-000000000000\n\tusephysics\t0\n\trotate_x\t1\n\trotate_y\t1\n\trotate_z\t1\n\tphantom\t0\n\tremote_script_access_pin\t0\n\tvolume_detect\t0\n\tblock_grabs\t0\n\tdie_at_edge\t0\n\treturn_at_edge\t0\n\ttemporary\t0\n\tsandbox\t0\n\tsandboxhome\t0\t0\t0\n\tshape 0\n\t{\n\t\tpath 0\n\t\t{\n\t\t\tcurve\t16\n\t\t\tbegin\t0\n\t\t\tend\t1\n\t\t\tscale_x\t1\n\t\t\tscale_y\t1\n\t\t\tshear_x\t0\n\t\t\tshear_y\t0\n\t\t\ttwist\t0\n\t\t\ttwist_begin\t0\n\t\t\tradius_offset\t0\n\t\t\ttaper_x\t0\n\t\t\ttaper_y\t0\n\t\t\trevolutions\t1\n\t\t\tskew\t0\n\t\t}\n\t\tprofile 0\n\t\t{\n\t\t\tcurve\t1\n\t\t\tbegin\t0\n\t\t\tend\t1\n\t\t\thollow\t0\n\t\t}\n\t}\n\tfaces\t6\n\t{\n\t\timageid\t89556747-24cb-43ed-920b-47caed15465f\n\t\tcolors\t1 1 1 1\n\t\tscales\t0.56\n\t\tscalet\t0.56\n\t\toffsets\t0\n\t\toffsett\t0\n\t\timagerot\t0\n\t\tbump\t0\n\t\tfullbright\t0\n\t\tmedia_flags\t0\n\t}\n\t{\n\t\timageid\t89556747-24cb-43ed-920b-47caed15465f\n\t\tcolors\t1 1 1 1\n\t\tscales\t0.56\n\t\tscalet\t0.56\n\t\toffsets\t0\n\t\toffsett\t0\n\t\timagerot\t0\n\t\tbump\t0\n\t\tfullbright\t0\n\t\tmedia_flags\t0\n\t}\n\t{\n\t\timageid\t89556747-24cb-43ed-920b-47caed15465f\n\t\tcolors\t1 1 1 1\n\t\tscales\t0.56\n\t\tscalet\t0.56\n\t\toffsets\t0\n\t\toffsett\t0\n\t\timagerot\t0\n\t\tbump\t0\n\t\tfullbright\t0\n\t\tmedia_flags\t0\n\t}\n\t{\n\t\timageid\t89556747-24cb-43ed-920b-47caed15465f\n\t\tcolors\t1 1 1 1\n\t\tscales\t0.56\n\t\tscalet\t0.56\n\t\toffsets\t0\n\t\toffsett\t0\n\t\timagerot\t0\n\t\tbump\t0\n\t\tfullbright\t0\n\t\tmedia_flags\t0\n\t}\n\t{\n\t\timageid\t89556747-24cb-43ed-920b-47caed15465f\n\t\tcolors\t1 1 1 1\n\t\tscales\t0.56\n\t\tscalet\t0.56\n\t\toffsets\t0\n\t\toffsett\t0\n\t\timagerot\t0\n\t\tbump\t0\n\t\tfullbright\t0\n\t\tmedia_flags\t0\n\t}\n\t{\n\t\timageid\t89556747-24cb-43ed-920b-47caed15465f\n\t\tcolors\t1 1 1 1\n\t\tscales\t0.56\n\t\tscalet\t0.56\n\t\toffsets\t0\n\t\toffsett\t0\n\t\timagerot\t0\n\t\tbump\t0\n\t\tfullbright\t0\n\t\tmedia_flags\t0\n\t}\n\tps_next_crc\t1\n\tgpw_bias\t1\n\tip\t0\n\tcomplete\tTRUE\n\tdelay\t50000\n\tnextstart\t1132625972249870\n\tbirthtime\t1132625953120694\n\treztime\t1132625953120694\n\tparceltime\t1132625953120694\n\ttax_rate\t1.01615\n\tnamevalue\tAttachmentOrientation VEC3 RW DS -3.141593, 0.000000, -3.141593\n\tnamevalue\tAttachmentOffset VEC3 RW DS 0.000000, 0.000000, 0.000000\n\tnamevalue\tAttachPt U32 RW S 5\n\tnamevalue\tAttachItemID STRING RW SV 1f9975c0-2951-1b93-dd83-46e2b932fcc8\n\tscratchpad\t0\n\t{\n\t\n\t}\n\tsale_info\t0\n\t{\n\t\tsale_type\tnot\n\t\tsale_price\t10\n\t}\n\torig_asset_id\t52019cdd-b464-ba19-e66d-3da751fef9da\n\torig_item_id\t1f9975c0-2951-1b93-dd83-46e2b932fcc8\n\tcorrect_family_id\t00000000-0000-0000-0000-000000000000\n\thas_rezzed\t0\n\tpre_link_base_mask\t7fffffff\n\tdefault_pay_price\t-2\t1\t5\t10\t20\n}\n' | ||
424 | #endif | ||
425 | |||
426 | namespace tut | ||
427 | { | ||
428 | struct mem_data | ||
429 | { | ||
430 | }; | ||
431 | typedef test_group<mem_data> mem_test; | ||
432 | typedef mem_test::object mem_object; | ||
433 | tut::mem_test mem_stream("memory_stream"); | ||
434 | |||
435 | template<> template<> | ||
436 | void mem_object::test<1>() | ||
437 | { | ||
438 | const char HELLO_WORLD[] = "hello world"; | ||
439 | LLMemoryStream mem((U8*)&HELLO_WORLD[0], strlen(HELLO_WORLD)); | ||
440 | std::string hello; | ||
441 | std::string world; | ||
442 | mem >> hello >> world; | ||
443 | ensure_equals("first word", hello, std::string("hello")); | ||
444 | ensure_equals("second word", world, std::string("world")); | ||
445 | } | ||
446 | } | ||
447 | |||