41 "true iff Google Mock should report leaked mock objects "
45 "Controls how verbose Google Mock's output is."
47 " info - prints all messages.\n"
48 " warning - prints warnings and errors.\n"
49 " error - prints errors only.");
52 "Controls the default behavior of mocks."
54 " 0 - by default, mocks act as NiceMocks.\n"
55 " 1 - by default, mocks act as NaggyMocks.\n"
56 " 2 - by default, mocks act as StrictMocks.");
65static const char* ParseGoogleMockFlagValue(
const char* str,
69 if (str == NULL || flag == NULL)
return NULL;
72 const std::string flag_str = std::string(
"--gmock_") + flag;
73 const size_t flag_len = flag_str.length();
74 if (strncmp(str, flag_str.c_str(), flag_len) != 0)
return NULL;
77 const char* flag_end = str + flag_len;
80 if (def_optional && (flag_end[0] ==
'\0')) {
87 if (flag_end[0] !=
'=')
return NULL;
98static bool ParseGoogleMockBoolFlag(
const char* str,
const char* flag,
101 const char*
const value_str = ParseGoogleMockFlagValue(str, flag,
true);
104 if (value_str == NULL)
return false;
107 *
value = !(*value_str ==
'0' || *value_str ==
'f' || *value_str ==
'F');
116template <
typename String>
117static bool ParseGoogleMockStringFlag(
const char* str,
const char* flag,
120 const char*
const value_str = ParseGoogleMockFlagValue(str, flag,
false);
123 if (value_str == NULL)
return false;
130static bool ParseGoogleMockIntFlag(
const char* str,
const char* flag,
133 const char*
const value_str = ParseGoogleMockFlagValue(str, flag,
true);
136 if (value_str == NULL)
return false;
139 return ParseInt32(Message() <<
"The value of flag --" << flag,
147template <
typename CharType>
152 if (*argc <= 0)
return;
154 for (
int i = 1; i != *argc; i++) {
156 const char*
const arg = arg_string.c_str();
159 if (ParseGoogleMockBoolFlag(arg,
"catch_leaked_mocks",
161 ParseGoogleMockStringFlag(arg,
"verbose", &
GMOCK_FLAG(verbose)) ||
162 ParseGoogleMockIntFlag(arg,
"default_mock_behavior",
168 for (
int j = i;
j != *argc;
j++) {
#define GMOCK_DEFINE_int32_(name, default_val, doc)
#define GMOCK_DEFINE_bool_(name, default_val, doc)
#define GMOCK_DEFINE_string_(name, default_val, doc)
void InitGoogleMockImpl(int *argc, CharType **argv)
std::string StreamableToString(const T &streamable)
bool ParseInt32(const Message &src_text, const char *str, Int32 *value)
const char kWarningVerbosity[]
GTEST_API_ void InitGoogleMock(int *argc, char **argv)
GTEST_API_ void InitGoogleTest(int *argc, char **argv)