<commit_before>#include "unittest/mock_store.hpp"

#include "arch/timing.hpp"

namespace unittest {

rdb_protocol_t::write_t mock_overwrite(std::string key, std::string value) {
    std::map<std::string, counted_t<const ql::datum_t> > m;
    m["id"] = make_counted<ql::datum_t>(std::string(key));
    m["value"] = make_counted<ql::datum_t>(std::move(value));

    rdb_protocol_t::point_write_t pw(store_key_t(key),
                                     make_counted<ql::datum_t>(std::move(m)),
                                     true);
    return rdb_protocol_t::write_t(pw,
                                   DURABILITY_REQUIREMENT_SOFT,
                                   profile_bool_t::DONT_PROFILE);
}

rdb_protocol_t::read_t mock_read(std::string key) {
    rdb_protocol_t::point_read_t pr((store_key_t(key)));
    return rdb_protocol_t::read_t(pr, profile_bool_t::DONT_PROFILE);
}

std::string mock_parse_read_response(const rdb_protocol_t::read_response_t &rr) {
    const rdb_protocol_t::point_read_response_t *prr
        = boost::get<rdb_protocol_t::point_read_response_t>(&rr.response);
    guarantee(prr != NULL);
    if (!prr->data.has()) {
        // Behave like the old dummy_protocol_t.
        return "";<commit_msg>Fixed mock_parse_read_response logic to handle R_NULL, which is what the point_read_response_t has instead of an empty datum pointer.<commit_after>#include "unittest/mock_store.hpp"

#include "arch/timing.hpp"

namespace unittest {

rdb_protocol_t::write_t mock_overwrite(std::string key, std::string value) {
    std::map<std::string, counted_t<const ql::datum_t> > m;
    m["id"] = make_counted<ql::datum_t>(std::string(key));
    m["value"] = make_counted<ql::datum_t>(std::move(value));

    rdb_protocol_t::point_write_t pw(store_key_t(key),
                                     make_counted<ql::datum_t>(std::move(m)),
                                     true);
    return rdb_protocol_t::write_t(pw,
                                   DURABILITY_REQUIREMENT_SOFT,
                                   profile_bool_t::DONT_PROFILE);
}

rdb_protocol_t::read_t mock_read(std::string key) {
    rdb_protocol_t::point_read_t pr((store_key_t(key)));
    return rdb_protocol_t::read_t(pr, profile_bool_t::DONT_PROFILE);
}

std::string mock_parse_read_response(const rdb_protocol_t::read_response_t &rr) {
    const rdb_protocol_t::point_read_response_t *prr
        = boost::get<rdb_protocol_t::point_read_response_t>(&rr.response);
    guarantee(prr != NULL);
    guarantee(prr->data.has());
    if (prr->data->get_type() == ql::datum_t::R_NULL) {
        // Behave like the old dummy_protocol_t.
        return "";
{'fraction_non_alphanumeric': 0.13056603773584904, 'fraction_numerical': 0.0, 'mean_word_length': 3.3601973684210527, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3681897', 'n_tokens_mistral': 934, 'n_tokens_neox': 931, 'n_words': 125}