MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / compare_match

Function compare_match

test/jsonpath/src/jsonpath_flatten_tests.cpp:113–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111namespace {
112
113 void compare_match(jsoncons::json& doc,
114 const std::string& path,
115 const std::string& value)
116 {
117 auto result = jsoncons::jsonpath::json_query(doc, path);
118 CHECK_FALSE(result.empty()); // must match //-V521
119 CHECK_FALSE(result.size() > 1); // too many matches //-V521
120
121 auto matched_value = result[0].as<std::string>();
122 CHECK(value == matched_value); //-V521
123 }
124
125} // namespace
126

Callers 1

Calls 3

json_queryFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected