message: Reuse binary creation code in fuzz test
diff: @@ -165,6 +165,18 @@ std::pair<int64_t, int32_t> get_timestamp_values(State& s) {
  return {seconds, nanoseconds};
  }
  +// returns random binary blob data in a string, logs to a variable called "blob" if logging is enabled
  +std::string construct_binary_payload(State& s, util::Optional<std::ostream&> log)
  +{
  + size_t rand_char = get_next(s);
  + size_t blob_size = static_cast<uint64_t>(get_int64(s)) % (ArrayBlob::max_binary_size + 1);
  + std::string buffer(blob_size, static_cast<unsigned char>(rand_char));
  + if (log) {
  + *log << "std::string blob(" << blob_size << ", static_cast<unsigned char>(" << rand_char << "));\n";
  + }
  + return buffer;
  +}
  +
  Mixed construct_mixed(State& s, util::Optional<std::ostream&> log, std::string& buffer)
  {
  // Mixed type has 8 constructors supporting different types.
  @@ -208,12 +220,9 @@ Mixed construct_mixed(State& s, util::Optional<std::ostream&> log, std::string&
  return Mixed(StringData(buffer));
  }
  case 5: {
  - size_t rand_char = get_next(s);
  - size_t blob_size = static_cast<uint64_t>(get_int64(s)) % (ArrayBlob::max_binary_size + 1);
  - buffer = std::string(blob_size, static_cast<unsigned char>(rand_char));
  + buffer = construct_binary_payload(s, log);
  if (log) {
  - *log << "std::string blob(" << blob_size << ", static_cast<unsigned char>(" << rand_char << "));\n"
  - << "Mixed mixed(BinaryData(blob));\n";
  + *log << "Mixed mixed(BinaryData(blob));\n";
  }
  return Mixed(BinaryData(buffer));
  }
  @@ -677,15 +686,15 @@ void parse_and_apply_instructions(std::string& in, const std::string& path, util
  else if (type == type_Binary) {
  bool insert_big_blob = get_next(s) % 2 == 0;
  if (insert_big_blob) {
  - size_t rand_char = get_next(s);
  - size_t blob_size = get_next(s) + (ArrayBlob::max_binary_size + 1);
  - std::string blob(blob_size, static_cast<unsigned char>(rand_char));
  if (log) {
  - *log << "{\n\tstd::string data(" << blob_size << ", static_cast<unsigned char>(" << rand_char << "));\n\t"
  - << "g.get_table(" << table_ndx << ")->set_binary_big(" << col_ndx << ", " << row_ndx
  - << ", BinaryData(data.data(), " << blob_size << "));\n}\n";
  + *log << "{\n\t";
  + }
  + std::string blob = construct_binary_payload(s, log);
  + if (log) {
  + *log << "\tg.get_table(" << table_ndx << ")->set_binary_big(" << col_ndx << ", "
  + << row_ndx << ", BinaryData(blob));\n}\n";
  }
  - t->set_binary_big(col_ndx, row_ndx, BinaryData(blob.data(), blob_size));
  + t->set_binary_big(col_ndx, row_ndx, BinaryData(blob));
  }
  else {
  std::string str = create_string(get_next(s));
  