MCPcopy Create free account
hub / github.com/bytedance/sonic-cpp / TEST

Function TEST

tests/parse_schema_test.cpp:64–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64TEST(ParseSchema, SuccessBasic) {
65 TestSuccess(
66 R"({"true": null, "false": null, "null":null, "int": null, "double":null,
67 "string": null, "object": null, "array": null
68 })",
69 R"({"true": true, "false": false, "null": null, "int": 1, "double": 1.0, "string": "string",
70 "object": {
71 "object": {},
72 "array": []
73 },
74 "array": [{}, [], {"a":1}, [-1]]
75 })",
76 R"({"true": true, "false": false, "null": null, "int": 1, "double": 1.0, "string": "string",
77 "object": {
78 "object": {},
79 "array": []
80 },
81 "array": [{}, [], {"a":1}, [-1]]
82 })");
83 TestSuccess(
84 R"({"true": false, "false": true, "null": {}, "int": 2, "double":2.0,
85 "string": "", "object": null, "array": []})",
86 R"({"true": true, "false": false, "null": null, "int": 1, "double": 1.0, "string": "string",
87 "object": {
88 "object": {},
89 "array": [{}, [], [{}, []], true, null, "str", 1, 1.0]
90 },
91 "array": [{}, [], [{}, []], true, null, "str", 1, 1.0]
92 })",
93 R"({"true": true, "false": false, "null": null, "int": 1, "double": 1.0, "string": "string",
94 "object": {
95 "object": {},
96 "array": [{}, [], [{}, []], true, null, "str", 1, 1.0]
97 },
98 "array": [{}, [], [{}, []], true, null, "str", 1, 1.0]
99 })");
100 TestSuccess(
101 R"({"true": null, "false": null, "null":null, "int": null, "double":null,
102 "string": null, "object": null, "array": null})",
103 R"([])", R"([])");
104 TestSuccess(R"({"obj":{}})", R"({"obj":{"a":1}})", R"({"obj":{"a":1}})");
105 TestSuccess(R"({"obj":{"a":2}})", R"({"obj":{"a":1, "b":1}})",
106 R"({"obj":{"a":1}})");
107 TestSuccess(
108 R"({"bool2bool":true, "bool2int":1, "bool2dbl": 1.0, "bool2str": "str",
109 "bool2null": null, "bool2obj": {}, "bool2arr": [],
110 "int2bool":true, "int2int":1, "int2dbl": 1.0, "int2str": "str",
111 "int2null": null, "int2obj": {}, "int2arr": [],
112 "dbl2bool":true, "dbl2int":1, "dbl2dbl": 1.0, "dbl2str": "str",
113 "dbl2null": null, "dbl2obj": {}, "dbl2arr": [],
114 "str2bool":true, "str2int":1, "str2dbl": 1.0, "str2str": "str",
115 "str2null": null, "str2obj": {}, "str2arr": [],
116 "null2bool":true, "null2int":1, "null2dbl": 1.0, "null2str": "str",
117 "null2null": null, "null2obj": {}, "null2arr": [],
118 "obj2bool":true, "obj2int":1, "obj2dbl": 1.0, "obj2str": "str",
119 "obj2null": null, "obj2obj": {}, "obj2arr": [],
120 "arr2bool":true, "arr2int":1, "arr2dbl": 1.0, "arr2str": "str",
121 "arr2null": null, "arr2obj": {}, "arr2arr": []

Callers

nothing calls this directly

Calls 2

TestSuccessFunction · 0.85
TestFailedFunction · 0.85

Tested by

no test coverage detected