15 #define GETTEXT_DOMAIN "wesnoth-test"
17 #include <boost/test/unit_test.hpp>
30 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
31 BOOST_CHECK(
output.has_child(
"text"));
32 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
33 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Hello World");
37 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
38 BOOST_CHECK(output.has_child("text"));
39 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
40 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"<not_a_tag>");
44 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
45 BOOST_CHECK(
output.has_child(
"text"));
46 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
47 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Me & You");
51 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
52 BOOST_CHECK(
output.has_child(
"text"));
53 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
54 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"\u00c6");
58 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
59 BOOST_CHECK(
output.has_child(
"text"));
60 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
61 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"\u00c6");
65 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
66 BOOST_CHECK(
output.has_child(
"text"));
67 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
68 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"\u16a0");
72 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
73 BOOST_CHECK(
output.has_child(
"text"));
74 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
75 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"\u16a0");
79 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
80 BOOST_CHECK(
output.has_child(
"text"));
81 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
82 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"\U0001f607");
86 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
87 BOOST_CHECK(
output.has_child(
"text"));
88 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
89 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"\U0001f607");
93 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
94 BOOST_CHECK(
output.has_child(
"text"));
95 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
96 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Line One\nLine Two");
100 BOOST_CHECK_EQUAL(
output.all_children_count(), 2);
101 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 2);
102 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
103 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Paragraph One");
104 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
"Paragraph Two");
110 BOOST_CHECK_EQUAL(
output.all_children_count(), 3);
111 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 2);
112 BOOST_CHECK(
output.has_child(
"character_entity"));
113 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"character_entity"), 1);
114 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
115 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"This ");
116 BOOST_CHECK(
output.mandatory_child(
"text", 1).has_attribute(
"text"));
117 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
" is unknown!");
118 BOOST_CHECK(
output.mandatory_child(
"character_entity").has_attribute(
"name"));
119 BOOST_CHECK_EQUAL(
output.mandatory_child(
"character_entity")[
"name"],
"entity");
123 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
124 BOOST_CHECK(output.has_child("text"));
125 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
126 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"], R
"==(Ending with backslash\)==");
130 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
131 BOOST_CHECK(output.has_child("text"));
132 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
133 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"], R
"==(Backslash\in middle)==");
137 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
138 BOOST_CHECK(output.has_child("text"));
139 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
140 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"This is pointless");
144 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
145 BOOST_CHECK(
output.has_child(
"text"));
146 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
147 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"], R
"==("<tag attr='val'>")==");
158 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
159 BOOST_CHECK(
output.has_child(
"tt"));
160 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
161 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
165 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
166 BOOST_CHECK(
output.has_child(
"tt"));
167 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
168 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
172 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
173 BOOST_CHECK(
output.has_child(
"tt"));
174 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
175 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
176 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
177 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
181 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
182 BOOST_CHECK(
output.has_child(
"tt"));
183 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
184 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
185 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
186 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
190 BOOST_CHECK_EQUAL(
output.all_children_count(), 3);
191 BOOST_CHECK(
output.has_child(
"tt"));
192 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 2);
193 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"tt"), 1);
194 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
195 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
196 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
197 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
198 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
199 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Here we have ");
200 BOOST_CHECK(
output.mandatory_child(
"text", 1).has_attribute(
"text"));
201 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
" with an unknown style applied!");
205 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
206 BOOST_CHECK(
output.has_child(
"tt"));
207 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
208 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
212 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
213 BOOST_CHECK(
output.has_child(
"tt"));
214 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
215 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"!@#$%^");
219 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
220 BOOST_CHECK(
output.has_child(
"tt"));
221 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
222 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value with spaces");
226 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
227 BOOST_CHECK(output.has_child("tt"));
228 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
229 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value with spaces");
233 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
234 BOOST_CHECK(
output.has_child(
"tt"));
235 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
236 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"O'Brien");
240 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
241 BOOST_CHECK(output.has_child("tt"));
242 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
243 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"'tis futile");
247 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
248 BOOST_CHECK(output.has_child("tt"));
249 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
250 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"], R
"==(the "mega" test)==");
254 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
255 BOOST_CHECK(
output.has_child(
"tt"));
256 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
257 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
261 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
262 BOOST_CHECK(
output.has_child(
"tt"));
263 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
264 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
265 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"that"));
266 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"that"],
"this");
270 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
271 BOOST_CHECK(output.has_child("tt"));
272 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
273 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"Let's go?");
277 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
278 BOOST_CHECK(
output.has_child(
"tt"));
279 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
280 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"'tis good");
284 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
285 BOOST_CHECK(
output.has_child(
"tt"));
286 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
287 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"Line 1\nLine 2");
291 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
292 BOOST_CHECK(output.has_child("tt"));
293 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
294 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"], R
"==("Yes!")==");
305 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
306 BOOST_CHECK(
output.has_child(
"tt"));
307 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
308 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
312 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
313 BOOST_CHECK(
output.has_child(
"tt"));
314 BOOST_CHECK(!
output.mandatory_child(
"tt").has_attribute(
"text"));
318 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
319 BOOST_CHECK(
output.has_child(
"tt"));
320 BOOST_CHECK(!
output.mandatory_child(
"tt").has_attribute(
"text"));
324 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
325 BOOST_CHECK(
output.has_child(
"tt"));
326 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
327 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
328 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
329 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
333 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
334 BOOST_CHECK(
output.has_child(
"tt"));
335 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
336 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
337 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
338 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"");
342 BOOST_CHECK_EQUAL(
output.all_children_count(), 3);
343 BOOST_CHECK(
output.has_child(
"tt"));
344 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 2);
345 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"tt"), 1);
346 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
347 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
348 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
349 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
350 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
351 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Here we have ");
352 BOOST_CHECK(
output.mandatory_child(
"text", 1).has_attribute(
"text"));
353 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
" with an unknown style applied!");
357 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
358 BOOST_CHECK(
output.has_child(
"tt"));
359 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
360 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
364 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
365 BOOST_CHECK(
output.has_child(
"tt"));
366 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
367 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"!@#$%^");
371 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
372 BOOST_CHECK(
output.has_child(
"tt"));
373 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
374 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value with spaces");
378 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
379 BOOST_CHECK(output.has_child("tt"));
380 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
381 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value with spaces");
385 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
386 BOOST_CHECK(
output.has_child(
"tt"));
387 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
388 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"O'Brien");
392 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
393 BOOST_CHECK(output.has_child("tt"));
394 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
395 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"'tis futile");
399 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
400 BOOST_CHECK(output.has_child("tt"));
401 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
402 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"], R
"==(the "mega" test)==");
406 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
407 BOOST_CHECK(
output.has_child(
"tt"));
408 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
409 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
413 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
414 BOOST_CHECK(
output.has_child(
"tt"));
415 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
416 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
417 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"that"));
418 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"that"],
"this");
422 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
423 BOOST_CHECK(output.has_child("tt"));
424 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
425 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"Let's go?");
429 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
430 BOOST_CHECK(
output.has_child(
"tt"));
431 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
432 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"'tis good");
436 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
437 BOOST_CHECK(
output.has_child(
"tt"));
438 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
439 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"Line 1\nLine 2");
443 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
444 BOOST_CHECK(output.has_child("tt"));
445 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
446 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"], R
"==("Yes!")==");
450 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
451 BOOST_CHECK(
output.has_child(
"tt"));
454 BOOST_CHECK(
output.has_child(
"character_entity"));
455 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 2);
456 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"character_entity"), 1);
457 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
458 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"what ");
459 BOOST_CHECK(
output.mandatory_child(
"text", 1).has_attribute(
"text"));
460 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
" no");
461 BOOST_CHECK(
output.mandatory_child(
"character_entity").has_attribute(
"name"));
462 BOOST_CHECK_EQUAL(
output.mandatory_child(
"character_entity")[
"name"],
"ndash");
466 BOOST_CHECK_EQUAL(
output.all_children_count(), 3);
467 BOOST_CHECK(
output.has_child(
"tt"));
468 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 2);
469 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"tt"), 1);
470 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
471 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"We like to ");
472 BOOST_CHECK(
output.mandatory_child(
"text", 1).has_attribute(
"text"));
473 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
" each other!");
476 BOOST_CHECK_EQUAL(
output.all_children_count(), 5);
477 BOOST_CHECK(
output.has_child(
"abc"));
478 BOOST_CHECK(
output.has_child(
"def"));
479 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 3);
480 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"abc"), 1);
481 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"def"), 3);
482 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
483 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"nest ");
484 BOOST_CHECK(
output.mandatory_child(
"abc").has_attribute(
"text"));
485 BOOST_CHECK_EQUAL(
output.mandatory_child(
"abc")[
"text"],
"various");
486 BOOST_CHECK(
output.mandatory_child(
"text", 1).has_attribute(
"text"));
487 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
" ");
488 BOOST_CHECK(
output.mandatory_child(
"def").has_attribute(
"text"));
489 BOOST_CHECK_EQUAL(
output.mandatory_child(
"def")[
"text"],
"tags");
490 BOOST_CHECK(
output.mandatory_child(
"text", 2).has_attribute(
"text"));
491 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 2)[
"text"],
" within");
495 BOOST_CHECK_EQUAL(
output.all_children_count(), 2);
496 BOOST_CHECK_EQUAL(
output.child_count(
"img"), 2);
497 BOOST_CHECK(
output.mandatory_child(
"img").has_attribute(
"src"));
498 BOOST_CHECK_EQUAL(
output.mandatory_child(
"img")[
"src"],
"help/orb-green.png");
499 BOOST_CHECK(
output.mandatory_child(
"img").has_attribute(
"align"));
500 BOOST_CHECK_EQUAL(
output.mandatory_child(
"img")[
"align"],
"here");
501 BOOST_CHECK(
output.mandatory_child(
"img", 1).has_attribute(
"src"));
502 BOOST_CHECK_EQUAL(
output.mandatory_child(
"img", 1)[
"src"],
"help/orb-green.png");
503 BOOST_CHECK(
output.mandatory_child(
"img", 1).has_attribute(
"align"));
504 BOOST_CHECK_EQUAL(
output.mandatory_child(
"img", 1)[
"align"],
"there");
508 BOOST_CHECK_EQUAL(
output.all_children_count(), 3);
509 BOOST_CHECK(
output.has_child(
"text"));
510 BOOST_CHECK_EQUAL(
output.child_count(
"link"), 2);
511 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"text"), 1);
512 BOOST_CHECK(
output.mandatory_child(
"link").has_attribute(
"dst"));
513 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link")[
"dst"],
"foo");
514 BOOST_CHECK(
output.mandatory_child(
"link").has_attribute(
"text"));
515 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link")[
"text"],
"First");
516 BOOST_CHECK((
output.mandatory_child(
"text").has_attribute(
"text")));
517 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"\n");
518 BOOST_CHECK(
output.mandatory_child(
"link", 1).has_attribute(
"dst"));
519 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link", 1)[
"dst"],
"bar");
520 BOOST_CHECK(
output.mandatory_child(
"link", 1).has_attribute(
"text"));
521 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link", 1)[
"text"],
"Second");
525 BOOST_CHECK_EQUAL(
output.all_children_count(), 4);
526 BOOST_CHECK(
output.has_child(
"link"));
527 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 3);
528 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"link"), 1);
529 BOOST_CHECK(
output.mandatory_child(
"link").has_attribute(
"dst"));
530 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link")[
"dst"],
"details");
531 BOOST_CHECK(
output.mandatory_child(
"link").has_attribute(
"text"));
532 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link")[
"text"],
"Details");
533 BOOST_CHECK((
output.mandatory_child(
"text").has_attribute(
"text")));
534 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"See also: ");
535 BOOST_CHECK((
output.mandatory_child(
"text", 1).has_attribute(
"text")));
536 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
"");
537 BOOST_CHECK((
output.mandatory_child(
"text", 2).has_attribute(
"text")));
538 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 2)[
"text"],
"And here's an extra paragraph!");
542 BOOST_CHECK_EQUAL(
output.all_children_count(), 4);
543 BOOST_CHECK(
output.has_child(
"img"));
544 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 3);
545 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"img"), 2);
546 BOOST_CHECK(
output.mandatory_child(
"img").has_attribute(
"src"));
547 BOOST_CHECK_EQUAL(
output.mandatory_child(
"img")[
"src"],
"help/orb-red.png");
548 BOOST_CHECK((
output.mandatory_child(
"text").has_attribute(
"text")));
549 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"This is some information.");
550 BOOST_CHECK((
output.mandatory_child(
"text", 1).has_attribute(
"text")));
551 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
"");
552 BOOST_CHECK((
output.mandatory_child(
"text", 2).has_attribute(
"text")));
553 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 2)[
"text"],
"And some more info!");
557 BOOST_CHECK_EQUAL(
output.all_children_count(), 5);
558 BOOST_CHECK(
output.has_child(
"link"));
559 BOOST_CHECK(
output.has_child(
"img"));
560 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 3);
561 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"link"), 0);
562 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"img"), 3);
563 BOOST_CHECK(
output.mandatory_child(
"link").has_attribute(
"dst"));
564 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link")[
"dst"],
"toc");
565 BOOST_CHECK(
output.mandatory_child(
"link").has_attribute(
"text"));
566 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link")[
"text"],
"Table of Contents");
567 BOOST_CHECK(
output.mandatory_child(
"img").has_attribute(
"src"));
568 BOOST_CHECK_EQUAL(
output.mandatory_child(
"img")[
"src"],
"fancy-bullet.png");
569 BOOST_CHECK((
output.mandatory_child(
"text").has_attribute(
"text")));
570 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"");
571 BOOST_CHECK((
output.mandatory_child(
"text", 1).has_attribute(
"text")));
572 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
"");
573 BOOST_CHECK((
output.mandatory_child(
"text", 2).has_attribute(
"text")));
574 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 2)[
"text"],
"First...");
578 BOOST_CHECK_EQUAL(
output.all_children_count(), 2);
579 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 2);
580 BOOST_CHECK((
output.mandatory_child(
"text").has_attribute(
"text")));
581 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Let's have...");
582 BOOST_CHECK((
output.mandatory_child(
"text", 1).has_attribute(
"text")));
583 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
"\n...three consecutive newlines!");
587 BOOST_CHECK_EQUAL(
output.all_children_count(), 3);
588 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 3);
589 BOOST_CHECK((
output.mandatory_child(
"text").has_attribute(
"text")));
590 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Let's have...");
591 BOOST_CHECK((
output.mandatory_child(
"text", 1).has_attribute(
"text")));
592 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
"");
593 BOOST_CHECK((
output.mandatory_child(
"text", 2).has_attribute(
"text")));
594 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 2)[
"text"],
"...four consecutive newlines!");
597 BOOST_AUTO_TEST_SUITE_END()
A config object defines a single node in a WML file, with access to child nodes.
static std::ostream & output()
config parse_text(const std::string &text)
Parse a xml style marked up text string.
BOOST_AUTO_TEST_SUITE(filesystem)
BOOST_AUTO_TEST_CASE(test_simple_help_markup)