mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Add support for unlimited number of sequences in one call
This removes the need for those preprocessor macros and the MOCK_MAX_SEQUENCES define.
This commit is contained in:
parent
c34e4224fe
commit
bb77c1702f
5 changed files with 18 additions and 27 deletions
|
|
@ -18,10 +18,6 @@
|
|||
# define MOCK_USE_BOOST_TEST
|
||||
#endif
|
||||
|
||||
#ifndef MOCK_MAX_SEQUENCES
|
||||
# define MOCK_MAX_SEQUENCES 10
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_MUTEX) && !defined(BOOST_NO_0X_HDR_MUTEX)
|
||||
# ifndef MOCK_NO_HDR_MUTEX
|
||||
# define MOCK_HDR_MUTEX
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@
|
|||
#include "expectation.hpp"
|
||||
#include "mutex.hpp"
|
||||
#include "verifiable.hpp"
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
#include <boost/test/utils/lazy_ostream.hpp>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
|
@ -187,19 +185,14 @@ namespace mock { namespace detail {
|
|||
return *this;
|
||||
}
|
||||
|
||||
#define MOCK_FUNCTION_IN_ADD(z, n, d) this->e_->add(s##n);
|
||||
|
||||
#define MOCK_FUNCTION_IN(z, n, d) \
|
||||
wrapper& in(BOOST_PP_ENUM_PARAMS(n, sequence& s)) \
|
||||
{ \
|
||||
BOOST_PP_REPEAT(n, MOCK_FUNCTION_IN_ADD, _) \
|
||||
return *this; \
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT(MOCK_MAX_SEQUENCES, MOCK_FUNCTION_IN, _)
|
||||
|
||||
#undef MOCK_FUNCTION_IN
|
||||
#undef MOCK_FUNCTION_IN_ADD
|
||||
/// Ensure the expectation is met in the given sequence(s)
|
||||
template<class... MockSequences>
|
||||
wrapper& in(sequence& s0, MockSequences&... s)
|
||||
{
|
||||
using expander = int[];
|
||||
(void)expander{ (e_->add(s0), 0), (e_->add(s), 0)... };
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename TT>
|
||||
void calls(TT t)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue