| 48 | } |
| 49 | |
| 50 | void epJSONFixture::compareJSONS(const Json::Value& lhs, const Json::Value& rhs) { |
| 51 | auto doubledLhs = lhs; |
| 52 | makeDoubles(doubledLhs); |
| 53 | |
| 54 | auto doubledRhs = rhs; |
| 55 | makeDoubles(doubledRhs); |
| 56 | |
| 57 | if (doubledLhs != doubledRhs) { |
| 58 | compareJSONS_detailed(doubledLhs, doubledRhs, "root"); |
| 59 | constexpr bool debug = false; |
| 60 | if constexpr (debug) { |
| 61 | { |
| 62 | std::ofstream file_id; |
| 63 | file_id.open("lhs.json"); |
| 64 | Json::StreamWriterBuilder builder; |
| 65 | builder["commentStyle"] = "None"; |
| 66 | builder["indentation"] = " "; |
| 67 | std::unique_ptr<Json::StreamWriter> writer(builder.newStreamWriter()); |
| 68 | std::ofstream outputFileStream("/tmp/lhs.json"); |
| 69 | writer->write(doubledLhs, &outputFileStream); |
| 70 | } |
| 71 | { |
| 72 | std::ofstream file_id; |
| 73 | file_id.open("lhs.json"); |
| 74 | Json::StreamWriterBuilder builder; |
| 75 | builder["commentStyle"] = "None"; |
| 76 | builder["indentation"] = " "; |
| 77 | std::unique_ptr<Json::StreamWriter> writer(builder.newStreamWriter()); |
| 78 | std::ofstream outputFileStream("/tmp/rhs.json"); |
| 79 | writer->write(doubledRhs, &outputFileStream); |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | ASSERT_TRUE(doubledLhs == doubledRhs); |
| 84 | } |
| 85 | |
| 86 | void epJSONFixture::compareJSONS_detailed(Json::Value& lhs, Json::Value& rhs, const std::string& currentPath) { |
| 87 | if (lhs.isNumeric()) { |