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

Function AreJsonArraysEqual

library/cpp/json/writer/json_value.cpp:45–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45static bool
46AreJsonArraysEqual(const NJson::TJsonValue& lhs, const NJson::TJsonValue& rhs) {
47 using namespace NJson;
48
49 Y_ABORT_UNLESS(lhs.GetType() == JSON_ARRAY, "lhs has not a JSON_ARRAY type.");
50
51 if (rhs.GetType() != JSON_ARRAY) {
52 return false;
53 }
54 typedef TJsonValue::TArray TArray;
55 const TArray& lhsArray = lhs.GetArray();
56 const TArray& rhsArray = rhs.GetArray();
57
58 if (lhsArray.size() != rhsArray.size()) {
59 return false;
60 }
61 for (TArray::const_iterator lhsIt = lhsArray.begin(), rhsIt = rhsArray.begin();
62 lhsIt != lhsArray.end(); ++lhsIt, ++rhsIt) {
63 if (*lhsIt != *rhsIt) {
64 return false;
65 }
66 }
67 return true;
68}
69
70namespace NJson {
71 const TJsonValue TJsonValue::UNDEFINED{};

Callers 1

operator==Method · 0.70

Calls 5

GetTypeMethod · 0.45
GetArrayMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected