diff options
author | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2010-10-14 06:51:27 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2010-10-14 06:51:27 +0000 |
commit | 2321b2a6757328bbf30b69af434c28dac3060b83 (patch) | |
tree | 0e4466573cd7a188dc37658acc7b2653f2e67db7 /include/gmock/gmock-more-actions.h | |
parent | 7dfbea4976d41421b82c7988017cf1c695104236 (diff) | |
download | googletest-2321b2a6757328bbf30b69af434c28dac3060b83.tar.gz googletest-2321b2a6757328bbf30b69af434c28dac3060b83.tar.bz2 googletest-2321b2a6757328bbf30b69af434c28dac3060b83.zip |
Adds action SaveArgPointee.
Diffstat (limited to 'include/gmock/gmock-more-actions.h')
-rw-r--r-- | include/gmock/gmock-more-actions.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/gmock/gmock-more-actions.h b/include/gmock/gmock-more-actions.h index e418505a..a547a648 100644 --- a/include/gmock/gmock-more-actions.h +++ b/include/gmock/gmock-more-actions.h @@ -36,6 +36,8 @@ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_ +#include <algorithm> + #include "gmock/gmock-generated-actions.h" namespace testing { @@ -153,6 +155,14 @@ ACTION_TEMPLATE(SaveArg, *pointer = ::std::tr1::get<k>(args); } +// Action SaveArgPointee<k>(pointer) saves the value pointed to +// by the k-th (0-based) argument of the mock function to *pointer. +ACTION_TEMPLATE(SaveArgPointee, + HAS_1_TEMPLATE_PARAMS(int, k), + AND_1_VALUE_PARAMS(pointer)) { + *pointer = *::std::tr1::get<k>(args); +} + // Action SetArgReferee<k>(value) assigns 'value' to the variable // referenced by the k-th (0-based) argument of the mock function. ACTION_TEMPLATE(SetArgReferee, |