15 #define GETTEXT_DOMAIN "wesnoth-test"
17 #include <boost/test/unit_test.hpp>
31 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
32 BOOST_CHECK(
output.has_child(
"text"));
33 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
34 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Hello World");
38 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
39 BOOST_CHECK(output.has_child("text"));
40 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
41 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"<not_a_tag>");
45 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
46 BOOST_CHECK(
output.has_child(
"text"));
47 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
48 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Me & You");
52 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
53 BOOST_CHECK(
output.has_child(
"text"));
54 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
55 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"\u00c6");
59 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
60 BOOST_CHECK(
output.has_child(
"text"));
61 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
62 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"\u00c6");
66 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
67 BOOST_CHECK(
output.has_child(
"text"));
68 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
69 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"\u16a0");
73 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
74 BOOST_CHECK(
output.has_child(
"text"));
75 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
76 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"\u16a0");
80 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
81 BOOST_CHECK(
output.has_child(
"text"));
82 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
83 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"\U0001f607");
87 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
88 BOOST_CHECK(
output.has_child(
"text"));
89 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
90 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"\U0001f607");
94 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
95 BOOST_CHECK(
output.has_child(
"text"));
96 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
97 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Line One\nLine Two");
101 BOOST_CHECK_EQUAL(
output.all_children_count(), 2);
102 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 2);
103 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
104 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Paragraph One");
105 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
"Paragraph Two");
111 BOOST_CHECK_EQUAL(
output.all_children_count(), 3);
112 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 2);
113 BOOST_CHECK(
output.has_child(
"character_entity"));
114 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"character_entity"), 1);
115 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
116 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"This ");
117 BOOST_CHECK(
output.mandatory_child(
"text", 1).has_attribute(
"text"));
118 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
" is unknown!");
119 BOOST_CHECK(
output.mandatory_child(
"character_entity").has_attribute(
"name"));
120 BOOST_CHECK_EQUAL(
output.mandatory_child(
"character_entity")[
"name"],
"entity");
124 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
125 BOOST_CHECK(output.has_child("text"));
126 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
127 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"], R
"==(Ending with backslash\)==");
131 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
132 BOOST_CHECK(output.has_child("text"));
133 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
134 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"], R
"==(Backslash\in middle)==");
138 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
139 BOOST_CHECK(output.has_child("text"));
140 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
141 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"This is pointless");
145 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
146 BOOST_CHECK(
output.has_child(
"text"));
147 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
148 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"], R
"==("<tag attr='val'>")==");
159 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
160 BOOST_CHECK(
output.has_child(
"tt"));
161 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
162 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
166 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
167 BOOST_CHECK(
output.has_child(
"tt"));
168 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
169 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
173 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
174 BOOST_CHECK(
output.has_child(
"tt"));
175 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
176 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
177 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
178 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
182 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
183 BOOST_CHECK(
output.has_child(
"tt"));
184 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
185 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
186 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
187 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
191 BOOST_CHECK_EQUAL(
output.all_children_count(), 3);
192 BOOST_CHECK(
output.has_child(
"tt"));
193 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 2);
194 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"tt"), 1);
195 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
196 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
197 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
198 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
199 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
200 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Here we have ");
201 BOOST_CHECK(
output.mandatory_child(
"text", 1).has_attribute(
"text"));
202 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
" with an unknown style applied!");
206 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
207 BOOST_CHECK(
output.has_child(
"tt"));
208 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
209 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
213 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
214 BOOST_CHECK(
output.has_child(
"tt"));
215 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
216 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"!@#$%^");
220 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
221 BOOST_CHECK(
output.has_child(
"tt"));
222 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
223 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value with spaces");
227 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
228 BOOST_CHECK(output.has_child("tt"));
229 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
230 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value with spaces");
234 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
235 BOOST_CHECK(
output.has_child(
"tt"));
236 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
237 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"O'Brien");
241 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
242 BOOST_CHECK(output.has_child("tt"));
243 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
244 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"'tis futile");
248 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
249 BOOST_CHECK(output.has_child("tt"));
250 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
251 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"], R
"==(the "mega" test)==");
255 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
256 BOOST_CHECK(
output.has_child(
"tt"));
257 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
258 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
262 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
263 BOOST_CHECK(
output.has_child(
"tt"));
264 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
265 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
266 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"that"));
267 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"that"],
"this");
271 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
272 BOOST_CHECK(output.has_child("tt"));
273 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
274 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"Let's go?");
278 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
279 BOOST_CHECK(
output.has_child(
"tt"));
280 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
281 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"'tis good");
285 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
286 BOOST_CHECK(
output.has_child(
"tt"));
287 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
288 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"Line 1\nLine 2");
292 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
293 BOOST_CHECK(output.has_child("tt"));
294 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
295 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"], R
"==("Yes!")==");
306 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
307 BOOST_CHECK(
output.has_child(
"tt"));
308 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
309 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
313 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
314 BOOST_CHECK(
output.has_child(
"tt"));
315 BOOST_CHECK(!
output.mandatory_child(
"tt").has_attribute(
"text"));
319 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
320 BOOST_CHECK(
output.has_child(
"tt"));
321 BOOST_CHECK(!
output.mandatory_child(
"tt").has_attribute(
"text"));
325 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
326 BOOST_CHECK(
output.has_child(
"tt"));
327 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
328 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
329 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
330 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
334 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
335 BOOST_CHECK(
output.has_child(
"tt"));
336 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
337 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
338 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
339 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"");
343 BOOST_CHECK_EQUAL(
output.all_children_count(), 3);
344 BOOST_CHECK(
output.has_child(
"tt"));
345 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 2);
346 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"tt"), 1);
347 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"text"));
348 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"text"],
"some text");
349 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
350 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
351 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
352 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Here we have ");
353 BOOST_CHECK(
output.mandatory_child(
"text", 1).has_attribute(
"text"));
354 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
" with an unknown style applied!");
358 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
359 BOOST_CHECK(
output.has_child(
"tt"));
360 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
361 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
365 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
366 BOOST_CHECK(
output.has_child(
"tt"));
367 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
368 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"!@#$%^");
372 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
373 BOOST_CHECK(
output.has_child(
"tt"));
374 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
375 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value with spaces");
379 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
380 BOOST_CHECK(output.has_child("tt"));
381 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
382 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value with spaces");
386 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
387 BOOST_CHECK(
output.has_child(
"tt"));
388 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
389 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"O'Brien");
393 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
394 BOOST_CHECK(output.has_child("tt"));
395 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
396 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"'tis futile");
400 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
401 BOOST_CHECK(output.has_child("tt"));
402 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
403 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"], R
"==(the "mega" test)==");
407 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
408 BOOST_CHECK(
output.has_child(
"tt"));
409 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
410 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
414 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
415 BOOST_CHECK(
output.has_child(
"tt"));
416 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
417 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"value");
418 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"that"));
419 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"that"],
"this");
423 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
424 BOOST_CHECK(output.has_child("tt"));
425 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
426 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"Let's go?");
430 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
431 BOOST_CHECK(
output.has_child(
"tt"));
432 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
433 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"'tis good");
437 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
438 BOOST_CHECK(
output.has_child(
"tt"));
439 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
440 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"],
"Line 1\nLine 2");
444 BOOST_CHECK_EQUAL(output.all_children_count(), 1);
445 BOOST_CHECK(output.has_child("tt"));
446 BOOST_CHECK(
output.mandatory_child(
"tt").has_attribute(
"attr"));
447 BOOST_CHECK_EQUAL(
output.mandatory_child(
"tt")[
"attr"], R
"==("Yes!")==");
451 BOOST_CHECK_EQUAL(
output.all_children_count(), 1);
452 BOOST_CHECK(
output.has_child(
"tt"));
455 BOOST_CHECK(
output.has_child(
"character_entity"));
456 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 2);
457 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"character_entity"), 1);
458 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
459 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"what ");
460 BOOST_CHECK(
output.mandatory_child(
"text", 1).has_attribute(
"text"));
461 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
" no");
462 BOOST_CHECK(
output.mandatory_child(
"character_entity").has_attribute(
"name"));
463 BOOST_CHECK_EQUAL(
output.mandatory_child(
"character_entity")[
"name"],
"ndash");
467 BOOST_CHECK_EQUAL(
output.all_children_count(), 3);
468 BOOST_CHECK(
output.has_child(
"tt"));
469 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 2);
470 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"tt"), 1);
471 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
472 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"We like to ");
473 BOOST_CHECK(
output.mandatory_child(
"text", 1).has_attribute(
"text"));
474 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
" each other!");
477 BOOST_CHECK_EQUAL(
output.all_children_count(), 5);
478 BOOST_CHECK(
output.has_child(
"abc"));
479 BOOST_CHECK(
output.has_child(
"def"));
480 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 3);
481 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"abc"), 1);
482 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"def"), 3);
483 BOOST_CHECK(
output.mandatory_child(
"text").has_attribute(
"text"));
484 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"nest ");
485 BOOST_CHECK(
output.mandatory_child(
"abc").has_attribute(
"text"));
486 BOOST_CHECK_EQUAL(
output.mandatory_child(
"abc")[
"text"],
"various");
487 BOOST_CHECK(
output.mandatory_child(
"text", 1).has_attribute(
"text"));
488 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
" ");
489 BOOST_CHECK(
output.mandatory_child(
"def").has_attribute(
"text"));
490 BOOST_CHECK_EQUAL(
output.mandatory_child(
"def")[
"text"],
"tags");
491 BOOST_CHECK(
output.mandatory_child(
"text", 2).has_attribute(
"text"));
492 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 2)[
"text"],
" within");
496 BOOST_CHECK_EQUAL(
output.all_children_count(), 2);
497 BOOST_CHECK_EQUAL(
output.child_count(
"img"), 2);
498 BOOST_CHECK(
output.mandatory_child(
"img").has_attribute(
"src"));
499 BOOST_CHECK_EQUAL(
output.mandatory_child(
"img")[
"src"],
"help/orb-green.png");
500 BOOST_CHECK(
output.mandatory_child(
"img").has_attribute(
"align"));
501 BOOST_CHECK_EQUAL(
output.mandatory_child(
"img")[
"align"],
"here");
502 BOOST_CHECK(
output.mandatory_child(
"img", 1).has_attribute(
"src"));
503 BOOST_CHECK_EQUAL(
output.mandatory_child(
"img", 1)[
"src"],
"help/orb-green.png");
504 BOOST_CHECK(
output.mandatory_child(
"img", 1).has_attribute(
"align"));
505 BOOST_CHECK_EQUAL(
output.mandatory_child(
"img", 1)[
"align"],
"there");
509 BOOST_CHECK_EQUAL(
output.all_children_count(), 3);
510 BOOST_CHECK(
output.has_child(
"text"));
511 BOOST_CHECK_EQUAL(
output.child_count(
"link"), 2);
512 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"text"), 1);
513 BOOST_CHECK(
output.mandatory_child(
"link").has_attribute(
"dst"));
514 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link")[
"dst"],
"foo");
515 BOOST_CHECK(
output.mandatory_child(
"link").has_attribute(
"text"));
516 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link")[
"text"],
"First");
517 BOOST_CHECK((
output.mandatory_child(
"text").has_attribute(
"text")));
518 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"\n");
519 BOOST_CHECK(
output.mandatory_child(
"link", 1).has_attribute(
"dst"));
520 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link", 1)[
"dst"],
"bar");
521 BOOST_CHECK(
output.mandatory_child(
"link", 1).has_attribute(
"text"));
522 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link", 1)[
"text"],
"Second");
526 BOOST_CHECK_EQUAL(
output.all_children_count(), 4);
527 BOOST_CHECK(
output.has_child(
"link"));
528 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 3);
529 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"link"), 1);
530 BOOST_CHECK(
output.mandatory_child(
"link").has_attribute(
"dst"));
531 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link")[
"dst"],
"details");
532 BOOST_CHECK(
output.mandatory_child(
"link").has_attribute(
"text"));
533 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link")[
"text"],
"Details");
534 BOOST_CHECK((
output.mandatory_child(
"text").has_attribute(
"text")));
535 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"See also: ");
536 BOOST_CHECK((
output.mandatory_child(
"text", 1).has_attribute(
"text")));
537 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
"");
538 BOOST_CHECK((
output.mandatory_child(
"text", 2).has_attribute(
"text")));
539 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 2)[
"text"],
"And here's an extra paragraph!");
543 BOOST_CHECK_EQUAL(
output.all_children_count(), 4);
544 BOOST_CHECK(
output.has_child(
"img"));
545 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 3);
546 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"img"), 2);
547 BOOST_CHECK(
output.mandatory_child(
"img").has_attribute(
"src"));
548 BOOST_CHECK_EQUAL(
output.mandatory_child(
"img")[
"src"],
"help/orb-red.png");
549 BOOST_CHECK((
output.mandatory_child(
"text").has_attribute(
"text")));
550 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"This is some information.");
551 BOOST_CHECK((
output.mandatory_child(
"text", 1).has_attribute(
"text")));
552 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
"");
553 BOOST_CHECK((
output.mandatory_child(
"text", 2).has_attribute(
"text")));
554 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 2)[
"text"],
"And some more info!");
558 BOOST_CHECK_EQUAL(
output.all_children_count(), 5);
559 BOOST_CHECK(
output.has_child(
"link"));
560 BOOST_CHECK(
output.has_child(
"img"));
561 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 3);
562 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"link"), 0);
563 BOOST_CHECK_EQUAL(
output.find_total_first_of(
"img"), 3);
564 BOOST_CHECK(
output.mandatory_child(
"link").has_attribute(
"dst"));
565 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link")[
"dst"],
"toc");
566 BOOST_CHECK(
output.mandatory_child(
"link").has_attribute(
"text"));
567 BOOST_CHECK_EQUAL(
output.mandatory_child(
"link")[
"text"],
"Table of Contents");
568 BOOST_CHECK(
output.mandatory_child(
"img").has_attribute(
"src"));
569 BOOST_CHECK_EQUAL(
output.mandatory_child(
"img")[
"src"],
"fancy-bullet.png");
570 BOOST_CHECK((
output.mandatory_child(
"text").has_attribute(
"text")));
571 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"");
572 BOOST_CHECK((
output.mandatory_child(
"text", 1).has_attribute(
"text")));
573 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
"");
574 BOOST_CHECK((
output.mandatory_child(
"text", 2).has_attribute(
"text")));
575 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 2)[
"text"],
"First...");
579 BOOST_CHECK_EQUAL(
output.all_children_count(), 2);
580 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 2);
581 BOOST_CHECK((
output.mandatory_child(
"text").has_attribute(
"text")));
582 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Let's have...");
583 BOOST_CHECK((
output.mandatory_child(
"text", 1).has_attribute(
"text")));
584 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
"\n...three consecutive newlines!");
588 BOOST_CHECK_EQUAL(
output.all_children_count(), 3);
589 BOOST_CHECK_EQUAL(
output.child_count(
"text"), 3);
590 BOOST_CHECK((
output.mandatory_child(
"text").has_attribute(
"text")));
591 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text")[
"text"],
"Let's have...");
592 BOOST_CHECK((
output.mandatory_child(
"text", 1).has_attribute(
"text")));
593 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 1)[
"text"],
"");
594 BOOST_CHECK((
output.mandatory_child(
"text", 2).has_attribute(
"text")));
595 BOOST_CHECK_EQUAL(
output.mandatory_child(
"text", 2)[
"text"],
"...four consecutive newlines!");
598 BOOST_AUTO_TEST_SUITE_END()
A config object defines a single node in a WML file, with access to child nodes.
Definitions for the interface to Wesnoth Markup Language (WML).
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)