std::pair<pt::ptree, QueryData> getSerializedQueryData() { auto r = getSerializedRow(); QueryData q = {r.second, r.second}; pt::ptree arr; arr.push_back(std::make_pair("", r.first)); arr.push_back(std::make_pair("", r.first)); return std::make_pair(arr, q); }
TEST_F(ResultsTests, test_serialize_row) { auto results = getSerializedRow(); pt::ptree tree; auto s = serializeRow(results.second, tree); EXPECT_TRUE(s.ok()); EXPECT_EQ(s.toString(), "OK"); EXPECT_EQ(results.first, tree); }
TEST_F(ResultsTests, test_deserialize_row_json) { auto results = getSerializedRow(); std::string input; serializeRowJSON(results.second, input); // Pull the serialized JSON back into a Row output container. Row output; auto s = deserializeRowJSON(input, output); EXPECT_TRUE(s.ok()); // The output container should match the input row. EXPECT_EQ(output, results.second); }
std::pair<JSON, QueryData> getSerializedQueryDataWithColumnOrder() { auto r = getSerializedRow(true); QueryData q = {r.second, r.second}; JSON doc = JSON::newArray(); auto arr1 = doc.getArray(); doc.copyFrom(r.first.doc(), arr1); doc.push(arr1); auto arr2 = doc.getArray(); doc.copyFrom(r.first.doc(), arr2); doc.push(arr2); return std::make_pair(std::move(doc), q); }