mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Preview of clang-format changes and CI
This commit is contained in:
parent
bfd1701fcb
commit
805e3b02bf
98 changed files with 6339 additions and 11357 deletions
|
|
@ -8,99 +8,74 @@
|
|||
|
||||
#include "function_impl_template.hpp"
|
||||
|
||||
#define MOCK_MOVE(z, n, d) \
|
||||
mock::detail::move_if_not_lvalue_reference< T##n >( t##n )
|
||||
#define MOCK_MOVE(z, n, d) mock::detail::move_if_not_lvalue_reference<T##n>(t##n)
|
||||
|
||||
namespace mock
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template< typename Signature > class function;
|
||||
namespace mock { namespace detail {
|
||||
template<typename Signature>
|
||||
class function;
|
||||
|
||||
template< typename R
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(MOCK_NUM_ARGS, typename T) >
|
||||
class function< R ( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) >
|
||||
template<typename R BOOST_PP_ENUM_TRAILING_PARAMS(MOCK_NUM_ARGS, typename T)>
|
||||
class function<R(BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T))>
|
||||
{
|
||||
public:
|
||||
typedef R result_type;
|
||||
|
||||
template< typename Args >
|
||||
template<typename Args>
|
||||
struct sig
|
||||
{
|
||||
typedef R type;
|
||||
};
|
||||
|
||||
private:
|
||||
typedef function_impl<
|
||||
R ( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) )
|
||||
> impl_type;
|
||||
typedef function_impl<R(BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T))> impl_type;
|
||||
typedef typename impl_type::wrapper_type expectation_type;
|
||||
typedef typename impl_type::error_type error_type;
|
||||
|
||||
public:
|
||||
function()
|
||||
: impl_( boost::make_shared< impl_type >() )
|
||||
{}
|
||||
function() : impl_(boost::make_shared<impl_type>()) {}
|
||||
|
||||
bool verify() const
|
||||
bool verify() const { return impl_->verify(); }
|
||||
bool verify(const char* file, int line) const
|
||||
{
|
||||
error_type::pass(file, line);
|
||||
return impl_->verify();
|
||||
}
|
||||
bool verify( const char* file, int line ) const
|
||||
void reset() { impl_->reset(); }
|
||||
void reset(const char* file, int line)
|
||||
{
|
||||
error_type::pass( file, line );
|
||||
return impl_->verify();
|
||||
}
|
||||
void reset()
|
||||
{
|
||||
impl_->reset();
|
||||
}
|
||||
void reset( const char* file, int line )
|
||||
{
|
||||
error_type::pass( file, line );
|
||||
error_type::pass(file, line);
|
||||
impl_->reset();
|
||||
}
|
||||
|
||||
expectation_type expect( const char* file, int line )
|
||||
expectation_type expect(const char* file, int line)
|
||||
{
|
||||
error_type::pass( file, line );
|
||||
return impl_->expect( file, line );
|
||||
error_type::pass(file, line);
|
||||
return impl_->expect(file, line);
|
||||
}
|
||||
expectation_type expect()
|
||||
expectation_type expect() { return impl_->expect(); }
|
||||
|
||||
R operator()(BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, T, t)) const
|
||||
{
|
||||
return impl_->expect();
|
||||
return (*impl_)(BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_MOVE, _));
|
||||
}
|
||||
|
||||
R operator()(
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, T, t) ) const
|
||||
{
|
||||
return (*impl_)( BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_MOVE, _) );
|
||||
}
|
||||
friend std::ostream& operator<<(std::ostream& s, const function& f) { return s << *f.impl_; }
|
||||
|
||||
friend std::ostream& operator<<( std::ostream& s, const function& f )
|
||||
function& operator()(context& c, boost::unit_test::const_string instance)
|
||||
{
|
||||
return s << *f.impl_;
|
||||
}
|
||||
|
||||
function& operator()( context& c,
|
||||
boost::unit_test::const_string instance )
|
||||
{
|
||||
impl_->add( c, impl_.get(), instance, boost::none, "" );
|
||||
impl_->add(c, impl_.get(), instance, boost::none, "");
|
||||
return *this;
|
||||
}
|
||||
|
||||
void configure( context& c, const void* p,
|
||||
boost::unit_test::const_string instance,
|
||||
boost::optional< type_name > type,
|
||||
boost::unit_test::const_string name ) const
|
||||
void configure(context& c, const void* p, boost::unit_test::const_string instance,
|
||||
boost::optional<type_name> type, boost::unit_test::const_string name) const
|
||||
{
|
||||
impl_->add( c, p, instance, type, name );
|
||||
impl_->add(c, p, instance, type, name);
|
||||
}
|
||||
|
||||
private:
|
||||
boost::shared_ptr< impl_type > impl_;
|
||||
boost::shared_ptr<impl_type> impl_;
|
||||
};
|
||||
}
|
||||
} // mock
|
||||
}} // namespace mock::detail
|
||||
|
||||
#undef MOCK_MOVE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue