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
c069d7fe
"vscode:/vscode.git/clone" did not exist on "d935e8e3edaf0987ee8a0a664593e17771587393"
Commit
c069d7fe
authored
Feb 02, 2009
by
zhanyong.wan
Browse files
Improves ACTION* to allow explicit instantiating with reference types.
parent
5b95fa7b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
146 additions
and
116 deletions
+146
-116
include/gmock/gmock-generated-actions.h
include/gmock/gmock-generated-actions.h
+110
-110
include/gmock/gmock-generated-actions.h.pump
include/gmock/gmock-generated-actions.h.pump
+6
-6
test/gmock-generated-actions_test.cc
test/gmock-generated-actions_test.cc
+30
-0
No files found.
include/gmock/gmock-generated-actions.h
View file @
c069d7fe
...
@@ -1611,12 +1611,12 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
...
@@ -1611,12 +1611,12 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg9_type arg9) const;\
arg9_type arg9) const;\
const
p0##_type p0;\
p0##_type p0;\
};\
};\
template <typename F> operator ::testing::Action<F>() const {\
template <typename F> operator ::testing::Action<F>() const {\
return ::testing::Action<F>(new gmock_Impl<F>(p0));\
return ::testing::Action<F>(new gmock_Impl<F>(p0));\
}\
}\
const
p0##_type p0;\
p0##_type p0;\
};\
};\
template <typename p0##_type>\
template <typename p0##_type>\
inline name##ActionP<p0##_type> name(p0##_type p0) {\
inline name##ActionP<p0##_type> name(p0##_type p0) {\
...
@@ -1662,14 +1662,14 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
...
@@ -1662,14 +1662,14 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg9_type arg9) const;\
arg9_type arg9) const;\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
};\
};\
template <typename F> operator ::testing::Action<F>() const {\
template <typename F> operator ::testing::Action<F>() const {\
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\
}\
}\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
};\
};\
template <typename p0##_type, typename p1##_type>\
template <typename p0##_type, typename p1##_type>\
inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \
inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \
...
@@ -1716,16 +1716,16 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
...
@@ -1716,16 +1716,16 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg9_type arg9) const;\
arg9_type arg9) const;\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
};\
};\
template <typename F> operator ::testing::Action<F>() const {\
template <typename F> operator ::testing::Action<F>() const {\
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\
}\
}\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
};\
};\
template <typename p0##_type, typename p1##_type, typename p2##_type>\
template <typename p0##_type, typename p1##_type, typename p2##_type>\
inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
...
@@ -1775,18 +1775,18 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
...
@@ -1775,18 +1775,18 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg9_type arg9) const;\
arg9_type arg9) const;\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
const
p3##_type p3;\
p3##_type p3;\
};\
};\
template <typename F> operator ::testing::Action<F>() const {\
template <typename F> operator ::testing::Action<F>() const {\
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\
}\
}\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
const
p3##_type p3;\
p3##_type p3;\
};\
};\
template <typename p0##_type, typename p1##_type, typename p2##_type, \
template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type>\
typename p3##_type>\
...
@@ -1841,20 +1841,20 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
...
@@ -1841,20 +1841,20 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg9_type arg9) const;\
arg9_type arg9) const;\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
const
p3##_type p3;\
p3##_type p3;\
const
p4##_type p4;\
p4##_type p4;\
};\
};\
template <typename F> operator ::testing::Action<F>() const {\
template <typename F> operator ::testing::Action<F>() const {\
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\
}\
}\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
const
p3##_type p3;\
p3##_type p3;\
const
p4##_type p4;\
p4##_type p4;\
};\
};\
template <typename p0##_type, typename p1##_type, typename p2##_type, \
template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type>\
typename p3##_type, typename p4##_type>\
...
@@ -1910,22 +1910,22 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
...
@@ -1910,22 +1910,22 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg9_type arg9) const;\
arg9_type arg9) const;\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
const
p3##_type p3;\
p3##_type p3;\
const
p4##_type p4;\
p4##_type p4;\
const
p5##_type p5;\
p5##_type p5;\
};\
};\
template <typename F> operator ::testing::Action<F>() const {\
template <typename F> operator ::testing::Action<F>() const {\
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\
}\
}\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
const
p3##_type p3;\
p3##_type p3;\
const
p4##_type p4;\
p4##_type p4;\
const
p5##_type p5;\
p5##_type p5;\
};\
};\
template <typename p0##_type, typename p1##_type, typename p2##_type, \
template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type, typename p5##_type>\
typename p3##_type, typename p4##_type, typename p5##_type>\
...
@@ -1984,25 +1984,25 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
...
@@ -1984,25 +1984,25 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg9_type arg9) const;\
arg9_type arg9) const;\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
const
p3##_type p3;\
p3##_type p3;\
const
p4##_type p4;\
p4##_type p4;\
const
p5##_type p5;\
p5##_type p5;\
const
p6##_type p6;\
p6##_type p6;\
};\
};\
template <typename F> operator ::testing::Action<F>() const {\
template <typename F> operator ::testing::Action<F>() const {\
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
p6));\
p6));\
}\
}\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
const
p3##_type p3;\
p3##_type p3;\
const
p4##_type p4;\
p4##_type p4;\
const
p5##_type p5;\
p5##_type p5;\
const
p6##_type p6;\
p6##_type p6;\
};\
};\
template <typename p0##_type, typename p1##_type, typename p2##_type, \
template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \
...
@@ -2066,27 +2066,27 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
...
@@ -2066,27 +2066,27 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg9_type arg9) const;\
arg9_type arg9) const;\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
const
p3##_type p3;\
p3##_type p3;\
const
p4##_type p4;\
p4##_type p4;\
const
p5##_type p5;\
p5##_type p5;\
const
p6##_type p6;\
p6##_type p6;\
const
p7##_type p7;\
p7##_type p7;\
};\
};\
template <typename F> operator ::testing::Action<F>() const {\
template <typename F> operator ::testing::Action<F>() const {\
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
p6, p7));\
p6, p7));\
}\
}\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
const
p3##_type p3;\
p3##_type p3;\
const
p4##_type p4;\
p4##_type p4;\
const
p5##_type p5;\
p5##_type p5;\
const
p6##_type p6;\
p6##_type p6;\
const
p7##_type p7;\
p7##_type p7;\
};\
};\
template <typename p0##_type, typename p1##_type, typename p2##_type, \
template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \
...
@@ -2152,29 +2152,29 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
...
@@ -2152,29 +2152,29 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg9_type arg9) const;\
arg9_type arg9) const;\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
const
p3##_type p3;\
p3##_type p3;\
const
p4##_type p4;\
p4##_type p4;\
const
p5##_type p5;\
p5##_type p5;\
const
p6##_type p6;\
p6##_type p6;\
const
p7##_type p7;\
p7##_type p7;\
const
p8##_type p8;\
p8##_type p8;\
};\
};\
template <typename F> operator ::testing::Action<F>() const {\
template <typename F> operator ::testing::Action<F>() const {\
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
p6, p7, p8));\
p6, p7, p8));\
}\
}\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
const
p3##_type p3;\
p3##_type p3;\
const
p4##_type p4;\
p4##_type p4;\
const
p5##_type p5;\
p5##_type p5;\
const
p6##_type p6;\
p6##_type p6;\
const
p7##_type p7;\
p7##_type p7;\
const
p8##_type p8;\
p8##_type p8;\
};\
};\
template <typename p0##_type, typename p1##_type, typename p2##_type, \
template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \
...
@@ -2242,31 +2242,31 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
...
@@ -2242,31 +2242,31 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
arg9_type arg9) const;\
arg9_type arg9) const;\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
const
p3##_type p3;\
p3##_type p3;\
const
p4##_type p4;\
p4##_type p4;\
const
p5##_type p5;\
p5##_type p5;\
const
p6##_type p6;\
p6##_type p6;\
const
p7##_type p7;\
p7##_type p7;\
const
p8##_type p8;\
p8##_type p8;\
const
p9##_type p9;\
p9##_type p9;\
};\
};\
template <typename F> operator ::testing::Action<F>() const {\
template <typename F> operator ::testing::Action<F>() const {\
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
p6, p7, p8, p9));\
p6, p7, p8, p9));\
}\
}\
const
p0##_type p0;\
p0##_type p0;\
const
p1##_type p1;\
p1##_type p1;\
const
p2##_type p2;\
p2##_type p2;\
const
p3##_type p3;\
p3##_type p3;\
const
p4##_type p4;\
p4##_type p4;\
const
p5##_type p5;\
p5##_type p5;\
const
p6##_type p6;\
p6##_type p6;\
const
p7##_type p7;\
p7##_type p7;\
const
p8##_type p8;\
p8##_type p8;\
const
p9##_type p9;\
p9##_type p9;\
};\
};\
template <typename p0##_type, typename p1##_type, typename p2##_type, \
template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \
...
...
include/gmock/gmock-generated-actions.h.pump
View file @
c069d7fe
...
@@ -718,15 +718,15 @@ $range j 0..i-1
...
@@ -718,15 +718,15 @@ $range j 0..i-1
$
var
ctor_param_list
=
[[
$
for
j
,
[[
p
$
j
##
_type
gmock_p
$
j
]]]]
$
var
ctor_param_list
=
[[
$
for
j
,
[[
p
$
j
##
_type
gmock_p
$
j
]]]]
$
var
param_types_and_names
=
[[
$
for
j
,
[[
p
$
j
##
_type
p
$
j
]]]]
$
var
param_types_and_names
=
[[
$
for
j
,
[[
p
$
j
##
_type
p
$
j
]]]]
$
var
inits
=
[[
$
if
i
==
0
[[]]
$
else
[[
:
$
for
j
,
[[
p
$
j
(
gmock_p
$
j
)]]]]]]
$
var
inits
=
[[
$
if
i
==
0
[[]]
$
else
[[
:
$
for
j
,
[[
p
$
j
(
gmock_p
$
j
)]]]]]]
$
var
const_
param_field_decls
=
[[
$
for
j
$
var
param_field_decls
=
[[
$
for
j
[[
[[
const
p
$
j
##
_type
p
$
j
;
\
p
$
j
##
_type
p
$
j
;
\
]]]]
]]]]
$
var
const_
param_field_decls2
=
[[
$
for
j
$
var
param_field_decls2
=
[[
$
for
j
[[
[[
const
p
$
j
##
_type
p
$
j
;
\
p
$
j
##
_type
p
$
j
;
\
]]]]
]]]]
$
var
params
=
[[
$
for
j
,
[[
p
$
j
]]]]
$
var
params
=
[[
$
for
j
,
[[
p
$
j
]]]]
$
var
param_types
=
[[
$
if
i
==
0
[[]]
$
else
[[
<
$
for
j
,
[[
p
$
j
##
_type
]]
>
]]]]
$
var
param_types
=
[[
$
if
i
==
0
[[]]
$
else
[[
<
$
for
j
,
[[
p
$
j
##
_type
]]
>
]]]]
...
@@ -754,11 +754,11 @@ $var macro_name = [[$if i==0 [[ACTION]] $elif i==1 [[ACTION_P]]
...
@@ -754,11 +754,11 @@ $var macro_name = [[$if i==0 [[ACTION]] $elif i==1 [[ACTION_P]]
}
\
}
\
template
<
$
typename_arg_types
>
\
template
<
$
typename_arg_types
>
\
return_type
gmock_PerformImpl
(
const
args_type
&
args
,
[[]]
return_type
gmock_PerformImpl
(
const
args_type
&
args
,
[[]]
$
arg_types_and_names
)
const
;
\$
const_
param_field_decls
$
arg_types_and_names
)
const
;
\$
param_field_decls
};
\
};
\
template
<
typename
F
>
operator
::
testing
::
Action
<
F
>
()
const
{
\
template
<
typename
F
>
operator
::
testing
::
Action
<
F
>
()
const
{
\
return
::
testing
::
Action
<
F
>
(
new
gmock_Impl
<
F
>
(
$
params
));
\
return
::
testing
::
Action
<
F
>
(
new
gmock_Impl
<
F
>
(
$
params
));
\
}
\$
const_
param_field_decls2
}
\$
param_field_decls2
};
\$
template
};
\$
template
inline
$
class_name
$
param_types
name
(
$
param_types_and_names
)
{
\
inline
$
class_name
$
param_types
name
(
$
param_types_and_names
)
{
\
return
$
class_name
$
param_types
(
$
params
);
\
return
$
class_name
$
param_types
(
$
params
);
\
...
...
test/gmock-generated-actions_test.cc
View file @
c069d7fe
...
@@ -1280,5 +1280,35 @@ TEST(ActionPnMacroTest, TypesAreCorrect) {
...
@@ -1280,5 +1280,35 @@ TEST(ActionPnMacroTest, TypesAreCorrect) {
Plus
(
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
'0'
);
Plus
(
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
'0'
);
}
}
// Tests that an ACTION_P*() action can be explicitly instantiated
// with reference-typed parameters.
ACTION_P
(
Plus1
,
x
)
{
return
x
;
}
ACTION_P2
(
Plus2
,
x
,
y
)
{
return
x
+
y
;
}
ACTION_P3
(
Plus3
,
x
,
y
,
z
)
{
return
x
+
y
+
z
;
}
ACTION_P10
(
Plus10
,
a0
,
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
)
{
return
a0
+
a1
+
a2
+
a3
+
a4
+
a5
+
a6
+
a7
+
a8
+
a9
;
}
TEST
(
ActionPnMacroTest
,
CanExplicitlyInstantiateWithReferenceTypes
)
{
int
x
=
1
,
y
=
2
,
z
=
3
;
const
tuple
<>
empty
=
make_tuple
();
Action
<
int
()
>
a
=
Plus1
<
int
&>
(
x
);
EXPECT_EQ
(
1
,
a
.
Perform
(
empty
));
a
=
Plus2
<
const
int
&
,
int
&>
(
x
,
y
);
EXPECT_EQ
(
3
,
a
.
Perform
(
empty
));
a
=
Plus3
<
int
&
,
const
int
&
,
int
&>
(
x
,
y
,
z
);
EXPECT_EQ
(
6
,
a
.
Perform
(
empty
));
int
n
[
10
]
=
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
};
a
=
Plus10
<
const
int
&
,
int
&
,
const
int
&
,
int
&
,
const
int
&
,
int
&
,
const
int
&
,
int
&
,
const
int
&
,
int
&>
(
n
[
0
],
n
[
1
],
n
[
2
],
n
[
3
],
n
[
4
],
n
[
5
],
n
[
6
],
n
[
7
],
n
[
8
],
n
[
9
]);
EXPECT_EQ
(
55
,
a
.
Perform
(
empty
));
}
}
// namespace gmock_generated_actions_test
}
// namespace gmock_generated_actions_test
}
// namespace testing
}
// namespace testing
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