60 const std::vector<const char*>& names,
const Strings& values) {
65 const auto build_one = [&](
const size_t i) {
66 return std::string(names[
i]) +
": " + values[
i];
68 std::string result =
"(" + build_one(0);
69 for (
size_t i = 1;
i < values.size();
i++) {
71 result += build_one(
i);
83 char prev_char =
'\0';
84 for (
const char*
p = id_name; *
p !=
'\0'; prev_char = *(
p++)) {
87 const bool starts_new_word =
IsUpper(*
p) ||
92 if (starts_new_word && !result.empty()) result +=
' ';
105 const std::string& message)
override {
107 : TestPartResult::kNonFatalFailure,
108 file, line, message.c_str()) =
Message();
125 return failure_reporter;
155 int stack_frames_to_skip) {
163 std::cout <<
"\nGMOCK WARNING:";
166 if (message.empty() || message[0] !=
'\n') {
169 std::cout << message;
170 if (stack_frames_to_skip >= 0) {
173 const int actual_to_skip = 0;
177 const int actual_to_skip = stack_frames_to_skip + 1;
181 if (!message.empty() && *message.rbegin() !=
'\n') {
184 std::cout <<
"Stack trace:\n"
188 std::cout << ::std::flush;
196 "You are using DoDefault() inside a composite action like "
197 "DoAll() or WithArgs(). This is not supported for technical "
198 "reasons. Please instead spell out the default action, or "
199 "assign the default action to an Action variable and use "
200 "the variable in various places.");
204 return c ==
'-' ?
'+' : c ==
'_' ?
'/' :
c;
208 return *base64 == 0 ?
static_cast<char>(65)
211 :
UnBase64Impl(c, base64 + 1, static_cast<char>(carry + 1));
214 template <
size_t... I>
215 constexpr std::array<char, 256>
UnBase64Impl(std::index_sequence<I...>,
216 const char*
const base64) {
221 constexpr std::array<char, 256>
UnBase64(
const char*
const base64) {
222 return UnBase64Impl(std::make_index_sequence<256>{}, base64);
226 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
231 size_t encoded_len = encoded.size();
232 decoded->reserve(3 * (encoded_len / 4) + (encoded_len % 4));
235 for (
int src : encoded) {
236 if (std::isspace(src) || src ==
'=') {
239 char src_bin =
kUnBase64[
static_cast<size_t>(src)];
245 dst |=
static_cast<char>(src_bin << 2);
248 dst |=
static_cast<char>(src_bin >> (bit_pos - 2));
249 decoded->push_back(dst);
250 dst =
static_cast<char>(src_bin << (10 - bit_pos));
251 bit_pos = (bit_pos + 6) % 8;
constexpr std::array< char, 256 > UnBase64(const char *const base64)
GTEST_API_ void IllegalDoDefault(const char *file, int line)
constexpr char UndoWebSafeEncoding(char c)
GTEST_API_ FailureReporterInterface * GetFailureReporter()
::std::vector<::std::string > Strings
const char kInfoVerbosity[]
bool Base64Unescape(const std::string &encoded, std::string *decoded)
static constexpr char kBase64[]
GTEST_API_ std::string ConvertIdentifierNameToWords(const char *id_name)
GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(int skip_count)
expr expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c *expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 expr1 expr1 c
#define GTEST_CHECK_(condition)
void ReportFailure(FailureType type, const char *file, int line, const std::string &message) override
#define GMOCK_FLAG_GET(name)
static GTEST_DEFINE_STATIC_MUTEX_(g_log_mutex)
GTEST_API_ bool LogIsVisible(LogSeverity severity)
void Assert(bool condition, const char *file, int line, const std::string &msg)
constexpr char UnBase64Impl(char c, const char *const base64, char carry)
static constexpr std::array< char, 256 > kUnBase64
const char kErrorVerbosity[]
GTEST_API_ std::string JoinAsKeyValueTuple(const std::vector< const char * > &names, const Strings &values)
GTEST_API_ WithoutMatchers GetWithoutMatchers()
GTEST_API_ void Log(LogSeverity severity, const std::string &message, int stack_frames_to_skip)