MCPcopy Create free account
hub / github.com/boostorg/json / testSampleJson

Method testSampleJson

test/stream_parser.cpp:1046–1089  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1044 }
1045
1046 void
1047 testSampleJson()
1048 {
1049 string_view in =
1050R"xx({
1051 "glossary": {
1052 "title": "example glossary",
1053 "GlossDiv": {
1054 "title": "S",
1055 "GlossList": {
1056 "GlossEntry": {
1057 "ID": "SGML",
1058 "SortAs": "SGML",
1059 "GlossTerm": "Standard Generalized Markup Language",
1060 "Acronym": "SGML",
1061 "Abbrev": "ISO 8879:1986",
1062 "GlossDef": {
1063 "para": "A meta-markup language, used to create markup languages such as DocBook.",
1064 "GlossSeeAlso": ["GML", "XML"]
1065 },
1066 "GlossSee": "markup"
1067 }
1068 }
1069 }
1070 }
1071})xx";
1072 string_view out =
1073 "{\"glossary\":{\"title\":\"example glossary\",\"GlossDiv\":"
1074 "{\"title\":\"S\",\"GlossList\":{\"GlossEntry\":{\"ID\":\"SGML\","
1075 "\"SortAs\":\"SGML\",\"GlossTerm\":\"Standard Generalized Markup "
1076 "Language\",\"Acronym\":\"SGML\",\"Abbrev\":\"ISO 8879:1986\","
1077 "\"GlossDef\":{\"para\":\"A meta-markup language, used to create "
1078 "markup languages such as DocBook.\",\"GlossSeeAlso\":[\"GML\",\"XML\"]},"
1079 "\"GlossSee\":\"markup\"}}}}}";
1080 storage_ptr sp =
1081 make_shared_resource<monotonic_resource>();
1082 stream_parser p(sp);
1083 system::error_code ec;
1084 p.write(in.data(), in.size(), ec);
1085 if(BOOST_TEST(! ec))
1086 p.finish(ec);
1087 if(BOOST_TEST(! ec))
1088 BOOST_TEST(serialize(p.release()) == out);
1089 }
1090
1091 void
1092 testTrailingCommas()

Callers

nothing calls this directly

Calls 6

serializeFunction · 0.85
finishMethod · 0.80
writeMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected