std::string GenerateEmojiString()

in hessian2/basic_codec/string_codec_unittests.cc [57:78]


std::string GenerateEmojiString() {
  uint32_t emoji = 0x0001f923;
  uint32_t max_unicode = 0x0010ffff;

  std::string s;

  // Write the first emoji codepoint as a UTF-8 string.
  s.push_back(0xf0 | (emoji >> 18));
  s.push_back(0x80 | ((emoji >> 12) & 0x3f));
  s.push_back(0x80 | ((emoji >> 6) & 0x3f));
  s.push_back(0x80 | (emoji & 0x3f));

  s += ",max";

  // Write the max unicode codepoint as a UTF-8 string.
  s.push_back(0xf0 | (max_unicode >> 18));
  s.push_back(0x80 | ((max_unicode >> 12) & 0x3f));
  s.push_back(0x80 | ((max_unicode >> 6) & 0x3f));
  s.push_back(0x80 | (max_unicode & 0x3f));

  return s;
}