Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
e0d051ea
Commit
e0d051ea
authored
Feb 19, 2009
by
zhanyong.wan
Browse files
Makes sure all internal macros are named GMOCK_*_. No functionality is changed.
parent
7a13fee2
Changes
14
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
470 additions
and
450 deletions
+470
-450
include/gmock/gmock-actions.h
include/gmock/gmock-actions.h
+27
-26
include/gmock/gmock-generated-actions.h
include/gmock/gmock-generated-actions.h
+37
-37
include/gmock/gmock-generated-actions.h.pump
include/gmock/gmock-generated-actions.h.pump
+4
-4
include/gmock/gmock-generated-function-mockers.h
include/gmock/gmock-generated-function-mockers.h
+274
-274
include/gmock/gmock-generated-function-mockers.h.pump
include/gmock/gmock-generated-function-mockers.h.pump
+23
-21
include/gmock/gmock-generated-matchers.h
include/gmock/gmock-generated-matchers.h
+25
-13
include/gmock/gmock-generated-matchers.h.pump
include/gmock/gmock-generated-matchers.h.pump
+7
-4
include/gmock/gmock-matchers.h
include/gmock/gmock-matchers.h
+24
-24
include/gmock/gmock-spec-builders.h
include/gmock/gmock-spec-builders.h
+5
-5
include/gmock/gmock.h
include/gmock/gmock.h
+1
-1
include/gmock/internal/gmock-internal-utils.h
include/gmock/internal/gmock-internal-utils.h
+9
-9
include/gmock/internal/gmock-port.h
include/gmock/internal/gmock-port.h
+15
-14
src/gmock.cc
src/gmock.cc
+6
-6
test/gmock-internal-utils_test.cc
test/gmock-internal-utils_test.cc
+13
-12
No files found.
include/gmock/gmock-actions.h
View file @
e0d051ea
...
...
@@ -100,7 +100,7 @@ class BuiltInDefaultValue<T*> {
// The following specializations define the default values for
// specific types we care about.
#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(type, value) \
#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(type, value) \
template <> \
class BuiltInDefaultValue<type> { \
public: \
...
...
@@ -108,17 +108,17 @@ class BuiltInDefaultValue<T*> {
static type Get() { return value; } \
}
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
void
,
);
// NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
void
,
);
// NOLINT
#if GTEST_HAS_GLOBAL_STRING
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
::
string
,
""
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
::
string
,
""
);
#endif // GTEST_HAS_GLOBAL_STRING
#if GTEST_HAS_STD_STRING
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
::
std
::
string
,
""
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
::
std
::
string
,
""
);
#endif // GTEST_HAS_STD_STRING
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
bool
,
false
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
unsigned
char
,
'\0'
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
signed
char
,
'\0'
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
char
,
'\0'
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
bool
,
false
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
unsigned
char
,
'\0'
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
signed
char
,
'\0'
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
char
,
'\0'
);
// signed wchar_t and unsigned wchar_t are NOT in the C++ standard.
// Using them is a bad practice and not portable. So don't use them.
...
...
@@ -146,21 +146,21 @@ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(char, '\0');
// that type is the same as unsigned int for gcc, and invalid for
// MSVC.
#if defined(__GNUC__) || defined(_NATIVE_WCHAR_T_DEFINED)
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
wchar_t
,
0U
);
// NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
wchar_t
,
0U
);
// NOLINT
#endif
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
unsigned
short
,
0U
);
// NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
signed
short
,
0
);
// NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
unsigned
int
,
0U
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
signed
int
,
0
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
unsigned
long
,
0UL
);
// NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
signed
long
,
0L
);
// NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
UInt64
,
0
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
Int64
,
0
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
float
,
0
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
(
double
,
0
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
unsigned
short
,
0U
);
// NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
signed
short
,
0
);
// NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
unsigned
int
,
0U
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
signed
int
,
0
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
unsigned
long
,
0UL
);
// NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
signed
long
,
0L
);
// NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
UInt64
,
0
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
Int64
,
0
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
float
,
0
);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
(
double
,
0
);
#undef GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
#undef GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
_
}
// namespace internal
...
...
@@ -460,7 +460,8 @@ class ReturnAction {
// and put the typedef both here (for use in assert statement) and
// in the Impl class. But both definitions must be the same.
typedef
typename
Function
<
F
>::
Result
Result
;
GMOCK_COMPILE_ASSERT
(
!
internal
::
is_reference
<
Result
>::
value
,
GMOCK_COMPILE_ASSERT_
(
!
internal
::
is_reference
<
Result
>::
value
,
use_ReturnRef_instead_of_Return_to_return_a_reference
);
return
Action
<
F
>
(
new
Impl
<
F
>
(
value_
));
}
...
...
@@ -489,7 +490,7 @@ class ReturnNullAction {
// Allows ReturnNull() to be used in any pointer-returning function.
template
<
typename
Result
,
typename
ArgumentTuple
>
static
Result
Perform
(
const
ArgumentTuple
&
)
{
GMOCK_COMPILE_ASSERT
(
internal
::
is_pointer
<
Result
>::
value
,
GMOCK_COMPILE_ASSERT
_
(
internal
::
is_pointer
<
Result
>::
value
,
ReturnNull_can_be_used_to_return_a_pointer_only
);
return
NULL
;
}
...
...
@@ -522,7 +523,7 @@ class ReturnRefAction {
// Asserts that the function return type is a reference. This
// catches the user error of using ReturnRef(x) when Return(x)
// should be used, and generates some helpful error message.
GMOCK_COMPILE_ASSERT
(
internal
::
is_reference
<
Result
>::
value
,
GMOCK_COMPILE_ASSERT
_
(
internal
::
is_reference
<
Result
>::
value
,
use_Return_instead_of_ReturnRef_to_return_a_value
);
return
Action
<
F
>
(
new
Impl
<
F
>
(
ref_
));
}
...
...
include/gmock/gmock-generated-actions.h
View file @
e0d051ea
...
...
@@ -703,7 +703,7 @@ class InvokeArgumentAction10 {
// An INTERNAL macro for extracting the type of a tuple field. It's
// subject to change without notice - DO NOT USE IN USER CODE!
#define GMOCK_FIELD(Tuple, N) \
#define GMOCK_FIELD
_
(Tuple, N) \
typename ::std::tr1::tuple_element<N, Tuple>::type
// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the
...
...
@@ -728,12 +728,12 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
int
k4
,
int
k5
,
int
k6
,
int
k7
,
int
k8
,
int
k9
,
int
k10
>
class
SelectArgs
{
public:
typedef
Result
type
(
GMOCK_FIELD
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
(
ArgumentTuple
,
k3
),
GMOCK_FIELD
(
ArgumentTuple
,
k4
),
GMOCK_FIELD
(
ArgumentTuple
,
k5
),
GMOCK_FIELD
(
ArgumentTuple
,
k6
),
GMOCK_FIELD
(
ArgumentTuple
,
k7
),
GMOCK_FIELD
(
ArgumentTuple
,
k8
),
GMOCK_FIELD
(
ArgumentTuple
,
k9
),
GMOCK_FIELD
(
ArgumentTuple
,
k10
));
typedef
Result
type
(
GMOCK_FIELD
_
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k3
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k4
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k5
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k6
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k7
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k8
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k9
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k10
));
typedef
typename
Function
<
type
>::
ArgumentTuple
SelectedArgs
;
static
SelectedArgs
Select
(
const
ArgumentTuple
&
args
)
{
using
::
std
::
tr1
::
get
;
...
...
@@ -759,7 +759,7 @@ template <typename Result, typename ArgumentTuple, int k1>
class
SelectArgs
<
Result
,
ArgumentTuple
,
k1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
>
{
public:
typedef
Result
type
(
GMOCK_FIELD
(
ArgumentTuple
,
k1
));
typedef
Result
type
(
GMOCK_FIELD
_
(
ArgumentTuple
,
k1
));
typedef
typename
Function
<
type
>::
ArgumentTuple
SelectedArgs
;
static
SelectedArgs
Select
(
const
ArgumentTuple
&
args
)
{
using
::
std
::
tr1
::
get
;
...
...
@@ -771,8 +771,8 @@ template <typename Result, typename ArgumentTuple, int k1, int k2>
class
SelectArgs
<
Result
,
ArgumentTuple
,
k1
,
k2
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
>
{
public:
typedef
Result
type
(
GMOCK_FIELD
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
(
ArgumentTuple
,
k2
));
typedef
Result
type
(
GMOCK_FIELD
_
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k2
));
typedef
typename
Function
<
type
>::
ArgumentTuple
SelectedArgs
;
static
SelectedArgs
Select
(
const
ArgumentTuple
&
args
)
{
using
::
std
::
tr1
::
get
;
...
...
@@ -784,8 +784,8 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3>
class
SelectArgs
<
Result
,
ArgumentTuple
,
k1
,
k2
,
k3
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
>
{
public:
typedef
Result
type
(
GMOCK_FIELD
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
(
ArgumentTuple
,
k3
));
typedef
Result
type
(
GMOCK_FIELD
_
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k3
));
typedef
typename
Function
<
type
>::
ArgumentTuple
SelectedArgs
;
static
SelectedArgs
Select
(
const
ArgumentTuple
&
args
)
{
using
::
std
::
tr1
::
get
;
...
...
@@ -798,9 +798,9 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
class
SelectArgs
<
Result
,
ArgumentTuple
,
k1
,
k2
,
k3
,
k4
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
>
{
public:
typedef
Result
type
(
GMOCK_FIELD
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
(
ArgumentTuple
,
k3
),
GMOCK_FIELD
(
ArgumentTuple
,
k4
));
typedef
Result
type
(
GMOCK_FIELD
_
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k3
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k4
));
typedef
typename
Function
<
type
>::
ArgumentTuple
SelectedArgs
;
static
SelectedArgs
Select
(
const
ArgumentTuple
&
args
)
{
using
::
std
::
tr1
::
get
;
...
...
@@ -814,9 +814,9 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
class
SelectArgs
<
Result
,
ArgumentTuple
,
k1
,
k2
,
k3
,
k4
,
k5
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
>
{
public:
typedef
Result
type
(
GMOCK_FIELD
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
(
ArgumentTuple
,
k3
),
GMOCK_FIELD
(
ArgumentTuple
,
k4
),
GMOCK_FIELD
(
ArgumentTuple
,
k5
));
typedef
Result
type
(
GMOCK_FIELD
_
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k3
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k4
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k5
));
typedef
typename
Function
<
type
>::
ArgumentTuple
SelectedArgs
;
static
SelectedArgs
Select
(
const
ArgumentTuple
&
args
)
{
using
::
std
::
tr1
::
get
;
...
...
@@ -830,10 +830,10 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
class
SelectArgs
<
Result
,
ArgumentTuple
,
k1
,
k2
,
k3
,
k4
,
k5
,
k6
,
-
1
,
-
1
,
-
1
,
-
1
>
{
public:
typedef
Result
type
(
GMOCK_FIELD
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
(
ArgumentTuple
,
k3
),
GMOCK_FIELD
(
ArgumentTuple
,
k4
),
GMOCK_FIELD
(
ArgumentTuple
,
k5
),
GMOCK_FIELD
(
ArgumentTuple
,
k6
));
typedef
Result
type
(
GMOCK_FIELD
_
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k3
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k4
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k5
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k6
));
typedef
typename
Function
<
type
>::
ArgumentTuple
SelectedArgs
;
static
SelectedArgs
Select
(
const
ArgumentTuple
&
args
)
{
using
::
std
::
tr1
::
get
;
...
...
@@ -847,10 +847,10 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
class
SelectArgs
<
Result
,
ArgumentTuple
,
k1
,
k2
,
k3
,
k4
,
k5
,
k6
,
k7
,
-
1
,
-
1
,
-
1
>
{
public:
typedef
Result
type
(
GMOCK_FIELD
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
(
ArgumentTuple
,
k3
),
GMOCK_FIELD
(
ArgumentTuple
,
k4
),
GMOCK_FIELD
(
ArgumentTuple
,
k5
),
GMOCK_FIELD
(
ArgumentTuple
,
k6
),
GMOCK_FIELD
(
ArgumentTuple
,
k7
));
typedef
Result
type
(
GMOCK_FIELD
_
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k3
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k4
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k5
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k6
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k7
));
typedef
typename
Function
<
type
>::
ArgumentTuple
SelectedArgs
;
static
SelectedArgs
Select
(
const
ArgumentTuple
&
args
)
{
using
::
std
::
tr1
::
get
;
...
...
@@ -864,11 +864,11 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
class
SelectArgs
<
Result
,
ArgumentTuple
,
k1
,
k2
,
k3
,
k4
,
k5
,
k6
,
k7
,
k8
,
-
1
,
-
1
>
{
public:
typedef
Result
type
(
GMOCK_FIELD
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
(
ArgumentTuple
,
k3
),
GMOCK_FIELD
(
ArgumentTuple
,
k4
),
GMOCK_FIELD
(
ArgumentTuple
,
k5
),
GMOCK_FIELD
(
ArgumentTuple
,
k6
),
GMOCK_FIELD
(
ArgumentTuple
,
k7
),
GMOCK_FIELD
(
ArgumentTuple
,
k8
));
typedef
Result
type
(
GMOCK_FIELD
_
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k3
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k4
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k5
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k6
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k7
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k8
));
typedef
typename
Function
<
type
>::
ArgumentTuple
SelectedArgs
;
static
SelectedArgs
Select
(
const
ArgumentTuple
&
args
)
{
using
::
std
::
tr1
::
get
;
...
...
@@ -883,11 +883,11 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
class
SelectArgs
<
Result
,
ArgumentTuple
,
k1
,
k2
,
k3
,
k4
,
k5
,
k6
,
k7
,
k8
,
k9
,
-
1
>
{
public:
typedef
Result
type
(
GMOCK_FIELD
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
(
ArgumentTuple
,
k3
),
GMOCK_FIELD
(
ArgumentTuple
,
k4
),
GMOCK_FIELD
(
ArgumentTuple
,
k5
),
GMOCK_FIELD
(
ArgumentTuple
,
k6
),
GMOCK_FIELD
(
ArgumentTuple
,
k7
),
GMOCK_FIELD
(
ArgumentTuple
,
k8
),
GMOCK_FIELD
(
ArgumentTuple
,
k9
));
typedef
Result
type
(
GMOCK_FIELD
_
(
ArgumentTuple
,
k1
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k2
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k3
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k4
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k5
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k6
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k7
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k8
),
GMOCK_FIELD
_
(
ArgumentTuple
,
k9
));
typedef
typename
Function
<
type
>::
ArgumentTuple
SelectedArgs
;
static
SelectedArgs
Select
(
const
ArgumentTuple
&
args
)
{
using
::
std
::
tr1
::
get
;
...
...
@@ -897,7 +897,7 @@ class SelectArgs<Result, ArgumentTuple,
}
};
#undef GMOCK_FIELD
#undef GMOCK_FIELD
_
// Implements the WithArgs action.
template
<
typename
InnerAction
,
int
k1
=
-
1
,
int
k2
=
-
1
,
int
k3
=
-
1
,
...
...
include/gmock/gmock-generated-actions.h.pump
View file @
e0d051ea
...
...
@@ -270,7 +270,7 @@ $for j [[
// An INTERNAL macro for extracting the type of a tuple field. It's
// subject to change without notice - DO NOT USE IN USER CODE!
#define GMOCK_FIELD(Tuple, N) \
#define GMOCK_FIELD
_
(Tuple, N) \
typename ::std::tr1::tuple_element<N, Tuple>::type
$
range
i
1.
.
n
...
...
@@ -296,7 +296,7 @@ $range i 1..n
template
<
typename
Result
,
typename
ArgumentTuple
,
$
for
i
,
[[
int
k
$
i
]]>
class
SelectArgs
{
public:
typedef
Result
type
(
$
for
i
,
[[
GMOCK_FIELD
(
ArgumentTuple
,
k
$
i
)]]);
typedef
Result
type
(
$
for
i
,
[[
GMOCK_FIELD
_
(
ArgumentTuple
,
k
$
i
)]]);
typedef
typename
Function
<
type
>::
ArgumentTuple
SelectedArgs
;
static
SelectedArgs
Select
(
const
ArgumentTuple
&
args
)
{
using
::
std
::
tr1
::
get
;
...
...
@@ -312,7 +312,7 @@ template <typename Result, typename ArgumentTuple$for j1[[, int k$j1]]>
class
SelectArgs
<
Result
,
ArgumentTuple
,
$
for
j
,
[[
$
if
j
<=
i
-
1
[[
k
$
j
]]
$
else
[[
-
1
]]]]
>
{
public:
typedef
Result
type
(
$
for
j1
,
[[
GMOCK_FIELD
(
ArgumentTuple
,
k
$
j1
)]]);
typedef
Result
type
(
$
for
j1
,
[[
GMOCK_FIELD
_
(
ArgumentTuple
,
k
$
j1
)]]);
typedef
typename
Function
<
type
>::
ArgumentTuple
SelectedArgs
;
static
SelectedArgs
Select
(
const
ArgumentTuple
&
args
)
{
using
::
std
::
tr1
::
get
;
...
...
@@ -322,7 +322,7 @@ class SelectArgs<Result, ArgumentTuple,
]]
#undef GMOCK_FIELD
#undef GMOCK_FIELD
_
$
var
ks
=
[[
$
for
i
,
[[
k
$
i
]]]]
...
...
include/gmock/gmock-generated-function-mockers.h
View file @
e0d051ea
This diff is collapsed.
Click to expand it.
include/gmock/gmock-generated-function-mockers.h.pump
View file @
e0d051ea
...
...
@@ -106,92 +106,94 @@ using internal::FunctionMocker;
// The result type of function type F.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_RESULT(tn, F) tn ::testing::internal::Function<F>::Result
#define GMOCK_RESULT
_
(tn, F) tn ::testing::internal::Function<F>::Result
// The type of argument N of function type F.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_ARG(tn, F, N) tn ::testing::internal::Function<F>::Argument##N
#define GMOCK_ARG
_
(tn, F, N) tn ::testing::internal::Function<F>::Argument##N
// The matcher type for argument N of function type F.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_MATCHER(tn, F, N) const ::testing::Matcher<GMOCK_ARG(tn, F, N)>&
#define GMOCK_MATCHER
_
(tn, F, N) const ::testing::Matcher<GMOCK_ARG
_
(tn, F, N)>&
// The variable for mocking the given method.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_MOCKER(Method) GMOCK_CONCAT_TOKEN(gmock_##Method##_, __LINE__)
#define GMOCK_MOCKER
_
(Method) GMOCK_CONCAT_TOKEN
_
(gmock_##Method##_, __LINE__)
$
for
i
[[
$
range
j
1.
.
i
$
var
arg_as
=
[[
$
for
j
,
\
[[
GMOCK_ARG
(
tn
,
F
,
$
j
)
gmock_a
$
j
]]]]
[[
GMOCK_ARG
_
(
tn
,
F
,
$
j
)
gmock_a
$
j
]]]]
$
var
as
=
[[
$
for
j
,
[[
gmock_a
$
j
]]]]
$
var
matcher_as
=
[[
$
for
j
,
\
[[
GMOCK_MATCHER
(
tn
,
F
,
$
j
)
gmock_a
$
j
]]]]
[[
GMOCK_MATCHER
_
(
tn
,
F
,
$
j
)
gmock_a
$
j
]]]]
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD$i(tn, constness, ct, Method, F) \
GMOCK_RESULT(tn, F) ct Method($arg_as) constness { \
GMOCK_COMPILE_ASSERT(::std::tr1::tuple_size< \
#define GMOCK_METHOD$i
[[]]_
(tn, constness, ct, Method, F) \
GMOCK_RESULT
_
(tn, F) ct Method($arg_as) constness { \
GMOCK_COMPILE_ASSERT
_
(::std::tr1::tuple_size< \
tn ::testing::internal::Function<F>::ArgumentTuple>::value == $i, \
this_method_does_not_take_$i[[]]_argument[[$if i != 1 [[s]]]]); \
GMOCK_MOCKER(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER(Method).Invoke($as); \
GMOCK_MOCKER
_
(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER
_
(Method).Invoke($as); \
} \
::testing::MockSpec<F>& \
gmock_##Method($matcher_as) constness { \
return GMOCK_MOCKER(Method).RegisterOwner(this).With($as); \
return GMOCK_MOCKER
_
(Method).RegisterOwner(this).With($as); \
} \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER(Method)
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER
_
(Method)
]]
$
for
i
[[
#define MOCK_METHOD$i(m, F) GMOCK_METHOD$i(, , , m, F)
#define MOCK_METHOD$i(m, F) GMOCK_METHOD$i
[[]]_
(, , , m, F)
]]
$
for
i
[[
#define MOCK_CONST_METHOD$i(m, F) GMOCK_METHOD$i(, const, , m, F)
#define MOCK_CONST_METHOD$i(m, F) GMOCK_METHOD$i
[[]]_
(, const, , m, F)
]]
$
for
i
[[
#define MOCK_METHOD$i[[]]_T(m, F) GMOCK_METHOD$i(typename, , , m, F)
#define MOCK_METHOD$i[[]]_T(m, F) GMOCK_METHOD$i
[[]]_
(typename, , , m, F)
]]
$
for
i
[[
#define MOCK_CONST_METHOD$i[[]]_T(m, F) GMOCK_METHOD$i(typename, const, , m, F)
#define MOCK_CONST_METHOD$i[[]]_T(m, F) [[]]
GMOCK_METHOD
$
i
[[]]
_
(
typename
,
const
,
,
m
,
F
)
]]
$
for
i
[[
#define MOCK_METHOD$i[[]]_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD$i(, , ct, m, F)
#define MOCK_METHOD$i[[]]_WITH_CALLTYPE(ct, m, F) [[]]
GMOCK_METHOD
$
i
[[]]
_
(,
,
ct
,
m
,
F
)
]]
$
for
i
[[
#define MOCK_CONST_METHOD$i[[]]_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD$i(, const, ct, m, F)
GMOCK_METHOD$i
[[]]_
(, const, ct, m, F)
]]
$
for
i
[[
#define MOCK_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD$i(typename, , ct, m, F)
GMOCK_METHOD$i
[[]]_
(typename, , ct, m, F)
]]
$
for
i
[[
#define MOCK_CONST_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD$i(typename, const, ct, m, F)
GMOCK_METHOD$i
[[]]_
(typename, const, ct, m, F)
]]
...
...
include/gmock/gmock-generated-matchers.h
View file @
e0d051ea
...
...
@@ -56,7 +56,7 @@ inline void ValidateMatcherDescription(const char* description) {
template
<
typename
Container
>
class
ElementsAreMatcherImpl
:
public
MatcherInterface
<
Container
>
{
public:
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST
_
(
GMOCK_REMOVE_REFERENCE
_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
// Constructs the matcher from a sequence of element values or
...
...
@@ -195,7 +195,8 @@ class ElementsAreMatcher0 {
template
<
typename
Container
>
operator
Matcher
<
Container
>
()
const
{
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST_
(
GMOCK_REMOVE_REFERENCE_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
const
Matcher
<
const
Element
&>*
const
matchers
=
NULL
;
...
...
@@ -210,7 +211,8 @@ class ElementsAreMatcher1 {
template
<
typename
Container
>
operator
Matcher
<
Container
>
()
const
{
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST_
(
GMOCK_REMOVE_REFERENCE_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
const
Matcher
<
const
Element
&>
matchers
[]
=
{
...
...
@@ -231,7 +233,8 @@ class ElementsAreMatcher2 {
template
<
typename
Container
>
operator
Matcher
<
Container
>
()
const
{
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST_
(
GMOCK_REMOVE_REFERENCE_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
const
Matcher
<
const
Element
&>
matchers
[]
=
{
...
...
@@ -255,7 +258,8 @@ class ElementsAreMatcher3 {
template
<
typename
Container
>
operator
Matcher
<
Container
>
()
const
{
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST_
(
GMOCK_REMOVE_REFERENCE_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
const
Matcher
<
const
Element
&>
matchers
[]
=
{
...
...
@@ -281,7 +285,8 @@ class ElementsAreMatcher4 {
template
<
typename
Container
>
operator
Matcher
<
Container
>
()
const
{
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST_
(
GMOCK_REMOVE_REFERENCE_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
const
Matcher
<
const
Element
&>
matchers
[]
=
{
...
...
@@ -309,7 +314,8 @@ class ElementsAreMatcher5 {
template
<
typename
Container
>
operator
Matcher
<
Container
>
()
const
{
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST_
(
GMOCK_REMOVE_REFERENCE_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
const
Matcher
<
const
Element
&>
matchers
[]
=
{
...
...
@@ -341,7 +347,8 @@ class ElementsAreMatcher6 {
template
<
typename
Container
>
operator
Matcher
<
Container
>
()
const
{
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST_
(
GMOCK_REMOVE_REFERENCE_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
const
Matcher
<
const
Element
&>
matchers
[]
=
{
...
...
@@ -375,7 +382,8 @@ class ElementsAreMatcher7 {
template
<
typename
Container
>
operator
Matcher
<
Container
>
()
const
{
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST_
(
GMOCK_REMOVE_REFERENCE_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
const
Matcher
<
const
Element
&>
matchers
[]
=
{
...
...
@@ -411,7 +419,8 @@ class ElementsAreMatcher8 {
template
<
typename
Container
>
operator
Matcher
<
Container
>
()
const
{
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST_
(
GMOCK_REMOVE_REFERENCE_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
const
Matcher
<
const
Element
&>
matchers
[]
=
{
...
...
@@ -450,7 +459,8 @@ class ElementsAreMatcher9 {
template
<
typename
Container
>
operator
Matcher
<
Container
>
()
const
{
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST_
(
GMOCK_REMOVE_REFERENCE_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
const
Matcher
<
const
Element
&>
matchers
[]
=
{
...
...
@@ -491,7 +501,8 @@ class ElementsAreMatcher10 {
template
<
typename
Container
>
operator
Matcher
<
Container
>
()
const
{
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST_
(
GMOCK_REMOVE_REFERENCE_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
const
Matcher
<
const
Element
&>
matchers
[]
=
{
...
...
@@ -532,7 +543,8 @@ class ElementsAreArrayMatcher {
template
<
typename
Container
>
operator
Matcher
<
Container
>
()
const
{
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST_
(
GMOCK_REMOVE_REFERENCE_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
return
MakeMatcher
(
new
ElementsAreMatcherImpl
<
Container
>
(
first_
,
count_
));
...
...
include/gmock/gmock-generated-matchers.h.pump
View file @
e0d051ea
...
...
@@ -59,7 +59,7 @@ inline void ValidateMatcherDescription(const char* description) {
template
<
typename
Container
>
class
ElementsAreMatcherImpl
:
public
MatcherInterface
<
Container
>
{
public:
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST
_
(
GMOCK_REMOVE_REFERENCE
_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
// Constructs the matcher from a sequence of element values or
...
...
@@ -198,7 +198,8 @@ class ElementsAreMatcher0 {
template
<
typename
Container
>
operator
Matcher
<
Container
>
()
const
{
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST_
(
GMOCK_REMOVE_REFERENCE_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
const
Matcher
<
const
Element
&>*
const
matchers
=
NULL
;
...
...
@@ -218,7 +219,8 @@ class ElementsAreMatcher$i {
template
<
typename
Container
>
operator
Matcher
<
Container
>
()
const
{
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST_
(
GMOCK_REMOVE_REFERENCE_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
const
Matcher
<
const
Element
&>
matchers
[]
=
{
...
...
@@ -251,7 +253,8 @@ class ElementsAreArrayMatcher {
template
<
typename
Container
>
operator
Matcher
<
Container
>
()
const
{
typedef
GMOCK_REMOVE_CONST
(
GMOCK_REMOVE_REFERENCE
(
Container
))
RawContainer
;
typedef
GMOCK_REMOVE_CONST_
(
GMOCK_REMOVE_REFERENCE_
(
Container
))
RawContainer
;
typedef
typename
RawContainer
::
value_type
Element
;
return
MakeMatcher
(
new
ElementsAreMatcherImpl
<
Container
>
(
first_
,
count_
));
...
...
include/gmock/gmock-matchers.h
View file @
e0d051ea
...
...
@@ -377,7 +377,7 @@ class TuplePrefix {
// isn't interesting to the user most of the time. The
// matcher's ExplainMatchResultTo() method handles the case when
// the address is interesting.
internal
::
UniversalPrinter
<
GMOCK_REMOVE_REFERENCE
(
Value
)
>::
internal
::
UniversalPrinter
<
GMOCK_REMOVE_REFERENCE
_
(
Value
)
>::
Print
(
value
,
os
);
ExplainMatchResultAsNeededTo
<
Value
>
(
matcher
,
value
,
os
);
*
os
<<
"
\n
"
;
...
...
@@ -412,7 +412,7 @@ bool TupleMatches(const MatcherTuple& matcher_tuple,
using
::
std
::
tr1
::
tuple_size
;
// Makes sure that matcher_tuple and value_tuple have the same
// number of fields.
GMOCK_COMPILE_ASSERT
(
tuple_size
<
MatcherTuple
>::
value
==
GMOCK_COMPILE_ASSERT
_
(
tuple_size
<
MatcherTuple
>::
value
==
tuple_size
<
ValueTuple
>::
value
,
matcher_and_value_have_different_numbers_of_fields
);
return
TuplePrefix
<
tuple_size
<
ValueTuple
>::
value
>::
...
...
@@ -528,7 +528,7 @@ class AnythingMatcher {
//
// The following template definition assumes that the Rhs parameter is
// a "bare" type (i.e. neither 'const T' nor 'T&').
#define GMOCK_IMPLEMENT_COMPARISON_MATCHER(name, op, relation) \
#define GMOCK_IMPLEMENT_COMPARISON_MATCHER
_
(name, op, relation) \
template <typename Rhs> class name##Matcher { \
public: \
explicit name##Matcher(const Rhs& rhs) : rhs_(rhs) {} \
...
...
@@ -558,14 +558,14 @@ class AnythingMatcher {
// Implements Eq(v), Ge(v), Gt(v), Le(v), Lt(v), and Ne(v)
// respectively.
GMOCK_IMPLEMENT_COMPARISON_MATCHER
(
Eq
,
==
,
"equal to"
);
GMOCK_IMPLEMENT_COMPARISON_MATCHER
(
Ge
,
>=
,
"greater than or equal to"
);
GMOCK_IMPLEMENT_COMPARISON_MATCHER
(
Gt
,
>
,
"greater than"
);
GMOCK_IMPLEMENT_COMPARISON_MATCHER
(
Le
,
<=
,
"less than or equal to"
);
GMOCK_IMPLEMENT_COMPARISON_MATCHER
(
Lt
,
<
,
"less than"
);
GMOCK_IMPLEMENT_COMPARISON_MATCHER
(
Ne
,
!=
,
"not equal to"
);
GMOCK_IMPLEMENT_COMPARISON_MATCHER
_
(
Eq
,
==
,
"equal to"
);
GMOCK_IMPLEMENT_COMPARISON_MATCHER
_
(
Ge
,
>=
,
"greater than or equal to"
);
GMOCK_IMPLEMENT_COMPARISON_MATCHER
_
(
Gt
,
>
,
"greater than"
);
GMOCK_IMPLEMENT_COMPARISON_MATCHER
_
(
Le
,
<=
,
"less than or equal to"
);
GMOCK_IMPLEMENT_COMPARISON_MATCHER
_
(
Lt
,
<
,
"less than"
);
GMOCK_IMPLEMENT_COMPARISON_MATCHER
_
(
Ne
,
!=
,
"not equal to"
);
#undef GMOCK_IMPLEMENT_COMPARISON_MATCHER
#undef GMOCK_IMPLEMENT_COMPARISON_MATCHER
_
// Implements the polymorphic NotNull() matcher, which matches any
// pointer that is not NULL.
...
...
@@ -893,7 +893,7 @@ class MatchesRegexMatcher {
//
// We define this as a macro in order to eliminate duplicated source
// code.
#define GMOCK_IMPLEMENT_COMPARISON2_MATCHER(name, op, relation) \
#define GMOCK_IMPLEMENT_COMPARISON2_MATCHER
_
(name, op, relation) \
class name##2Matcher { \
public: \
template <typename T1, typename T2> \
...
...
@@ -917,14 +917,14 @@ class MatchesRegexMatcher {
}
// Implements Eq(), Ge(), Gt(), Le(), Lt(), and Ne() respectively.
GMOCK_IMPLEMENT_COMPARISON2_MATCHER
(
Eq
,
==
,
"equal to"
);
GMOCK_IMPLEMENT_COMPARISON2_MATCHER
(
Ge
,
>=
,
"greater than or equal to"
);
GMOCK_IMPLEMENT_COMPARISON2_MATCHER
(
Gt
,
>
,
"greater than"
);
GMOCK_IMPLEMENT_COMPARISON2_MATCHER
(
Le
,
<=
,
"less than or equal to"
);
GMOCK_IMPLEMENT_COMPARISON2_MATCHER
(
Lt
,
<
,
"less than"
);
GMOCK_IMPLEMENT_COMPARISON2_MATCHER
(
Ne
,
!=
,
"not equal to"
);
GMOCK_IMPLEMENT_COMPARISON2_MATCHER
_
(
Eq
,
==
,
"equal to"
);
GMOCK_IMPLEMENT_COMPARISON2_MATCHER
_
(
Ge
,
>=
,
"greater than or equal to"
);
GMOCK_IMPLEMENT_COMPARISON2_MATCHER
_
(
Gt
,
>
,
"greater than"
);
GMOCK_IMPLEMENT_COMPARISON2_MATCHER
_
(
Le
,
<=
,
"less than or equal to"
);
GMOCK_IMPLEMENT_COMPARISON2_MATCHER
_
(
Lt
,
<
,
"less than"
);
GMOCK_IMPLEMENT_COMPARISON2_MATCHER
_
(
Ne
,
!=
,
"not equal to"
);
#undef GMOCK_IMPLEMENT_COMPARISON2_MATCHER
#undef GMOCK_IMPLEMENT_COMPARISON2_MATCHER
_
// Implements the Not(m) matcher, which matches a value that doesn't
// match matcher m.
...
...
@@ -1364,8 +1364,8 @@ class PointeeMatcher {
template
<
typename
Pointer
>
class
Impl
:
public
MatcherInterface
<
Pointer
>
{
public:
typedef
typename
PointeeOf
<
GMOCK_REMOVE_CONST
(
// NOLINT
GMOCK_REMOVE_REFERENCE
(
Pointer
))
>::
type
Pointee
;
typedef
typename
PointeeOf
<
GMOCK_REMOVE_CONST
_
(
// NOLINT
GMOCK_REMOVE_REFERENCE
_
(
Pointer
))
>::
type
Pointee
;
explicit
Impl
(
const
InnerMatcher
&
matcher
)
:
matcher_
(
MatcherCast
<
const
Pointee
&>
(
matcher
))
{}
...
...
@@ -1474,7 +1474,7 @@ class PropertyMatcher {
// may cause double references and fail to compile. That's why we
// need GMOCK_REFERENCE_TO_CONST, which works regardless of
// PropertyType being a reference or not.
typedef
GMOCK_REFERENCE_TO_CONST
(
PropertyType
)
RefToConstProperty
;
typedef
GMOCK_REFERENCE_TO_CONST
_
(
PropertyType
)
RefToConstProperty
;
PropertyMatcher
(
PropertyType
(
Class
::*
property
)()
const
,
const
Matcher
<
RefToConstProperty
>&
matcher
)
...
...
@@ -1859,7 +1859,7 @@ inline PolymorphicMatcher<
return
MakePolymorphicMatcher
(
internal
::
PropertyMatcher
<
Class
,
PropertyType
>
(
property
,
MatcherCast
<
GMOCK_REFERENCE_TO_CONST
(
PropertyType
)
>
(
matcher
)));
MatcherCast
<
GMOCK_REFERENCE_TO_CONST
_
(
PropertyType
)
>
(
matcher
)));
// The call to MatcherCast() is required for supporting inner
// matchers of compatible types. For example, it allows
// Property(&Foo::bar, m)
...
...
include/gmock/gmock-spec-builders.h
View file @
e0d051ea
...
...
@@ -378,7 +378,7 @@ class InSequence {
bool
sequence_created_
;
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
InSequence
);
// NOLINT
}
GMOCK_ATTRIBUTE_UNUSED
;
}
GMOCK_ATTRIBUTE_UNUSED
_
;
namespace
internal
{
...
...
@@ -1562,13 +1562,13 @@ inline const T& Const(const T& x) { return x; }
// of the method used in call is a result of macro expansion.
// See CompilesWithMethodNameExpandedFromMacro tests in
// internal/gmock-spec-builders_test.cc for more details.
#define ON_CALL_IMPL_(obj, call) \
#define
GMOCK_
ON_CALL_IMPL_(obj, call) \
((obj).gmock_##call).InternalDefaultActionSetAt(__FILE__, __LINE__, \
#obj, #call)
#define ON_CALL(obj, call) ON_CALL_IMPL_(obj, call)
#define ON_CALL(obj, call)
GMOCK_
ON_CALL_IMPL_(obj, call)
#define EXPECT_CALL_IMPL_(obj, call) \
#define
GMOCK_
EXPECT_CALL_IMPL_(obj, call) \
((obj).gmock_##call).InternalExpectedAt(__FILE__, __LINE__, #obj, #call)
#define EXPECT_CALL(obj, call) EXPECT_CALL_IMPL_(obj, call)
#define EXPECT_CALL(obj, call)
GMOCK_
EXPECT_CALL_IMPL_(obj, call)
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
include/gmock/gmock.h
View file @
e0d051ea
...
...
@@ -68,7 +68,7 @@
namespace
testing
{
// Declares Google Mock flags that we want a user to use programmatically.
GMOCK_DECLARE_string
(
verbose
);
GMOCK_DECLARE_string
_
(
verbose
);
// Initializes Google Mock. This must be called before running the
// tests. In particular, it parses the command line for the flags
...
...
include/gmock/internal/gmock-internal-utils.h
View file @
e0d051ea
...
...
@@ -48,13 +48,13 @@
// Concatenates two pre-processor symbols; works for concatenating
// built-in macros like __FILE__ and __LINE__.
#define GMOCK_CONCAT_TOKEN_IMPL(foo, bar) foo##bar
#define GMOCK_CONCAT_TOKEN(foo, bar) GMOCK_CONCAT_TOKEN_IMPL(foo, bar)
#define GMOCK_CONCAT_TOKEN_IMPL
_
(foo, bar) foo##bar
#define GMOCK_CONCAT_TOKEN
_
(foo, bar) GMOCK_CONCAT_TOKEN_IMPL
_
(foo, bar)
#ifdef __GNUC__
#define GMOCK_ATTRIBUTE_UNUSED __attribute__ ((unused))
#define GMOCK_ATTRIBUTE_UNUSED
_
__attribute__ ((unused))
#else
#define GMOCK_ATTRIBUTE_UNUSED
#define GMOCK_ATTRIBUTE_UNUSED
_
#endif // __GNUC__
class
ProtocolMessage
;
...
...
@@ -88,7 +88,7 @@ struct RemoveReference<T&> { typedef T type; }; // NOLINT
// A handy wrapper around RemoveReference that works when the argument
// T depends on template parameters.
#define GMOCK_REMOVE_REFERENCE(T) \
#define GMOCK_REMOVE_REFERENCE
_
(T) \
typename ::testing::internal::RemoveReference<T>::type
// Removes const from a type if it is a const type, otherwise leaves
...
...
@@ -101,7 +101,7 @@ struct RemoveConst<const T> { typedef T type; }; // NOLINT
// A handy wrapper around RemoveConst that works when the argument
// T depends on template parameters.
#define GMOCK_REMOVE_CONST(T) \
#define GMOCK_REMOVE_CONST
_
(T) \
typename ::testing::internal::RemoveConst<T>::type
// Adds reference to a type if it is not a reference type,
...
...
@@ -114,7 +114,7 @@ struct AddReference<T&> { typedef T& type; }; // NOLINT
// A handy wrapper around AddReference that works when the argument T
// depends on template parameters.
#define GMOCK_ADD_REFERENCE(T) \
#define GMOCK_ADD_REFERENCE
_
(T) \
typename ::testing::internal::AddReference<T>::type
// Adds a reference to const on top of T as necessary. For example,
...
...
@@ -126,8 +126,8 @@ struct AddReference<T&> { typedef T& type; }; // NOLINT
// const char& ==> const char&
//
// The argument T must depend on some template parameters.
#define GMOCK_REFERENCE_TO_CONST(T) \
GMOCK_ADD_REFERENCE(const GMOCK_REMOVE_REFERENCE(T))
#define GMOCK_REFERENCE_TO_CONST
_
(T) \
GMOCK_ADD_REFERENCE
_
(const GMOCK_REMOVE_REFERENCE
_
(T))
// PointeeOf<Pointer>::type is the type of a value pointed to by a
// Pointer, which can be either a smart pointer or a raw pointer. The
...
...
include/gmock/internal/gmock-port.h
View file @
e0d051ea
...
...
@@ -183,18 +183,18 @@ template <bool>
struct
CompileAssert
{
};
#define GMOCK_COMPILE_ASSERT(expr, msg) \
#define GMOCK_COMPILE_ASSERT
_
(expr, msg) \
typedef ::testing::internal::CompileAssert<(bool(expr))> \
msg[bool(expr) ? 1 : -1]
// Implementation details of GMOCK_COMPILE_ASSERT:
// Implementation details of GMOCK_COMPILE_ASSERT
_
:
//
// - GMOCK_COMPILE_ASSERT works by defining an array type that has -1
// - GMOCK_COMPILE_ASSERT
_
works by defining an array type that has -1
// elements (and thus is invalid) when the expression is false.
//
// - The simpler definition
//
//
#define GMOCK_COMPILE_ASSERT(expr, msg) typedef char msg[(expr) ? 1 : -1]
// #define GMOCK_COMPILE_ASSERT
_
(expr, msg) typedef char msg[(expr) ? 1 : -1]
//
// does not work, as gcc supports variable-length arrays whose sizes
// are determined at run-time (this is gcc's extension and not part
...
...
@@ -202,7 +202,7 @@ struct CompileAssert {
// following code with the simple definition:
//
// int foo;
// GMOCK_COMPILE_ASSERT(foo, msg); // not supposed to compile as foo is
// GMOCK_COMPILE_ASSERT
_
(foo, msg); // not supposed to compile as foo is
// // not a compile-time constant.
//
// - By using the type CompileAssert<(bool(expr))>, we ensures that
...
...
@@ -216,7 +216,7 @@ struct CompileAssert {
//
// instead, these compilers will refuse to compile
//
// GMOCK_COMPILE_ASSERT(5 > 0, some_message);
// GMOCK_COMPILE_ASSERT
_
(5 > 0, some_message);
//
// (They seem to think the ">" in "5 > 0" marks the end of the
// template argument list.)
...
...
@@ -293,22 +293,23 @@ class GMockCheckProvider {
}
// namespace internal
}
// namespace testing
// Macro for referencing flags.
// Macro for referencing flags. This is public as we want the user to
// use this syntax to reference Google Mock flags.
#define GMOCK_FLAG(name) FLAGS_gmock_##name
// Macros for declaring flags.
#define GMOCK_DECLARE_bool(name) extern bool GMOCK_FLAG(name)
#define GMOCK_DECLARE_int32(name) \
#define GMOCK_DECLARE_bool
_
(name) extern bool GMOCK_FLAG(name)
#define GMOCK_DECLARE_int32
_
(name) \
extern ::testing::internal::Int32 GMOCK_FLAG(name)
#define GMOCK_DECLARE_string(name) \
#define GMOCK_DECLARE_string
_
(name) \
extern ::testing::internal::String GMOCK_FLAG(name)
// Macros for defining flags.
#define GMOCK_DEFINE_bool(name, default_val, doc) \
#define GMOCK_DEFINE_bool
_
(name, default_val, doc) \
bool GMOCK_FLAG(name) = (default_val)
#define GMOCK_DEFINE_int32(name, default_val, doc) \
#define GMOCK_DEFINE_int32
_
(name, default_val, doc) \
::testing::internal::Int32 GMOCK_FLAG(name) = (default_val)
#define GMOCK_DEFINE_string(name, default_val, doc) \
#define GMOCK_DEFINE_string
_
(name, default_val, doc) \
::testing::internal::String GMOCK_FLAG(name) = (default_val)
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
src/gmock.cc
View file @
e0d051ea
...
...
@@ -34,7 +34,7 @@
namespace
testing
{
GMOCK_DEFINE_string
(
verbose
,
internal
::
kWarningVerbosity
,
GMOCK_DEFINE_string
_
(
verbose
,
internal
::
kWarningVerbosity
,
"Controls how verbose Google Mock's output is."
" Valid values:
\n
"
" info - prints all messages.
\n
"
...
...
test/gmock-internal-utils_test.cc
View file @
e0d051ea
...
...
@@ -103,11 +103,11 @@ TEST(RemoveReferenceTest, RemovesReference) {
CompileAssertTypesEqual
<
const
char
,
RemoveReference
<
const
char
&>::
type
>
();
}
// Tests GMOCK_REMOVE_REFERENCE.
// Tests GMOCK_REMOVE_REFERENCE
_
.
template
<
typename
T1
,
typename
T2
>
void
TestGMockRemoveReference
()
{
CompileAssertTypesEqual
<
T1
,
GMOCK_REMOVE_REFERENCE
(
T2
)
>
();
CompileAssertTypesEqual
<
T1
,
GMOCK_REMOVE_REFERENCE
_
(
T2
)
>
();
}
TEST
(
RemoveReferenceTest
,
MacroVersion
)
{
...
...
@@ -127,11 +127,11 @@ TEST(RemoveConstTest, RemovesConst) {
CompileAssertTypesEqual
<
int
,
RemoveConst
<
const
int
>::
type
>
();
}
// Tests GMOCK_REMOVE_CONST.
// Tests GMOCK_REMOVE_CONST
_
.
template
<
typename
T1
,
typename
T2
>
void
TestGMockRemoveConst
()
{
CompileAssertTypesEqual
<
T1
,
GMOCK_REMOVE_CONST
(
T2
)
>
();
CompileAssertTypesEqual
<
T1
,
GMOCK_REMOVE_CONST
_
(
T2
)
>
();
}
TEST
(
RemoveConstTest
,
MacroVersion
)
{
...
...
@@ -152,11 +152,11 @@ TEST(AddReferenceTest, AddsReference) {
CompileAssertTypesEqual
<
const
char
&
,
AddReference
<
const
char
>::
type
>
();
}
// Tests GMOCK_ADD_REFERENCE.
// Tests GMOCK_ADD_REFERENCE
_
.
template
<
typename
T1
,
typename
T2
>
void
TestGMockAddReference
()
{
CompileAssertTypesEqual
<
T1
,
GMOCK_ADD_REFERENCE
(
T2
)
>
();
CompileAssertTypesEqual
<
T1
,
GMOCK_ADD_REFERENCE
_
(
T2
)
>
();
}
TEST
(
AddReferenceTest
,
MacroVersion
)
{
...
...
@@ -164,11 +164,11 @@ TEST(AddReferenceTest, MacroVersion) {
TestGMockAddReference
<
const
char
&
,
const
char
&>
();
}
// Tests GMOCK_REFERENCE_TO_CONST.
// Tests GMOCK_REFERENCE_TO_CONST
_
.
template
<
typename
T1
,
typename
T2
>
void
TestGMockReferenceToConst
()
{
CompileAssertTypesEqual
<
T1
,
GMOCK_REFERENCE_TO_CONST
(
T2
)
>
();
CompileAssertTypesEqual
<
T1
,
GMOCK_REFERENCE_TO_CONST
_
(
T2
)
>
();
}
TEST
(
GMockReferenceToConstTest
,
Works
)
{
...
...
@@ -207,8 +207,9 @@ class Derived : public Base {};
// Tests that ImplicitlyConvertible<T1, T2>::value is a compile-time constant.
TEST
(
ImplicitlyConvertibleTest
,
ValueIsCompileTimeConstant
)
{
GMOCK_COMPILE_ASSERT
((
ImplicitlyConvertible
<
int
,
int
>::
value
),
const_true
);
GMOCK_COMPILE_ASSERT
((
!
ImplicitlyConvertible
<
void
*
,
int
*>::
value
),
const_false
);
GMOCK_COMPILE_ASSERT_
((
ImplicitlyConvertible
<
int
,
int
>::
value
),
const_true
);
GMOCK_COMPILE_ASSERT_
((
!
ImplicitlyConvertible
<
void
*
,
int
*>::
value
),
const_false
);
}
// Tests that ImplicitlyConvertible<T1, T2>::value is true when T1 can
...
...
@@ -233,8 +234,8 @@ TEST(ImplicitlyConvertibleTest, ValueIsFalseWhenNotConvertible) {
// Tests that IsAProtocolMessage<T>::value is a compile-time constant.
TEST
(
IsAProtocolMessageTest
,
ValueIsCompileTimeConstant
)
{
GMOCK_COMPILE_ASSERT
(
IsAProtocolMessage
<
ProtocolMessage
>::
value
,
const_true
);
GMOCK_COMPILE_ASSERT
(
!
IsAProtocolMessage
<
int
>::
value
,
const_false
);
GMOCK_COMPILE_ASSERT
_
(
IsAProtocolMessage
<
ProtocolMessage
>::
value
,
const_true
);
GMOCK_COMPILE_ASSERT
_
(
!
IsAProtocolMessage
<
int
>::
value
,
const_false
);
}
// Tests that IsAProtocolMessage<T>::value is true when T is
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment