MCPcopy Create free account
hub / github.com/chigraph/chigraph / areArrayEqualUnordered

Function areArrayEqualUnordered

test/codegen/codegentester.cpp:51–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51std::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
76std::string areJsonEqual(json lhs, json rhs) {
77 std::string errstring;

Callers 1

areJsonEqualFunction · 0.85

Calls 4

findFunction · 0.85
beginMethod · 0.80
endMethod · 0.80
dumpMethod · 0.45

Tested by

no test coverage detected