2 #include "yaml-cpp/yaml.h"
9 void SimpleScalar(std::string
& inputScalar
, std::string
& desiredOutput
)
11 inputScalar
= "Hello, World!";
12 desiredOutput
= "Hello, World!";
15 void MultiLineScalar(std::string
& inputScalar
, std::string
& desiredOutput
)
18 "normal scalar, but\n"
20 desiredOutput
= "normal scalar, but over several lines";
23 void LiteralScalar(std::string
& inputScalar
, std::string
& desiredOutput
)
27 " literal scalar - so we can draw ASCII:\n"
33 "literal scalar - so we can draw ASCII:\n"
40 void FoldedScalar(std::string
& inputScalar
, std::string
& desiredOutput
)
44 " and a folded scalar... so we\n"
45 " can just keep writing various\n"
46 " things. And if we want to keep indentation:\n"
48 " we just indent a little\n"
49 " see, this stays indented";
51 "and a folded scalar... so we"
52 " can just keep writing various"
53 " things. And if we want to keep indentation:\n"
55 " we just indent a little\n"
56 " see, this stays indented";
59 void ChompedFoldedScalar(std::string
& inputScalar
, std::string
& desiredOutput
)
63 " Here's a folded scalar\n"
64 " that gets chomped.";
66 "Here's a folded scalar"
67 " that gets chomped.";
70 void ChompedLiteralScalar(std::string
& inputScalar
, std::string
& desiredOutput
)
74 " Here's a literal scalar\n"
75 " that gets chomped.";
77 "Here's a literal scalar\n"
81 void FoldedScalarWithIndent(std::string
& inputScalar
, std::string
& desiredOutput
)
85 " Here's a folded scalar\n"
86 " that starts with some indentation.";
88 " Here's a folded scalar\n"
89 "that starts with some indentation.";
92 void ColonScalar(std::string
& inputScalar
, std::string
& desiredOutput
)
94 inputScalar
= "::vector";
95 desiredOutput
= "::vector";
98 void QuotedScalar(std::string
& inputScalar
, std::string
& desiredOutput
)
100 inputScalar
= "\": - ()\"";
101 desiredOutput
= ": - ()";
104 void CommaScalar(std::string
& inputScalar
, std::string
& desiredOutput
)
106 inputScalar
= "Up, up, and away!";
107 desiredOutput
= "Up, up, and away!";
110 void DashScalar(std::string
& inputScalar
, std::string
& desiredOutput
)
112 inputScalar
= "-123";
113 desiredOutput
= "-123";
116 void URLScalar(std::string
& inputScalar
, std::string
& desiredOutput
)
118 inputScalar
= "http://example.com/foo#bar";
119 desiredOutput
= "http://example.com/foo#bar";
129 std::stringstream
stream(input
);
130 YAML::Parser
parser(stream
);
132 parser
.GetNextDocument(doc
);
135 if(doc
[0].to
<std::string
>() != "eggs")
137 if(doc
[1].to
<std::string
>() != "bread")
139 if(doc
[2].to
<std::string
>() != "milk")
148 "name: Prince Fielder\n"
152 std::stringstream
stream(input
);
153 YAML::Parser
parser(stream
);
155 parser
.GetNextDocument(doc
);
158 doc
["name"] >> output
;
159 if(output
!= "Prince Fielder")
161 doc
["position"] >> output
;
164 doc
["bats"] >> output
;
173 std::string input
= "[ 2 , 3, 5 , 7, 11]";
175 std::stringstream
stream(input
);
176 YAML::Parser
parser(stream
);
178 parser
.GetNextDocument(doc
);
202 std::string input
= "{hr: 65, avg: 0.278}";
204 std::stringstream
stream(input
);
205 YAML::Parser
parser(stream
);
207 parser
.GetNextDocument(doc
);
213 doc
["avg"] >> output
;
214 if(output
!= "0.278")
220 bool FlowMapWithOmittedKey()
222 std::string input
= "{: omitted key}";
223 std::stringstream
stream(input
);
224 YAML::Parser
parser(stream
);
226 parser
.GetNextDocument(doc
);
229 doc
[YAML::Null
] >> output
;
230 if(output
!= "omitted key")
236 bool FlowMapWithOmittedValue()
238 std::string input
= "{a: b, c:, d:}";
239 std::stringstream
stream(input
);
240 YAML::Parser
parser(stream
);
242 parser
.GetNextDocument(doc
);
248 if(!IsNull(doc
["c"]))
250 if(!IsNull(doc
["d"]))
256 bool FlowMapWithSoloEntry()
258 std::string input
= "{a: b, c, d: e}";
259 std::stringstream
stream(input
);
260 YAML::Parser
parser(stream
);
262 parser
.GetNextDocument(doc
);
268 if(!IsNull(doc
["c"]))
277 bool FlowMapEndingWithSoloEntry()
279 std::string input
= "{a: b, c}";
280 std::stringstream
stream(input
);
281 YAML::Parser
parser(stream
);
283 parser
.GetNextDocument(doc
);
289 if(!IsNull(doc
["c"]))
295 bool QuotedSimpleKeys()
297 std::string KeyValue
[3] = { "\"double\": double\n", "'single': single\n", "plain: plain\n" };
299 int perm
[3] = { 0, 1, 2 };
301 std::string input
= KeyValue
[perm
[0]] + KeyValue
[perm
[1]] + KeyValue
[perm
[2]];
303 std::stringstream
stream(input
);
304 YAML::Parser
parser(stream
);
306 parser
.GetNextDocument(doc
);
309 doc
["double"] >> output
;
310 if(output
!= "double")
312 doc
["single"] >> output
;
313 if(output
!= "single")
315 doc
["plain"] >> output
;
316 if(output
!= "plain")
318 } while(std::next_permutation(perm
, perm
+ 3));
323 bool CompressedMapAndSeq()
325 std::string input
= "key:\n- one\n- two";
327 std::stringstream
stream(input
);
328 YAML::Parser
parser(stream
);
330 parser
.GetNextDocument(doc
);
332 const YAML::Node
& seq
= doc
["key"];
347 bool NullBlockSeqEntry()
349 std::string input
= "- hello\n-\n- world";
351 std::stringstream
stream(input
);
352 YAML::Parser
parser(stream
);
354 parser
.GetNextDocument(doc
);
358 if(output
!= "hello")
363 if(output
!= "world")
369 bool NullBlockMapKey()
371 std::string input
= ": empty key";
373 std::stringstream
stream(input
);
374 YAML::Parser
parser(stream
);
376 parser
.GetNextDocument(doc
);
379 doc
[YAML::Null
] >> output
;
380 if(output
!= "empty key")
386 bool NullBlockMapValue()
388 std::string input
= "empty value:";
390 std::stringstream
stream(input
);
391 YAML::Parser
parser(stream
);
393 parser
.GetNextDocument(doc
);
395 if(!IsNull(doc
["empty value"]))
403 std::string input
= "- &alias test\n- *alias";
405 std::stringstream
stream(input
);
406 YAML::Parser
parser(stream
);
408 parser
.GetNextDocument(doc
);
427 std::string input
= "- &alias\n- *alias";
429 std::stringstream
stream(input
);
430 YAML::Parser
parser(stream
);
432 parser
.GetNextDocument(doc
);
446 bool AnchorInSimpleKey()
448 std::string input
= "- &a b: c\n- *a";
450 std::stringstream
stream(input
);
451 YAML::Parser
parser(stream
);
453 parser
.GetNextDocument(doc
);
459 doc
[0]["b"] >> output
;
470 bool AliasAsSimpleKey()
472 std::string input
= "- &a b\n- *a : c";
474 std::stringstream
stream(input
);
475 YAML::Parser
parser(stream
);
477 parser
.GetNextDocument(doc
);
487 doc
[1]["b"] >> output
;
496 std::string input
= "---\n- one\n- two";
498 std::stringstream
stream(input
);
499 YAML::Parser
parser(stream
);
501 parser
.GetNextDocument(doc
);
519 std::string input
= "---\nname: doc1\n---\nname: doc2";
521 std::stringstream
stream(input
);
522 YAML::Parser
parser(stream
);
524 parser
.GetNextDocument(doc
);
527 doc
["name"] >> output
;
534 parser
.GetNextDocument(doc
);
535 doc
["name"] >> output
;
542 bool ExplicitEndDoc()
544 std::string input
= "- one\n- two\n...\n...";
546 std::stringstream
stream(input
);
547 YAML::Parser
parser(stream
);
549 parser
.GetNextDocument(doc
);
565 bool MultipleDocsWithSomeExplicitIndicators()
568 "- one\n- two\n...\n"
569 "---\nkey: value\n...\n...\n"
573 std::stringstream
stream(input
);
574 YAML::Parser
parser(stream
);
578 parser
.GetNextDocument(doc
);
588 parser
.GetNextDocument(doc
);
589 doc
["key"] >> output
;
590 if(output
!= "value")
593 parser
.GetNextDocument(doc
);
597 if(output
!= "three")
603 parser
.GetNextDocument(doc
);
604 doc
["key"] >> output
;
605 if(output
!= "value")
611 bool BlockKeyWithNullValue()
617 std::stringstream
stream(input
);
618 YAML::Parser
parser(stream
);
621 parser
.GetNextDocument(doc
);
624 if(!IsNull(doc
["key"]))
626 if(doc
["just a key"].to
<std::string
>() != "value")
640 std::stringstream
stream(input
);
641 YAML::Parser
parser(stream
);
644 parser
.GetNextDocument(doc
);
647 if(doc
[0].to
<int>() != 15)
649 if(doc
[1].to
<int>() != 0x10)
651 if(doc
[2].to
<int>() != 030)
653 if(doc
[3].to
<unsigned>() != 0xffffffff)
660 std::string input
= "key: value";
661 std::stringstream
stream(input
);
662 YAML::Parser
parser(stream
);
664 parser
.GetNextDocument(doc
);
668 } catch(const YAML::Exception
& e
) {
669 if(e
.msg
!= std::string(YAML::ErrorMsg::KEY_NOT_FOUND
) + ": bad key")
675 } catch(const YAML::Exception
& e
) {
676 if(e
.msg
!= std::string(YAML::ErrorMsg::KEY_NOT_FOUND
) + ": 5")
682 } catch(const YAML::Exception
& e
) {
683 if(e
.msg
!= std::string(YAML::ErrorMsg::KEY_NOT_FOUND
) + ": 2.5")
692 std::string input
= "{a: 1, b: 2, c: 3, a: 4}";
693 std::stringstream
stream(input
);
694 YAML::Parser
parser(stream
);
696 parser
.GetNextDocument(doc
);
698 if(doc
["a"].to
<int>() != 4)
700 if(doc
["b"].to
<int>() != 2)
702 if(doc
["c"].to
<int>() != 3)
707 void PrepareNodeForTagExam(YAML::Node
& doc
, const std::string
& input
)
709 std::stringstream
stream(input
);
710 YAML::Parser
parser(stream
);
711 parser
.GetNextDocument(doc
);
714 struct TagMismatch
: public std::exception
{
715 TagMismatch(const std::string
& actualTag
, const std::string
& expectedTag
) {
716 std::stringstream output
;
717 output
<< "Tag has value \"" << actualTag
<< "\" but \"" << expectedTag
<< "\" was expected";
718 what_
= output
.str();
720 virtual ~TagMismatch() throw() {}
721 virtual const char *what() const throw() { return what_
.c_str(); }
727 bool ExpectedTagValue(YAML::Node
& node
, const char* tag
)
729 if(node
.Tag() == tag
)
732 throw TagMismatch(node
.Tag(), tag
);
735 bool DefaultPlainScalarTag()
738 PrepareNodeForTagExam(node
, "--- 12");
740 return ExpectedTagValue(node
, "?");
743 bool DefaultSingleQuotedScalarTag()
746 PrepareNodeForTagExam(node
, "--- '12'");
748 return ExpectedTagValue(node
, "!");
751 bool ExplicitNonSpecificPlainScalarTag()
754 PrepareNodeForTagExam(node
, "--- ! 12");
756 return ExpectedTagValue(node
, "!");
762 PrepareNodeForTagExam(node
, "--- !foo 12");
764 return ExpectedTagValue(node
, "!foo");
767 bool VerbatimLocalTag()
770 PrepareNodeForTagExam(node
, "--- !<!foo> 12");
772 return ExpectedTagValue(node
, "!foo");
775 bool StandardShortcutTag()
778 PrepareNodeForTagExam(node
, "--- !!int 12");
780 return ExpectedTagValue(node
, "tag:yaml.org,2002:int");
783 bool VerbatimURITag()
786 PrepareNodeForTagExam(node
, "--- !<tag:yaml.org,2002:int> 12");
788 return ExpectedTagValue(node
, "tag:yaml.org,2002:int");
791 bool DefaultSequenceTag()
794 PrepareNodeForTagExam(node
, "--- [12]");
796 return ExpectedTagValue(node
, "?");
799 bool ExplicitNonSpecificSequenceTag()
802 PrepareNodeForTagExam(node
, "--- ! [12]");
804 return ExpectedTagValue(node
, "!");
809 void RunScalarParserTest(void (*test
)(std::string
&, std::string
&), const std::string
& name
, int& passed
, int& total
) {
811 std::string inputScalar
, desiredOutput
;
815 test(inputScalar
, desiredOutput
);
816 std::stringstream
stream(inputScalar
);
817 YAML::Parser
parser(stream
);
819 parser
.GetNextDocument(doc
);
821 } catch(const YAML::Exception
& e
) {
825 if(ok
&& output
== desiredOutput
) {
828 std::cout
<< "Parser test failed: " << name
<< "\n";
830 std::cout
<< "Caught exception: " << error
<< "\n";
832 std::cout
<< "Output:\n" << output
<< "<<<\n";
833 std::cout
<< "Desired output:\n" << desiredOutput
<< "<<<\n";
839 void RunParserTest(bool (*test
)(), const std::string
& name
, int& passed
, int& total
) {
844 } catch(const YAML::Exception
& e
) {
847 } catch(const Parser::TagMismatch
& e
) {
854 std::cout
<< "Parser test failed: " << name
<< "\n";
856 std::cout
<< "Caught exception: " << error
<< "\n";
861 typedef void (*EncodingFn
)(std::ostream
&, int);
863 inline char Byte(int ch
)
865 return static_cast<char>(static_cast<unsigned char>(static_cast<unsigned int>(ch
)));
868 void EncodeToUtf8(std::ostream
& stream
, int ch
)
874 else if (ch
<= 0x7FF)
876 stream
<< Byte(0xC0 | (ch
>> 6));
877 stream
<< Byte(0x80 | (ch
& 0x3F));
879 else if (ch
<= 0xFFFF)
881 stream
<< Byte(0xE0 | (ch
>> 12));
882 stream
<< Byte(0x80 | ((ch
>> 6) & 0x3F));
883 stream
<< Byte(0x80 | (ch
& 0x3F));
885 else if (ch
<= 0x1FFFFF)
887 stream
<< Byte(0xF0 | (ch
>> 18));
888 stream
<< Byte(0x80 | ((ch
>> 12) & 0x3F));
889 stream
<< Byte(0x80 | ((ch
>> 6) & 0x3F));
890 stream
<< Byte(0x80 | (ch
& 0x3F));
894 bool SplitUtf16HighChar(std::ostream
& stream
, EncodingFn encoding
, int ch
)
896 int biasedValue
= ch
- 0x10000;
901 int high
= 0xD800 | (biasedValue
>> 10);
902 int low
= 0xDC00 | (biasedValue
& 0x3FF);
903 encoding(stream
, high
);
904 encoding(stream
, low
);
908 void EncodeToUtf16LE(std::ostream
& stream
, int ch
)
910 if (!SplitUtf16HighChar(stream
, &EncodeToUtf16LE
, ch
))
912 stream
<< Byte(ch
& 0xFF) << Byte(ch
>> 8);
916 void EncodeToUtf16BE(std::ostream
& stream
, int ch
)
918 if (!SplitUtf16HighChar(stream
, &EncodeToUtf16BE
, ch
))
920 stream
<< Byte(ch
>> 8) << Byte(ch
& 0xFF);
924 void EncodeToUtf32LE(std::ostream
& stream
, int ch
)
926 stream
<< Byte(ch
& 0xFF) << Byte((ch
>> 8) & 0xFF)
927 << Byte((ch
>> 16) & 0xFF) << Byte((ch
>> 24) & 0xFF);
930 void EncodeToUtf32BE(std::ostream
& stream
, int ch
)
932 stream
<< Byte((ch
>> 24) & 0xFF) << Byte((ch
>> 16) & 0xFF)
933 << Byte((ch
>> 8) & 0xFF) << Byte(ch
& 0xFF);
939 EncodingTester(EncodingFn encoding
, bool declareEncoding
)
943 encoding(m_yaml
, 0xFEFF);
946 AddEntry(encoding
, 0x0021, 0x007E); // Basic Latin
947 AddEntry(encoding
, 0x00A1, 0x00FF); // Latin-1 Supplement
948 AddEntry(encoding
, 0x0660, 0x06FF); // Arabic (largest contiguous block)
950 // CJK unified ideographs (multiple lines)
951 AddEntry(encoding
, 0x4E00, 0x4EFF);
952 AddEntry(encoding
, 0x4F00, 0x4FFF);
953 AddEntry(encoding
, 0x5000, 0x51FF); // 512 character line
954 AddEntry(encoding
, 0x5200, 0x54FF); // 768 character line
955 AddEntry(encoding
, 0x5500, 0x58FF); // 1024 character line
957 AddEntry(encoding
, 0x103A0, 0x103C3); // Old Persian
959 m_yaml
.seekg(0, std::ios::beg
);
962 std::istream
& stream() {return m_yaml
;}
963 const std::vector
<std::string
>& entries() {return m_entries
;}
966 std::stringstream m_yaml
;
967 std::vector
<std::string
> m_entries
;
969 void AddEntry(EncodingFn encoding
, int startCh
, int endCh
)
971 encoding(m_yaml
, '-');
972 encoding(m_yaml
, ' ');
973 encoding(m_yaml
, '|');
974 encoding(m_yaml
, '\n');
975 encoding(m_yaml
, ' ');
976 encoding(m_yaml
, ' ');
978 std::stringstream entry
;
979 for (int ch
= startCh
; ch
<= endCh
; ++ch
)
981 encoding(m_yaml
, ch
);
982 EncodeToUtf8(entry
, ch
);
984 encoding(m_yaml
, '\n');
986 m_entries
.push_back(entry
.str());
990 void RunEncodingTest(EncodingFn encoding
, bool declareEncoding
, const std::string
& name
, int& passed
, int& total
)
992 EncodingTester
tester(encoding
, declareEncoding
);
996 YAML::Parser
parser(tester
.stream());
998 parser
.GetNextDocument(doc
);
1000 YAML::Iterator itNode
= doc
.begin();
1001 std::vector
<std::string
>::const_iterator itEntry
= tester
.entries().begin();
1002 for (; (itNode
!= doc
.end()) && (itEntry
!= tester
.entries().end()); ++itNode
, ++itEntry
)
1004 std::string stScalarValue
;
1005 if (!itNode
->GetScalar(stScalarValue
) && (stScalarValue
== *itEntry
))
1011 if ((itNode
!= doc
.end()) || (itEntry
!= tester
.entries().end()))
1015 } catch(const YAML::Exception
& e
) {
1022 std::cout
<< "Parser test failed: " << name
<< "\n";
1024 std::cout
<< "Caught exception: " << error
<< "\n";
1030 bool RunParserTests()
1034 RunScalarParserTest(&Parser::SimpleScalar
, "simple scalar", passed
, total
);
1035 RunScalarParserTest(&Parser::MultiLineScalar
, "multi-line scalar", passed
, total
);
1036 RunScalarParserTest(&Parser::LiteralScalar
, "literal scalar", passed
, total
);
1037 RunScalarParserTest(&Parser::FoldedScalar
, "folded scalar", passed
, total
);
1038 RunScalarParserTest(&Parser::ChompedFoldedScalar
, "chomped folded scalar", passed
, total
);
1039 RunScalarParserTest(&Parser::ChompedLiteralScalar
, "chomped literal scalar", passed
, total
);
1040 RunScalarParserTest(&Parser::FoldedScalarWithIndent
, "folded scalar with indent", passed
, total
);
1041 RunScalarParserTest(&Parser::ColonScalar
, "colon scalar", passed
, total
);
1042 RunScalarParserTest(&Parser::QuotedScalar
, "quoted scalar", passed
, total
);
1043 RunScalarParserTest(&Parser::CommaScalar
, "comma scalar", passed
, total
);
1044 RunScalarParserTest(&Parser::DashScalar
, "dash scalar", passed
, total
);
1045 RunScalarParserTest(&Parser::URLScalar
, "url scalar", passed
, total
);
1047 RunParserTest(&Parser::SimpleSeq
, "simple seq", passed
, total
);
1048 RunParserTest(&Parser::SimpleMap
, "simple map", passed
, total
);
1049 RunParserTest(&Parser::FlowSeq
, "flow seq", passed
, total
);
1050 RunParserTest(&Parser::FlowMap
, "flow map", passed
, total
);
1051 RunParserTest(&Parser::FlowMapWithOmittedKey
, "flow map with omitted key", passed
, total
);
1052 RunParserTest(&Parser::FlowMapWithOmittedValue
, "flow map with omitted value", passed
, total
);
1053 RunParserTest(&Parser::FlowMapWithSoloEntry
, "flow map with solo entry", passed
, total
);
1054 RunParserTest(&Parser::FlowMapEndingWithSoloEntry
, "flow map ending with solo entry", passed
, total
);
1055 RunParserTest(&Parser::QuotedSimpleKeys
, "quoted simple keys", passed
, total
);
1056 RunParserTest(&Parser::CompressedMapAndSeq
, "compressed map and seq", passed
, total
);
1057 RunParserTest(&Parser::NullBlockSeqEntry
, "null block seq entry", passed
, total
);
1058 RunParserTest(&Parser::NullBlockMapKey
, "null block map key", passed
, total
);
1059 RunParserTest(&Parser::NullBlockMapValue
, "null block map value", passed
, total
);
1060 RunParserTest(&Parser::SimpleAlias
, "simple alias", passed
, total
);
1061 RunParserTest(&Parser::AliasWithNull
, "alias with null", passed
, total
);
1062 RunParserTest(&Parser::AnchorInSimpleKey
, "anchor in simple key", passed
, total
);
1063 RunParserTest(&Parser::AliasAsSimpleKey
, "alias as simple key", passed
, total
);
1064 RunParserTest(&Parser::ExplicitDoc
, "explicit doc", passed
, total
);
1065 RunParserTest(&Parser::MultipleDocs
, "multiple docs", passed
, total
);
1066 RunParserTest(&Parser::ExplicitEndDoc
, "explicit end doc", passed
, total
);
1067 RunParserTest(&Parser::MultipleDocsWithSomeExplicitIndicators
, "multiple docs with some explicit indicators", passed
, total
);
1068 RunParserTest(&Parser::BlockKeyWithNullValue
, "block key with null value", passed
, total
);
1069 RunParserTest(&Parser::Bases
, "bases", passed
, total
);
1070 RunParserTest(&Parser::KeyNotFound
, "key not found", passed
, total
);
1071 RunParserTest(&Parser::DuplicateKey
, "duplicate key", passed
, total
);
1072 RunParserTest(&Parser::DefaultPlainScalarTag
, "default plain scalar tag", passed
, total
);
1073 RunParserTest(&Parser::DefaultSingleQuotedScalarTag
, "default single-quoted scalar tag", passed
, total
);
1074 RunParserTest(&Parser::ExplicitNonSpecificPlainScalarTag
, "explicit, non-specific plain scalar tag", passed
, total
);
1075 RunParserTest(&Parser::BasicLocalTag
, "basic local tag", passed
, total
);
1076 RunParserTest(&Parser::VerbatimLocalTag
, "verbatim local tag", passed
, total
);
1077 RunParserTest(&Parser::StandardShortcutTag
, "standard shortcut tag", passed
, total
);
1078 RunParserTest(&Parser::VerbatimURITag
, "verbatim URI tag", passed
, total
);
1079 RunParserTest(&Parser::DefaultPlainScalarTag
, "default plain scalar tag", passed
, total
);
1080 RunParserTest(&Parser::DefaultSequenceTag
, "default sequence tag", passed
, total
);
1081 RunParserTest(&Parser::ExplicitNonSpecificSequenceTag
, "explicit, non-specific sequence tag", passed
, total
);
1083 RunEncodingTest(&EncodeToUtf8
, false, "UTF-8, no BOM", passed
, total
);
1084 RunEncodingTest(&EncodeToUtf8
, true, "UTF-8 with BOM", passed
, total
);
1085 RunEncodingTest(&EncodeToUtf16LE
, false, "UTF-16LE, no BOM", passed
, total
);
1086 RunEncodingTest(&EncodeToUtf16LE
, true, "UTF-16LE with BOM", passed
, total
);
1087 RunEncodingTest(&EncodeToUtf16BE
, false, "UTF-16BE, no BOM", passed
, total
);
1088 RunEncodingTest(&EncodeToUtf16BE
, true, "UTF-16BE with BOM", passed
, total
);
1089 RunEncodingTest(&EncodeToUtf32LE
, false, "UTF-32LE, no BOM", passed
, total
);
1090 RunEncodingTest(&EncodeToUtf32LE
, true, "UTF-32LE with BOM", passed
, total
);
1091 RunEncodingTest(&EncodeToUtf32BE
, false, "UTF-32BE, no BOM", passed
, total
);
1092 RunEncodingTest(&EncodeToUtf32BE
, true, "UTF-32BE with BOM", passed
, total
);
1094 std::cout
<< "Parser tests: " << passed
<< "/" << total
<< " passed\n";
1095 return passed
== total
;