| 43 | } |
| 44 | |
| 45 | static bool |
| 46 | AreJsonArraysEqual(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 | |
| 70 | namespace NJson { |
| 71 | const TJsonValue TJsonValue::UNDEFINED{}; |