2 #include "yaml-cpp/yaml.h"
8 ////////////////////////////////////////////////////////////////////////////////////////////////////////
11 void SimpleScalar(YAML::Emitter
& out
, std::string
& desiredOutput
) {
12 out
<< "Hello, World!";
13 desiredOutput
= "Hello, World!";
16 void SimpleSeq(YAML::Emitter
& out
, std::string
& desiredOutput
) {
17 out
<< YAML::BeginSeq
;
23 desiredOutput
= "- eggs\n- bread\n- milk";
26 void SimpleFlowSeq(YAML::Emitter
& out
, std::string
& desiredOutput
) {
28 out
<< YAML::BeginSeq
;
34 desiredOutput
= "[Larry, Curly, Moe]";
37 void EmptyFlowSeq(YAML::Emitter
& out
, std::string
& desiredOutput
) {
39 out
<< YAML::BeginSeq
;
45 void NestedBlockSeq(YAML::Emitter
& out
, std::string
& desiredOutput
) {
46 out
<< YAML::BeginSeq
;
48 out
<< YAML::BeginSeq
<< "subitem 1" << "subitem 2" << YAML::EndSeq
;
51 desiredOutput
= "- item 1\n-\n - subitem 1\n - subitem 2";
54 void NestedFlowSeq(YAML::Emitter
& out
, std::string
& desiredOutput
) {
55 out
<< YAML::BeginSeq
;
57 out
<< YAML::Flow
<< YAML::BeginSeq
<< "two" << "three" << YAML::EndSeq
;
60 desiredOutput
= "- one\n- [two, three]";
63 void SimpleMap(YAML::Emitter
& out
, std::string
& desiredOutput
) {
64 out
<< YAML::BeginMap
;
65 out
<< YAML::Key
<< "name";
66 out
<< YAML::Value
<< "Ryan Braun";
67 out
<< YAML::Key
<< "position";
68 out
<< YAML::Value
<< "3B";
71 desiredOutput
= "name: Ryan Braun\nposition: 3B";
74 void SimpleFlowMap(YAML::Emitter
& out
, std::string
& desiredOutput
) {
76 out
<< YAML::BeginMap
;
77 out
<< YAML::Key
<< "shape";
78 out
<< YAML::Value
<< "square";
79 out
<< YAML::Key
<< "color";
80 out
<< YAML::Value
<< "blue";
83 desiredOutput
= "{shape: square, color: blue}";
86 void MapAndList(YAML::Emitter
& out
, std::string
& desiredOutput
) {
87 out
<< YAML::BeginMap
;
88 out
<< YAML::Key
<< "name";
89 out
<< YAML::Value
<< "Barack Obama";
90 out
<< YAML::Key
<< "children";
91 out
<< YAML::Value
<< YAML::BeginSeq
<< "Sasha" << "Malia" << YAML::EndSeq
;
94 desiredOutput
= "name: Barack Obama\nchildren:\n - Sasha\n - Malia";
97 void ListAndMap(YAML::Emitter
& out
, std::string
& desiredOutput
) {
98 out
<< YAML::BeginSeq
;
100 out
<< YAML::BeginMap
;
101 out
<< YAML::Key
<< "pens" << YAML::Value
<< 8;
102 out
<< YAML::Key
<< "pencils" << YAML::Value
<< 14;
107 desiredOutput
= "- item 1\n- pens: 8\n pencils: 14\n- item 2";
110 void NestedBlockMap(YAML::Emitter
& out
, std::string
& desiredOutput
) {
111 out
<< YAML::BeginMap
;
112 out
<< YAML::Key
<< "name";
113 out
<< YAML::Value
<< "Fred";
114 out
<< YAML::Key
<< "grades";
116 out
<< YAML::BeginMap
;
117 out
<< YAML::Key
<< "algebra" << YAML::Value
<< "A";
118 out
<< YAML::Key
<< "physics" << YAML::Value
<< "C+";
119 out
<< YAML::Key
<< "literature" << YAML::Value
<< "B";
123 desiredOutput
= "name: Fred\ngrades:\n algebra: A\n physics: C+\n literature: B";
126 void NestedFlowMap(YAML::Emitter
& out
, std::string
& desiredOutput
) {
128 out
<< YAML::BeginMap
;
129 out
<< YAML::Key
<< "name";
130 out
<< YAML::Value
<< "Fred";
131 out
<< YAML::Key
<< "grades";
133 out
<< YAML::BeginMap
;
134 out
<< YAML::Key
<< "algebra" << YAML::Value
<< "A";
135 out
<< YAML::Key
<< "physics" << YAML::Value
<< "C+";
136 out
<< YAML::Key
<< "literature" << YAML::Value
<< "B";
140 desiredOutput
= "{name: Fred, grades: {algebra: A, physics: C+, literature: B}}";
143 void MapListMix(YAML::Emitter
& out
, std::string
& desiredOutput
) {
144 out
<< YAML::BeginMap
;
145 out
<< YAML::Key
<< "name";
146 out
<< YAML::Value
<< "Bob";
147 out
<< YAML::Key
<< "position";
149 out
<< YAML::Flow
<< YAML::BeginSeq
<< 2 << 4 << YAML::EndSeq
;
150 out
<< YAML::Key
<< "invincible" << YAML::Value
<< YAML::OnOffBool
<< false;
153 desiredOutput
= "name: Bob\nposition: [2, 4]\ninvincible: off";
156 void SimpleLongKey(YAML::Emitter
& out
, std::string
& desiredOutput
)
158 out
<< YAML::LongKey
;
159 out
<< YAML::BeginMap
;
160 out
<< YAML::Key
<< "height";
161 out
<< YAML::Value
<< "5'9\"";
162 out
<< YAML::Key
<< "weight";
163 out
<< YAML::Value
<< 145;
166 desiredOutput
= "? height\n: 5'9\"\n? weight\n: 145";
169 void SingleLongKey(YAML::Emitter
& out
, std::string
& desiredOutput
)
171 out
<< YAML::BeginMap
;
172 out
<< YAML::Key
<< "age";
173 out
<< YAML::Value
<< "24";
174 out
<< YAML::LongKey
<< YAML::Key
<< "height";
175 out
<< YAML::Value
<< "5'9\"";
176 out
<< YAML::Key
<< "weight";
177 out
<< YAML::Value
<< 145;
180 desiredOutput
= "age: 24\n? height\n: 5'9\"\nweight: 145";
183 void ComplexLongKey(YAML::Emitter
& out
, std::string
& desiredOutput
)
185 out
<< YAML::LongKey
;
186 out
<< YAML::BeginMap
;
187 out
<< YAML::Key
<< YAML::BeginSeq
<< 1 << 3 << YAML::EndSeq
;
188 out
<< YAML::Value
<< "monster";
189 out
<< YAML::Key
<< YAML::Flow
<< YAML::BeginSeq
<< 2 << 0 << YAML::EndSeq
;
190 out
<< YAML::Value
<< "demon";
193 desiredOutput
= "?\n - 1\n - 3\n: monster\n? [2, 0]\n: demon";
196 void AutoLongKey(YAML::Emitter
& out
, std::string
& desiredOutput
)
198 out
<< YAML::BeginMap
;
199 out
<< YAML::Key
<< YAML::BeginSeq
<< 1 << 3 << YAML::EndSeq
;
200 out
<< YAML::Value
<< "monster";
201 out
<< YAML::Key
<< YAML::Flow
<< YAML::BeginSeq
<< 2 << 0 << YAML::EndSeq
;
202 out
<< YAML::Value
<< "demon";
203 out
<< YAML::Key
<< "the origin";
204 out
<< YAML::Value
<< "angel";
207 desiredOutput
= "?\n - 1\n - 3\n: monster\n? [2, 0]\n: demon\nthe origin: angel";
210 void ScalarFormat(YAML::Emitter
& out
, std::string
& desiredOutput
)
212 out
<< YAML::BeginSeq
;
213 out
<< "simple scalar";
214 out
<< YAML::SingleQuoted
<< "explicit single-quoted scalar";
215 out
<< YAML::DoubleQuoted
<< "explicit double-quoted scalar";
216 out
<< "auto-detected\ndouble-quoted scalar";
217 out
<< "a non-\"auto-detected\" double-quoted scalar";
218 out
<< YAML::Literal
<< "literal scalar\nthat may span\nmany, many\nlines and have \"whatever\" crazy\tsymbols that we like";
221 desiredOutput
= "- simple scalar\n- 'explicit single-quoted scalar'\n- \"explicit double-quoted scalar\"\n- \"auto-detected\\x0adouble-quoted scalar\"\n- a non-\"auto-detected\" double-quoted scalar\n- |\n literal scalar\n that may span\n many, many\n lines and have \"whatever\" crazy\tsymbols that we like";
224 void AutoLongKeyScalar(YAML::Emitter
& out
, std::string
& desiredOutput
)
226 out
<< YAML::BeginMap
;
227 out
<< YAML::Key
<< YAML::Literal
<< "multi-line\nscalar";
228 out
<< YAML::Value
<< "and its value";
231 desiredOutput
= "? |\n multi-line\n scalar\n: and its value";
234 void LongKeyFlowMap(YAML::Emitter
& out
, std::string
& desiredOutput
)
237 out
<< YAML::BeginMap
;
238 out
<< YAML::Key
<< "simple key";
239 out
<< YAML::Value
<< "and value";
240 out
<< YAML::LongKey
<< YAML::Key
<< "long key";
241 out
<< YAML::Value
<< "and its value";
244 desiredOutput
= "{simple key: and value, ? long key: and its value}";
247 void BlockMapAsKey(YAML::Emitter
& out
, std::string
& desiredOutput
)
249 out
<< YAML::BeginMap
;
251 out
<< YAML::BeginMap
;
252 out
<< YAML::Key
<< "key" << YAML::Value
<< "value";
253 out
<< YAML::Key
<< "next key" << YAML::Value
<< "next value";
256 out
<< "total value";
259 desiredOutput
= "?\n key: value\n next key: next value\n: total value";
262 void AliasAndAnchor(YAML::Emitter
& out
, std::string
& desiredOutput
)
264 out
<< YAML::BeginSeq
;
265 out
<< YAML::Anchor("fred");
266 out
<< YAML::BeginMap
;
267 out
<< YAML::Key
<< "name" << YAML::Value
<< "Fred";
268 out
<< YAML::Key
<< "age" << YAML::Value
<< 42;
270 out
<< YAML::Alias("fred");
273 desiredOutput
= "- &fred\n name: Fred\n age: 42\n- *fred";
276 void AliasAndAnchorWithNull(YAML::Emitter
& out
, std::string
& desiredOutput
)
278 out
<< YAML::BeginSeq
;
279 out
<< YAML::Anchor("fred") << YAML::Null
;
280 out
<< YAML::Alias("fred");
283 desiredOutput
= "- &fred ~\n- *fred";
286 void AliasAndAnchorInFlow(YAML::Emitter
& out
, std::string
& desiredOutput
)
288 out
<< YAML::Flow
<< YAML::BeginSeq
;
289 out
<< YAML::Anchor("fred");
290 out
<< YAML::BeginMap
;
291 out
<< YAML::Key
<< "name" << YAML::Value
<< "Fred";
292 out
<< YAML::Key
<< "age" << YAML::Value
<< 42;
294 out
<< YAML::Alias("fred");
297 desiredOutput
= "[&fred {name: Fred, age: 42}, *fred]";
300 void SimpleVerbatimTag(YAML::Emitter
& out
, std::string
& desiredOutput
)
302 out
<< YAML::VerbatimTag("!foo") << "bar";
304 desiredOutput
= "!<!foo> bar";
307 void VerbatimTagInBlockSeq(YAML::Emitter
& out
, std::string
& desiredOutput
)
309 out
<< YAML::BeginSeq
;
310 out
<< YAML::VerbatimTag("!foo") << "bar";
314 desiredOutput
= "- !<!foo> bar\n- baz";
317 void VerbatimTagInFlowSeq(YAML::Emitter
& out
, std::string
& desiredOutput
)
319 out
<< YAML::Flow
<< YAML::BeginSeq
;
320 out
<< YAML::VerbatimTag("!foo") << "bar";
324 desiredOutput
= "[!<!foo> bar, baz]";
327 void VerbatimTagInFlowSeqWithNull(YAML::Emitter
& out
, std::string
& desiredOutput
)
329 out
<< YAML::Flow
<< YAML::BeginSeq
;
330 out
<< YAML::VerbatimTag("!foo") << YAML::Null
;
334 desiredOutput
= "[!<!foo> ~, baz]";
337 void VerbatimTagInBlockMap(YAML::Emitter
& out
, std::string
& desiredOutput
)
339 out
<< YAML::BeginMap
;
340 out
<< YAML::Key
<< YAML::VerbatimTag("!foo") << "bar";
341 out
<< YAML::Value
<< YAML::VerbatimTag("!waz") << "baz";
344 desiredOutput
= "!<!foo> bar: !<!waz> baz";
347 void VerbatimTagInFlowMap(YAML::Emitter
& out
, std::string
& desiredOutput
)
349 out
<< YAML::Flow
<< YAML::BeginMap
;
350 out
<< YAML::Key
<< YAML::VerbatimTag("!foo") << "bar";
351 out
<< YAML::Value
<< "baz";
354 desiredOutput
= "{!<!foo> bar: baz}";
357 void VerbatimTagInFlowMapWithNull(YAML::Emitter
& out
, std::string
& desiredOutput
)
359 out
<< YAML::Flow
<< YAML::BeginMap
;
360 out
<< YAML::Key
<< YAML::VerbatimTag("!foo") << YAML::Null
;
361 out
<< YAML::Value
<< "baz";
364 desiredOutput
= "{!<!foo> ~: baz}";
367 void VerbatimTagWithEmptySeq(YAML::Emitter
& out
, std::string
& desiredOutput
)
369 out
<< YAML::VerbatimTag("!foo") << YAML::BeginSeq
<< YAML::EndSeq
;
371 desiredOutput
= "!<!foo>\n[]";
374 void VerbatimTagWithEmptyMap(YAML::Emitter
& out
, std::string
& desiredOutput
)
376 out
<< YAML::VerbatimTag("!bar") << YAML::BeginMap
<< YAML::EndMap
;
378 desiredOutput
= "!<!bar>\n{}";
381 void VerbatimTagWithEmptySeqAndMap(YAML::Emitter
& out
, std::string
& desiredOutput
)
383 out
<< YAML::BeginSeq
;
384 out
<< YAML::VerbatimTag("!foo") << YAML::BeginSeq
<< YAML::EndSeq
;
385 out
<< YAML::VerbatimTag("!bar") << YAML::BeginMap
<< YAML::EndMap
;
388 desiredOutput
= "- !<!foo>\n []\n- !<!bar>\n {}";
391 void ByKindTagWithScalar(YAML::Emitter
& out
, std::string
& desiredOutput
)
393 out
<< YAML::BeginSeq
;
394 out
<< YAML::DoubleQuoted
<< "12";
396 out
<< YAML::TagByKind
<< "12";
399 desiredOutput
= "- \"12\"\n- 12\n- ! 12";
402 void LocalTagWithScalar(YAML::Emitter
& out
, std::string
& desiredOutput
)
404 out
<< YAML::LocalTag("foo") << "bar";
406 desiredOutput
= "!foo bar";
409 void BadLocalTag(YAML::Emitter
& out
, std::string
& desiredError
)
411 out
<< YAML::LocalTag("e!far") << "bar";
413 desiredError
= "invalid tag";
416 void ComplexDoc(YAML::Emitter
& out
, std::string
& desiredOutput
)
418 out
<< YAML::BeginMap
;
419 out
<< YAML::Key
<< "receipt";
420 out
<< YAML::Value
<< "Oz-Ware Purchase Invoice";
421 out
<< YAML::Key
<< "date";
422 out
<< YAML::Value
<< "2007-08-06";
423 out
<< YAML::Key
<< "customer";
425 out
<< YAML::BeginMap
;
426 out
<< YAML::Key
<< "given";
427 out
<< YAML::Value
<< "Dorothy";
428 out
<< YAML::Key
<< "family";
429 out
<< YAML::Value
<< "Gale";
431 out
<< YAML::Key
<< "items";
433 out
<< YAML::BeginSeq
;
434 out
<< YAML::BeginMap
;
435 out
<< YAML::Key
<< "part_no";
436 out
<< YAML::Value
<< "A4786";
437 out
<< YAML::Key
<< "descrip";
438 out
<< YAML::Value
<< "Water Bucket (Filled)";
439 out
<< YAML::Key
<< "price";
440 out
<< YAML::Value
<< 1.47;
441 out
<< YAML::Key
<< "quantity";
442 out
<< YAML::Value
<< 4;
444 out
<< YAML::BeginMap
;
445 out
<< YAML::Key
<< "part_no";
446 out
<< YAML::Value
<< "E1628";
447 out
<< YAML::Key
<< "descrip";
448 out
<< YAML::Value
<< "High Heeled \"Ruby\" Slippers";
449 out
<< YAML::Key
<< "price";
450 out
<< YAML::Value
<< 100.27;
451 out
<< YAML::Key
<< "quantity";
452 out
<< YAML::Value
<< 1;
455 out
<< YAML::Key
<< "bill-to";
456 out
<< YAML::Value
<< YAML::Anchor("id001");
457 out
<< YAML::BeginMap
;
458 out
<< YAML::Key
<< "street";
459 out
<< YAML::Value
<< YAML::Literal
<< "123 Tornado Alley\nSuite 16";
460 out
<< YAML::Key
<< "city";
461 out
<< YAML::Value
<< "East Westville";
462 out
<< YAML::Key
<< "state";
463 out
<< YAML::Value
<< "KS";
465 out
<< YAML::Key
<< "ship-to";
466 out
<< YAML::Value
<< YAML::Alias("id001");
469 desiredOutput
= "receipt: Oz-Ware Purchase Invoice\ndate: 2007-08-06\ncustomer:\n given: Dorothy\n family: Gale\nitems:\n - part_no: A4786\n descrip: Water Bucket (Filled)\n price: 1.47\n quantity: 4\n - part_no: E1628\n descrip: High Heeled \"Ruby\" Slippers\n price: 100.27\n quantity: 1\nbill-to: &id001\n street: |\n 123 Tornado Alley\n Suite 16\n city: East Westville\n state: KS\nship-to: *id001";
472 void STLContainers(YAML::Emitter
& out
, std::string
& desiredOutput
)
474 out
<< YAML::BeginSeq
;
475 std::vector
<int> primes
;
480 primes
.push_back(11);
481 primes
.push_back(13);
482 out
<< YAML::Flow
<< primes
;
483 std::map
<std::string
, int> ages
;
489 desiredOutput
= "- [2, 3, 5, 7, 11, 13]\n- Daniel: 26\n Jesse: 24";
492 void SimpleComment(YAML::Emitter
& out
, std::string
& desiredOutput
)
494 out
<< YAML::BeginMap
;
495 out
<< YAML::Key
<< "method";
496 out
<< YAML::Value
<< "least squares" << YAML::Comment("should we change this method?");
499 desiredOutput
= "method: least squares # should we change this method?";
502 void MultiLineComment(YAML::Emitter
& out
, std::string
& desiredOutput
)
504 out
<< YAML::BeginSeq
;
505 out
<< "item 1" << YAML::Comment("really really long\ncomment that couldn't possibly\nfit on one line");
509 desiredOutput
= "- item 1 # really really long\n # comment that couldn't possibly\n # fit on one line\n- item 2";
512 void ComplexComments(YAML::Emitter
& out
, std::string
& desiredOutput
)
514 out
<< YAML::BeginMap
;
515 out
<< YAML::LongKey
<< YAML::Key
<< "long key" << YAML::Comment("long key");
516 out
<< YAML::Value
<< "value";
519 desiredOutput
= "? long key # long key\n: value";
522 void InitialComment(YAML::Emitter
& out
, std::string
& desiredOutput
)
524 out
<< YAML::Comment("A comment describing the purpose of the file.");
525 out
<< YAML::BeginMap
<< YAML::Key
<< "key" << YAML::Value
<< "value" << YAML::EndMap
;
527 desiredOutput
= "# A comment describing the purpose of the file.\nkey: value";
530 void InitialCommentWithDocIndicator(YAML::Emitter
& out
, std::string
& desiredOutput
)
532 out
<< YAML::BeginDoc
<< YAML::Comment("A comment describing the purpose of the file.");
533 out
<< YAML::BeginMap
<< YAML::Key
<< "key" << YAML::Value
<< "value" << YAML::EndMap
;
535 desiredOutput
= "---\n# A comment describing the purpose of the file.\nkey: value";
538 void CommentInFlowSeq(YAML::Emitter
& out
, std::string
& desiredOutput
)
540 out
<< YAML::Flow
<< YAML::BeginSeq
<< "foo" << YAML::Comment("foo!") << "bar" << YAML::EndSeq
;
542 desiredOutput
= "[foo # foo!\n, bar]";
545 void CommentInFlowMap(YAML::Emitter
& out
, std::string
& desiredOutput
)
547 out
<< YAML::Flow
<< YAML::BeginMap
;
548 out
<< YAML::Key
<< "foo" << YAML::Value
<< "foo value";
549 out
<< YAML::Key
<< "bar" << YAML::Value
<< "bar value" << YAML::Comment("bar!");
550 out
<< YAML::Key
<< "baz" << YAML::Value
<< "baz value" << YAML::Comment("baz!");
553 desiredOutput
= "{foo: foo value, bar: bar value # bar!\n, baz: baz value # baz!\n}";
556 void Indentation(YAML::Emitter
& out
, std::string
& desiredOutput
)
558 out
<< YAML::Indent(4);
559 out
<< YAML::BeginSeq
;
560 out
<< YAML::BeginMap
;
561 out
<< YAML::Key
<< "key 1" << YAML::Value
<< "value 1";
562 out
<< YAML::Key
<< "key 2" << YAML::Value
<< YAML::BeginSeq
<< "a" << "b" << "c" << YAML::EndSeq
;
566 desiredOutput
= "- key 1: value 1\n key 2:\n - a\n - b\n - c";
569 void SimpleGlobalSettings(YAML::Emitter
& out
, std::string
& desiredOutput
)
572 out
.SetMapFormat(YAML::LongKey
);
574 out
<< YAML::BeginSeq
;
575 out
<< YAML::BeginMap
;
576 out
<< YAML::Key
<< "key 1" << YAML::Value
<< "value 1";
577 out
<< YAML::Key
<< "key 2" << YAML::Value
<< YAML::Flow
<< YAML::BeginSeq
<< "a" << "b" << "c" << YAML::EndSeq
;
581 desiredOutput
= "- ? key 1\n : value 1\n ? key 2\n : [a, b, c]";
584 void ComplexGlobalSettings(YAML::Emitter
& out
, std::string
& desiredOutput
)
586 out
<< YAML::BeginSeq
;
588 out
<< YAML::BeginMap
;
589 out
<< YAML::Key
<< "key 1" << YAML::Value
<< "value 1";
590 out
<< YAML::Key
<< "key 2" << YAML::Value
;
591 out
.SetSeqFormat(YAML::Flow
);
592 out
<< YAML::BeginSeq
<< "a" << "b" << "c" << YAML::EndSeq
;
594 out
<< YAML::BeginMap
;
595 out
<< YAML::Key
<< YAML::BeginSeq
<< 1 << 2 << YAML::EndSeq
;
596 out
<< YAML::Value
<< YAML::BeginMap
<< YAML::Key
<< "a" << YAML::Value
<< "b" << YAML::EndMap
;
600 desiredOutput
= "- key 1: value 1\n key 2: [a, b, c]\n- ? [1, 2]\n :\n a: b";
603 void Null(YAML::Emitter
& out
, std::string
& desiredOutput
)
605 out
<< YAML::BeginSeq
;
607 out
<< YAML::BeginMap
;
608 out
<< YAML::Key
<< "null value" << YAML::Value
<< YAML::Null
;
609 out
<< YAML::Key
<< YAML::Null
<< YAML::Value
<< "null key";
613 desiredOutput
= "- ~\n- null value: ~\n ~: null key";
616 void EscapedUnicode(YAML::Emitter
& out
, std::string
& desiredOutput
)
618 out
<< YAML::EscapeNonAscii
<< "\x24 \xC2\xA2 \xE2\x82\xAC \xF0\xA4\xAD\xA2";
620 desiredOutput
= "\"$ \\xa2 \\u20ac \\U00024b62\"";
623 void Unicode(YAML::Emitter
& out
, std::string
& desiredOutput
)
625 out
<< "\x24 \xC2\xA2 \xE2\x82\xAC \xF0\xA4\xAD\xA2";
626 desiredOutput
= "\x24 \xC2\xA2 \xE2\x82\xAC \xF0\xA4\xAD\xA2";
629 void DoubleQuotedUnicode(YAML::Emitter
& out
, std::string
& desiredOutput
)
631 out
<< YAML::DoubleQuoted
<< "\x24 \xC2\xA2 \xE2\x82\xAC \xF0\xA4\xAD\xA2";
632 desiredOutput
= "\"\x24 \xC2\xA2 \xE2\x82\xAC \xF0\xA4\xAD\xA2\"";
637 Foo(int x_
, const std::string
& bar_
): x(x_
), bar(bar_
) {}
643 YAML::Emitter
& operator << (YAML::Emitter
& out
, const Foo
& foo
) {
644 out
<< YAML::BeginMap
;
645 out
<< YAML::Key
<< "x" << YAML::Value
<< foo
.x
;
646 out
<< YAML::Key
<< "bar" << YAML::Value
<< foo
.bar
;
651 void UserType(YAML::Emitter
& out
, std::string
& desiredOutput
)
653 out
<< YAML::BeginSeq
;
654 out
<< Foo(5, "hello");
655 out
<< Foo(3, "goodbye");
658 desiredOutput
= "- x: 5\n bar: hello\n- x: 3\n bar: goodbye";
661 void UserTypeInContainer(YAML::Emitter
& out
, std::string
& desiredOutput
)
664 fv
.push_back(Foo(5, "hello"));
665 fv
.push_back(Foo(3, "goodbye"));
668 desiredOutput
= "- x: 5\n bar: hello\n- x: 3\n bar: goodbye";
671 template <typename T
>
672 YAML::Emitter
& operator << (YAML::Emitter
& out
, const T
*v
) {
680 void PointerToInt(YAML::Emitter
& out
, std::string
& desiredOutput
)
685 out
<< YAML::BeginSeq
;
689 desiredOutput
= "- 5\n- ~";
692 void PointerToUserType(YAML::Emitter
& out
, std::string
& desiredOutput
)
697 out
<< YAML::BeginSeq
;
701 desiredOutput
= "- x: 5\n bar: hello\n- ~";
704 void NewlineAtEnd(YAML::Emitter
& out
, std::string
& desiredOutput
)
706 out
<< "Hello" << YAML::Newline
<< YAML::Newline
;
707 desiredOutput
= "Hello\n\n";
710 void NewlineInBlockSequence(YAML::Emitter
& out
, std::string
& desiredOutput
)
712 out
<< YAML::BeginSeq
;
713 out
<< "a" << YAML::Newline
<< "b" << "c" << YAML::Newline
<< "d";
715 desiredOutput
= "- a\n\n- b\n- c\n\n- d";
718 void NewlineInFlowSequence(YAML::Emitter
& out
, std::string
& desiredOutput
)
720 out
<< YAML::Flow
<< YAML::BeginSeq
;
721 out
<< "a" << YAML::Newline
<< "b" << "c" << YAML::Newline
<< "d";
723 desiredOutput
= "[a\n, b, c\n, d]";
726 void NewlineInBlockMap(YAML::Emitter
& out
, std::string
& desiredOutput
)
728 out
<< YAML::BeginMap
;
729 out
<< YAML::Key
<< "a" << YAML::Value
<< "foo" << YAML::Newline
;
730 out
<< YAML::Key
<< "b" << YAML::Newline
<< YAML::Value
<< "bar";
731 out
<< YAML::LongKey
<< YAML::Key
<< "c" << YAML::Newline
<< YAML::Value
<< "car";
733 desiredOutput
= "a: foo\n\nb: bar\n? c\n\n: car";
736 void NewlineInFlowMap(YAML::Emitter
& out
, std::string
& desiredOutput
)
738 out
<< YAML::Flow
<< YAML::BeginMap
;
739 out
<< YAML::Key
<< "a" << YAML::Value
<< "foo" << YAML::Newline
;
740 out
<< YAML::Key
<< "b" << YAML::Value
<< "bar";
742 desiredOutput
= "{a: foo\n, b: bar}";
745 void LotsOfNewlines(YAML::Emitter
& out
, std::string
& desiredOutput
)
747 out
<< YAML::BeginSeq
;
748 out
<< "a" << YAML::Newline
;
749 out
<< YAML::BeginSeq
;
750 out
<< "b" << "c" << YAML::Newline
;
752 out
<< YAML::Newline
;
753 out
<< YAML::BeginMap
;
754 out
<< YAML::Newline
<< YAML::Key
<< "d" << YAML::Value
<< YAML::Newline
<< "e";
755 out
<< YAML::LongKey
<< YAML::Key
<< "f" << YAML::Newline
<< YAML::Value
<< "foo";
758 desiredOutput
= "- a\n\n-\n - b\n - c\n\n\n-\n d: e\n ? f\n\n : foo";
761 void Binary(YAML::Emitter
& out
, std::string
& desiredOutput
)
763 out
<< YAML::Binary(reinterpret_cast<const unsigned char*>("Hello, World!"), 13);
764 desiredOutput
= "!!binary \"SGVsbG8sIFdvcmxkIQ==\"";
767 void LongBinary(YAML::Emitter
& out
, std::string
& desiredOutput
)
769 out
<< YAML::Binary(reinterpret_cast<const unsigned char*>("Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.\n"), 270);
770 desiredOutput
= "!!binary \"TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4K\"";
773 void EmptyBinary(YAML::Emitter
& out
, std::string
& desiredOutput
)
775 out
<< YAML::Binary(reinterpret_cast<const unsigned char *>(""), 0);
776 desiredOutput
= "!!binary \"\"";
779 void ColonAtEndOfScalar(YAML::Emitter
& out
, std::string
& desiredOutput
)
782 desiredOutput
= "\"a:\"";
785 void ColonAsScalar(YAML::Emitter
& out
, std::string
& desiredOutput
)
787 out
<< YAML::BeginMap
;
788 out
<< YAML::Key
<< "apple" << YAML::Value
<< ":";
789 out
<< YAML::Key
<< "banana" << YAML::Value
<< ":";
791 desiredOutput
= "apple: \":\"\nbanana: \":\"";
794 void ColonAtEndOfScalarInFlow(YAML::Emitter
& out
, std::string
& desiredOutput
)
796 out
<< YAML::Flow
<< YAML::BeginMap
<< YAML::Key
<< "C:" << YAML::Value
<< "C:" << YAML::EndMap
;
797 desiredOutput
= "{\"C:\": \"C:\"}";
800 void BoolFormatting(YAML::Emitter
& out
, std::string
& desiredOutput
)
802 out
<< YAML::BeginSeq
;
803 out
<< YAML::TrueFalseBool
<< YAML::UpperCase
<< true;
804 out
<< YAML::TrueFalseBool
<< YAML::CamelCase
<< true;
805 out
<< YAML::TrueFalseBool
<< YAML::LowerCase
<< true;
806 out
<< YAML::TrueFalseBool
<< YAML::UpperCase
<< false;
807 out
<< YAML::TrueFalseBool
<< YAML::CamelCase
<< false;
808 out
<< YAML::TrueFalseBool
<< YAML::LowerCase
<< false;
809 out
<< YAML::YesNoBool
<< YAML::UpperCase
<< true;
810 out
<< YAML::YesNoBool
<< YAML::CamelCase
<< true;
811 out
<< YAML::YesNoBool
<< YAML::LowerCase
<< true;
812 out
<< YAML::YesNoBool
<< YAML::UpperCase
<< false;
813 out
<< YAML::YesNoBool
<< YAML::CamelCase
<< false;
814 out
<< YAML::YesNoBool
<< YAML::LowerCase
<< false;
815 out
<< YAML::OnOffBool
<< YAML::UpperCase
<< true;
816 out
<< YAML::OnOffBool
<< YAML::CamelCase
<< true;
817 out
<< YAML::OnOffBool
<< YAML::LowerCase
<< true;
818 out
<< YAML::OnOffBool
<< YAML::UpperCase
<< false;
819 out
<< YAML::OnOffBool
<< YAML::CamelCase
<< false;
820 out
<< YAML::OnOffBool
<< YAML::LowerCase
<< false;
821 out
<< YAML::ShortBool
<< YAML::UpperCase
<< true;
822 out
<< YAML::ShortBool
<< YAML::CamelCase
<< true;
823 out
<< YAML::ShortBool
<< YAML::LowerCase
<< true;
824 out
<< YAML::ShortBool
<< YAML::UpperCase
<< false;
825 out
<< YAML::ShortBool
<< YAML::CamelCase
<< false;
826 out
<< YAML::ShortBool
<< YAML::LowerCase
<< false;
829 "- TRUE\n- True\n- true\n- FALSE\n- False\n- false\n"
830 "- YES\n- Yes\n- yes\n- NO\n- No\n- no\n"
831 "- ON\n- On\n- on\n- OFF\n- Off\n- off\n"
832 "- Y\n- Y\n- y\n- N\n- N\n- n";
835 void DocStartAndEnd(YAML::Emitter
& out
, std::string
& desiredOutput
)
837 out
<< YAML::BeginDoc
;
838 out
<< YAML::BeginSeq
<< 1 << 2 << 3 << YAML::EndSeq
;
839 out
<< YAML::BeginDoc
;
844 out
<< YAML::BeginDoc
;
845 out
<< YAML::VerbatimTag("foo") << "bar";
846 desiredOutput
= "---\n- 1\n- 2\n- 3\n---\nHi there!\n...\n...\n...\n---\n!<foo> bar";
849 void ImplicitDocStart(YAML::Emitter
& out
, std::string
& desiredOutput
)
854 desiredOutput
= "Hi\n---\nBye\n---\nOops";
857 void EmptyString(YAML::Emitter
& out
, std::string
& desiredOutput
)
859 out
<< YAML::BeginMap
;
860 out
<< YAML::Key
<< "key" << YAML::Value
<< "";
862 desiredOutput
= "key: \"\"";
865 void SingleChar(YAML::Emitter
& out
, std::string
& desiredOutput
)
867 out
<< YAML::BeginSeq
;
875 desiredOutput
= "- a\n- \":\"\n- \"\\x10\"\n- \"\\n\"\n- \" \"\n- \"\\t\"";
878 void DefaultPrecision(YAML::Emitter
& out
, std::string
& desiredOutput
)
880 out
<< YAML::BeginSeq
;
882 out
<< 3.14159265358979;
884 desiredOutput
= "- 1.234\n- 3.14159265358979";
887 void SetPrecision(YAML::Emitter
& out
, std::string
& desiredOutput
)
889 out
<< YAML::BeginSeq
;
890 out
<< YAML::FloatPrecision(3) << 1.234f
;
891 out
<< YAML::DoublePrecision(6) << 3.14159265358979;
893 desiredOutput
= "- 1.23\n- 3.14159";
896 void DashInBlockContext(YAML::Emitter
& out
, std::string
& desiredOutput
)
898 out
<< YAML::BeginMap
;
899 out
<< YAML::Key
<< "key" << YAML::Value
<< "-";
901 desiredOutput
= "key: \"-\"";
904 void HexAndOct(YAML::Emitter
& out
, std::string
& desiredOutput
)
906 out
<< YAML::Flow
<< YAML::BeginSeq
;
908 out
<< YAML::Hex
<< 31;
909 out
<< YAML::Oct
<< 31;
911 desiredOutput
= "[31, 0x1f, 037]";
914 ////////////////////////////////////////////////////////////////////////////////////////////////////////
915 // incorrect emitting
917 void ExtraEndSeq(YAML::Emitter
& out
, std::string
& desiredError
)
919 desiredError
= YAML::ErrorMsg::UNEXPECTED_END_SEQ
;
921 out
<< YAML::BeginSeq
;
928 void ExtraEndMap(YAML::Emitter
& out
, std::string
& desiredError
)
930 desiredError
= YAML::ErrorMsg::UNEXPECTED_END_MAP
;
932 out
<< YAML::BeginMap
;
933 out
<< YAML::Key
<< "Hello" << YAML::Value
<< "World";
938 void BadSingleQuoted(YAML::Emitter
& out
, std::string
& desiredError
)
940 desiredError
= YAML::ErrorMsg::SINGLE_QUOTED_CHAR
;
942 out
<< YAML::SingleQuoted
<< "Hello\nWorld";
945 void InvalidAnchor(YAML::Emitter
& out
, std::string
& desiredError
)
947 desiredError
= YAML::ErrorMsg::INVALID_ANCHOR
;
949 out
<< YAML::BeginSeq
;
950 out
<< YAML::Anchor("new\nline") << "Test";
954 void InvalidAlias(YAML::Emitter
& out
, std::string
& desiredError
)
956 desiredError
= YAML::ErrorMsg::INVALID_ALIAS
;
958 out
<< YAML::BeginSeq
;
959 out
<< YAML::Alias("new\nline");
963 void MissingKey(YAML::Emitter
& out
, std::string
& desiredError
)
965 desiredError
= YAML::ErrorMsg::EXPECTED_KEY_TOKEN
;
967 out
<< YAML::BeginMap
;
968 out
<< YAML::Key
<< "key" << YAML::Value
<< "value";
969 out
<< "missing key" << YAML::Value
<< "value";
973 void MissingValue(YAML::Emitter
& out
, std::string
& desiredError
)
975 desiredError
= YAML::ErrorMsg::EXPECTED_VALUE_TOKEN
;
977 out
<< YAML::BeginMap
;
978 out
<< YAML::Key
<< "key" << "value";
982 void UnexpectedKey(YAML::Emitter
& out
, std::string
& desiredError
)
984 desiredError
= YAML::ErrorMsg::UNEXPECTED_KEY_TOKEN
;
986 out
<< YAML::BeginSeq
;
987 out
<< YAML::Key
<< "hi";
991 void UnexpectedValue(YAML::Emitter
& out
, std::string
& desiredError
)
993 desiredError
= YAML::ErrorMsg::UNEXPECTED_VALUE_TOKEN
;
995 out
<< YAML::BeginSeq
;
996 out
<< YAML::Value
<< "hi";
1002 void RunEmitterTest(void (*test
)(YAML::Emitter
&, std::string
&), const std::string
& name
, int& passed
, int& total
) {
1004 std::string desiredOutput
;
1005 test(out
, desiredOutput
);
1006 std::string output
= out
.c_str();
1007 std::string lastError
= out
.GetLastError();
1009 if(output
== desiredOutput
) {
1011 std::stringstream
stream(output
);
1012 YAML::Parser parser
;
1014 parser
.GetNextDocument(node
);
1016 } catch(const YAML::Exception
& e
) {
1017 std::cout
<< "Emitter test failed: " << name
<< "\n";
1018 std::cout
<< "Parsing output error: " << e
.what() << "\n";
1021 std::cout
<< "Emitter test failed: " << name
<< "\n";
1022 std::cout
<< "Output:\n";
1023 std::cout
<< output
<< "<<<\n";
1024 std::cout
<< "Desired output:\n";
1025 std::cout
<< desiredOutput
<< "<<<\n";
1027 std::cout
<< "Emitter error: " << lastError
<< "\n";
1032 void RunEmitterErrorTest(void (*test
)(YAML::Emitter
&, std::string
&), const std::string
& name
, int& passed
, int& total
) {
1034 std::string desiredError
;
1035 test(out
, desiredError
);
1036 std::string lastError
= out
.GetLastError();
1037 if(!out
.good() && lastError
== desiredError
) {
1040 std::cout
<< "Emitter test failed: " << name
<< "\n";
1042 std::cout
<< "No error detected\n";
1044 std::cout
<< "Detected error: " << lastError
<< "\n";
1045 std::cout
<< "Expected error: " << desiredError
<< "\n";
1051 bool RunEmitterTests()
1055 RunEmitterTest(&Emitter::SimpleScalar
, "simple scalar", passed
, total
);
1056 RunEmitterTest(&Emitter::SimpleSeq
, "simple seq", passed
, total
);
1057 RunEmitterTest(&Emitter::SimpleFlowSeq
, "simple flow seq", passed
, total
);
1058 RunEmitterTest(&Emitter::EmptyFlowSeq
, "empty flow seq", passed
, total
);
1059 RunEmitterTest(&Emitter::NestedBlockSeq
, "nested block seq", passed
, total
);
1060 RunEmitterTest(&Emitter::NestedFlowSeq
, "nested flow seq", passed
, total
);
1061 RunEmitterTest(&Emitter::SimpleMap
, "simple map", passed
, total
);
1062 RunEmitterTest(&Emitter::SimpleFlowMap
, "simple flow map", passed
, total
);
1063 RunEmitterTest(&Emitter::MapAndList
, "map and list", passed
, total
);
1064 RunEmitterTest(&Emitter::ListAndMap
, "list and map", passed
, total
);
1065 RunEmitterTest(&Emitter::NestedBlockMap
, "nested block map", passed
, total
);
1066 RunEmitterTest(&Emitter::NestedFlowMap
, "nested flow map", passed
, total
);
1067 RunEmitterTest(&Emitter::MapListMix
, "map list mix", passed
, total
);
1068 RunEmitterTest(&Emitter::SimpleLongKey
, "simple long key", passed
, total
);
1069 RunEmitterTest(&Emitter::SingleLongKey
, "single long key", passed
, total
);
1070 RunEmitterTest(&Emitter::ComplexLongKey
, "complex long key", passed
, total
);
1071 RunEmitterTest(&Emitter::AutoLongKey
, "auto long key", passed
, total
);
1072 RunEmitterTest(&Emitter::ScalarFormat
, "scalar format", passed
, total
);
1073 RunEmitterTest(&Emitter::AutoLongKeyScalar
, "auto long key scalar", passed
, total
);
1074 RunEmitterTest(&Emitter::LongKeyFlowMap
, "long key flow map", passed
, total
);
1075 RunEmitterTest(&Emitter::BlockMapAsKey
, "block map as key", passed
, total
);
1076 RunEmitterTest(&Emitter::AliasAndAnchor
, "alias and anchor", passed
, total
);
1077 RunEmitterTest(&Emitter::AliasAndAnchorWithNull
, "alias and anchor with null", passed
, total
);
1078 RunEmitterTest(&Emitter::AliasAndAnchorInFlow
, "alias and anchor in flow", passed
, total
);
1079 RunEmitterTest(&Emitter::SimpleVerbatimTag
, "simple verbatim tag", passed
, total
);
1080 RunEmitterTest(&Emitter::VerbatimTagInBlockSeq
, "verbatim tag in block seq", passed
, total
);
1081 RunEmitterTest(&Emitter::VerbatimTagInFlowSeq
, "verbatim tag in flow seq", passed
, total
);
1082 RunEmitterTest(&Emitter::VerbatimTagInFlowSeqWithNull
, "verbatim tag in flow seq with null", passed
, total
);
1083 RunEmitterTest(&Emitter::VerbatimTagInBlockMap
, "verbatim tag in block map", passed
, total
);
1084 RunEmitterTest(&Emitter::VerbatimTagInFlowMap
, "verbatim tag in flow map", passed
, total
);
1085 RunEmitterTest(&Emitter::VerbatimTagInFlowMapWithNull
, "verbatim tag in flow map with null", passed
, total
);
1086 RunEmitterTest(&Emitter::VerbatimTagWithEmptySeq
, "verbatim tag with empty seq", passed
, total
);
1087 RunEmitterTest(&Emitter::VerbatimTagWithEmptyMap
, "verbatim tag with empty map", passed
, total
);
1088 RunEmitterTest(&Emitter::VerbatimTagWithEmptySeqAndMap
, "verbatim tag with empty seq and map", passed
, total
);
1089 RunEmitterTest(&Emitter::ByKindTagWithScalar
, "by-kind tag with scalar", passed
, total
);
1090 RunEmitterTest(&Emitter::LocalTagWithScalar
, "local tag with scalar", passed
, total
);
1091 RunEmitterTest(&Emitter::ComplexDoc
, "complex doc", passed
, total
);
1092 RunEmitterTest(&Emitter::STLContainers
, "STL containers", passed
, total
);
1093 RunEmitterTest(&Emitter::SimpleComment
, "simple comment", passed
, total
);
1094 RunEmitterTest(&Emitter::MultiLineComment
, "multi-line comment", passed
, total
);
1095 RunEmitterTest(&Emitter::ComplexComments
, "complex comments", passed
, total
);
1096 RunEmitterTest(&Emitter::InitialComment
, "initial comment", passed
, total
);
1097 RunEmitterTest(&Emitter::InitialCommentWithDocIndicator
, "initial comment with doc indicator", passed
, total
);
1098 RunEmitterTest(&Emitter::CommentInFlowSeq
, "comment in flow seq", passed
, total
);
1099 RunEmitterTest(&Emitter::CommentInFlowMap
, "comment in flow map", passed
, total
);
1100 RunEmitterTest(&Emitter::Indentation
, "indentation", passed
, total
);
1101 RunEmitterTest(&Emitter::SimpleGlobalSettings
, "simple global settings", passed
, total
);
1102 RunEmitterTest(&Emitter::ComplexGlobalSettings
, "complex global settings", passed
, total
);
1103 RunEmitterTest(&Emitter::Null
, "null", passed
, total
);
1104 RunEmitterTest(&Emitter::EscapedUnicode
, "escaped unicode", passed
, total
);
1105 RunEmitterTest(&Emitter::Unicode
, "unicode", passed
, total
);
1106 RunEmitterTest(&Emitter::DoubleQuotedUnicode
, "double quoted unicode", passed
, total
);
1107 RunEmitterTest(&Emitter::UserType
, "user type", passed
, total
);
1108 RunEmitterTest(&Emitter::UserTypeInContainer
, "user type in container", passed
, total
);
1109 RunEmitterTest(&Emitter::PointerToInt
, "pointer to int", passed
, total
);
1110 RunEmitterTest(&Emitter::PointerToUserType
, "pointer to user type", passed
, total
);
1111 RunEmitterTest(&Emitter::NewlineAtEnd
, "newline at end", passed
, total
);
1112 RunEmitterTest(&Emitter::NewlineInBlockSequence
, "newline in block sequence", passed
, total
);
1113 RunEmitterTest(&Emitter::NewlineInFlowSequence
, "newline in flow sequence", passed
, total
);
1114 RunEmitterTest(&Emitter::NewlineInBlockMap
, "newline in block map", passed
, total
);
1115 RunEmitterTest(&Emitter::NewlineInFlowMap
, "newline in flow map", passed
, total
);
1116 RunEmitterTest(&Emitter::LotsOfNewlines
, "lots of newlines", passed
, total
);
1117 RunEmitterTest(&Emitter::Binary
, "binary", passed
, total
);
1118 RunEmitterTest(&Emitter::LongBinary
, "long binary", passed
, total
);
1119 RunEmitterTest(&Emitter::EmptyBinary
, "empty binary", passed
, total
);
1120 RunEmitterTest(&Emitter::ColonAtEndOfScalar
, "colon at end of scalar", passed
, total
);
1121 RunEmitterTest(&Emitter::ColonAsScalar
, "colon as scalar", passed
, total
);
1122 RunEmitterTest(&Emitter::ColonAtEndOfScalarInFlow
, "colon at end of scalar in flow", passed
, total
);
1123 RunEmitterTest(&Emitter::BoolFormatting
, "bool formatting", passed
, total
);
1124 RunEmitterTest(&Emitter::DocStartAndEnd
, "doc start and end", passed
, total
);
1125 RunEmitterTest(&Emitter::ImplicitDocStart
, "implicit doc start", passed
, total
);
1126 RunEmitterTest(&Emitter::EmptyString
, "empty string", passed
, total
);
1127 RunEmitterTest(&Emitter::SingleChar
, "single char", passed
, total
);
1128 RunEmitterTest(&Emitter::DefaultPrecision
, "default precision", passed
, total
);
1129 RunEmitterTest(&Emitter::SetPrecision
, "set precision", passed
, total
);
1130 RunEmitterTest(&Emitter::DashInBlockContext
, "dash in block context", passed
, total
);
1131 RunEmitterTest(&Emitter::HexAndOct
, "hex and oct", passed
, total
);
1133 RunEmitterErrorTest(&Emitter::ExtraEndSeq
, "extra EndSeq", passed
, total
);
1134 RunEmitterErrorTest(&Emitter::ExtraEndMap
, "extra EndMap", passed
, total
);
1135 RunEmitterErrorTest(&Emitter::BadSingleQuoted
, "bad single quoted string", passed
, total
);
1136 RunEmitterErrorTest(&Emitter::InvalidAnchor
, "invalid anchor", passed
, total
);
1137 RunEmitterErrorTest(&Emitter::InvalidAlias
, "invalid alias", passed
, total
);
1138 RunEmitterErrorTest(&Emitter::MissingKey
, "missing key", passed
, total
);
1139 RunEmitterErrorTest(&Emitter::MissingValue
, "missing value", passed
, total
);
1140 RunEmitterErrorTest(&Emitter::UnexpectedKey
, "unexpected key", passed
, total
);
1141 RunEmitterErrorTest(&Emitter::UnexpectedValue
, "unexpected value", passed
, total
);
1142 RunEmitterErrorTest(&Emitter::BadLocalTag
, "bad local tag", passed
, total
);
1144 std::cout
<< "Emitter tests: " << passed
<< "/" << total
<< " passed\n";
1145 return passed
== total
;