| 49 | } |
| 50 | |
| 51 | std::string areArrayEqualUnordered(json lhs, json rhs) { |
| 52 | std::vector<json> objects; |
| 53 | |
| 54 | for (auto& obj : lhs) { objects.push_back(obj); } |
| 55 | |
| 56 | for (auto& obj : rhs) { |
| 57 | auto iter = std::find(objects.begin(), objects.end(), obj); |
| 58 | |
| 59 | if (iter == objects.end()) return "object: " + obj.dump(2) + " not in serialized"; |
| 60 | |
| 61 | objects.erase(iter); |
| 62 | } |
| 63 | |
| 64 | if (!objects.empty()) { |
| 65 | std::string errstring = "objects in lhs that aren't in original: \n\n"; |
| 66 | for (auto obj : objects) { |
| 67 | errstring += obj.dump(2); |
| 68 | errstring += "\n\n"; |
| 69 | } |
| 70 | return errstring; |
| 71 | } |
| 72 | |
| 73 | return ""; |
| 74 | } |
| 75 | |
| 76 | std::string areJsonEqual(json lhs, json rhs) { |
| 77 | std::string errstring; |
no test coverage detected