MCPcopy Create free account
hub / github.com/catboost/catboost / Y_UNIT_TEST

Function Y_UNIT_TEST

library/cpp/json/writer/json_ut.cpp:10–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9Y_UNIT_TEST_SUITE(JsonWriter) {
10 Y_UNIT_TEST(Struct) {
11 NJsonWriter::TBuf w;
12 w.BeginList();
13 w.BeginObject()
14 .WriteKey("key")
15 .WriteString("value")
16 .UnsafeWritePair("\"xk\":13")
17 .WriteKey("key2")
18 .BeginList()
19 .BeginObject()
20 .EndObject()
21 .BeginObject()
22 .EndObject()
23 .EndList()
24 .EndObject();
25 w.WriteInt(43);
26 w.UnsafeWriteValue("\"x\"");
27 w.WriteString("...");
28 w.EndList();
29 const char* exp = "[{\"key\":\"value\",\"xk\":13,\"key2\":[{},{}]},43,\"x\",\"...\"]";
30 UNIT_ASSERT_EQUAL(w.Str(), exp);
31 }
32 Y_UNIT_TEST(EscapedString) {
33 NJsonWriter::TBuf w(NJsonWriter::HEM_ESCAPE_HTML);
34 w.WriteString(" \n \r \t \007 \b \f ' <tag> &ent; \"txt\" ");

Callers

nothing calls this directly

Calls 15

AppendValueMethod · 0.80
TBufClass · 0.70
TJsonValueClass · 0.70
BeginListMethod · 0.45
EndObjectMethod · 0.45
EndListMethod · 0.45
BeginObjectMethod · 0.45
WriteKeyMethod · 0.45
UnsafeWritePairMethod · 0.45
WriteStringMethod · 0.45
WriteIntMethod · 0.45
UnsafeWriteValueMethod · 0.45

Tested by

no test coverage detected