bool metashell::system_test::operator==(const type& type_, const json_string& s_) { rapidjson::Document d; d.Parse(s_.get().c_str()); return members_are({"type", "name"}, d) && matches(type_, d["name"]); }
bool metashell::system_test::operator==(const json_string& a_, const json_string& b_) { // Not testing point_of_event and source_location auto flags = boost::match_default | boost::format_all; boost::regex filter_poi(R"(,"point_of_event":"[^"]*")"); boost::regex filter_sl(R"(,"source_location":"[^"]*")"); auto filtered_a = boost::regex_replace(a_.get(), filter_poi, "", flags); auto filtered_b = boost::regex_replace(b_.get(), filter_poi, "", flags); filtered_a = boost::regex_replace(filtered_a, filter_sl, "", flags); filtered_b = boost::regex_replace(filtered_b, filter_sl, "", flags); return filtered_a == filtered_b; }
bool metashell::system_test::operator==(const frame& frame_, const json_string& s_) { rapidjson::Document d; d.Parse(s_.get().c_str()); return d.IsObject() && d.HasMember("type") && is_string("frame", d["type"]) && matches(frame_, d); }
frame::frame(const json_string& s_) : _name(boost::none), _source_location(boost::none), _point_of_event(boost::none), _kind(boost::none) { rapidjson::Document d; d.Parse(s_.get().c_str()); init(d, true); }
static void convert_string(const json_string& value, const string& path, datum& ret_datum) { ret_datum.string_values_.push_back(make_pair(path, value.get())); }