diff --git a/thirdparty/turtle/README.txt b/thirdparty/turtle/README.txt index 784e784f2f..59a190ce92 100644 --- a/thirdparty/turtle/README.txt +++ b/thirdparty/turtle/README.txt @@ -1,4 +1,4 @@ -This directory contains the Turtle Mocking Framework version 1.3.2 (0dd0dfa15fbc2774213523fb3a65bc1acb2857b3) +This directory contains the Turtle Mocking Framework version 2.0.0 (2a54301cc3c5bb48c850913e15a6264f8140e86d) from https://github.com/mat007/turtle Turtle is a C++ mock object library based on Boost with a focus on usability, simplicity and flexibility. diff --git a/thirdparty/turtle/turtle/detail/addressof.hpp b/thirdparty/turtle/turtle/detail/addressof.hpp deleted file mode 100644 index 4e48a8dc2b..0000000000 --- a/thirdparty/turtle/turtle/detail/addressof.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// http://turtle.sourceforge.net -// -// Copyright Mathieu Champlon 2013 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef MOCK_ADDRESSOF_HPP_INCLUDED -#define MOCK_ADDRESSOF_HPP_INCLUDED - -#include "../config.hpp" -#include - -namespace mock -{ -namespace detail -{ - using boost::addressof; - -#ifdef MOCK_NULLPTR - - inline const std::nullptr_t* addressof( const std::nullptr_t& p ) - { - return &p; - } - inline std::nullptr_t* addressof( std::nullptr_t& p ) - { - return &p; - } - -#endif -} -} // mock - -#endif // MOCK_ADDRESSOF_HPP_INCLUDED diff --git a/thirdparty/turtle/turtle/detail/expectation_template.hpp b/thirdparty/turtle/turtle/detail/expectation_template.hpp deleted file mode 100644 index 20bf6f443c..0000000000 --- a/thirdparty/turtle/turtle/detail/expectation_template.hpp +++ /dev/null @@ -1,276 +0,0 @@ -// http://turtle.sourceforge.net -// -// Copyright Mathieu Champlon 2012 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include "matcher_base_template.hpp" - -#define MOCK_EXPECTATION_INITIALIZE(z, n, d) \ - BOOST_PP_COMMA_IF(n) c##n##_( c##n ) - -#define MOCK_EXPECTATION_MEMBER(z, n, d) \ - matcher< T##n, Constraint_##n > c##n##_; - -#define MOCK_EXPECTATION_IS_VALID(z, n, d) \ - BOOST_PP_IF(n, &&,) c##n##_( mock::detail::move_if_not_lvalue_reference< T##n >( a##n ) ) - -#define MOCK_EXPECTATION_SERIALIZE(z, n, d) \ - BOOST_PP_IF(n, << ", " <<,) c##n##_ - -#define MOCK_EXPECTATION_SERIALIZE_ANY(z, n, d) \ - BOOST_PP_IF(n, << ", " <<,) "any" - -#define MOCK_EXPECTATION_PARAM(z, n, Args) \ - mock::detail::move_if_not_lvalue_reference< T##n >( a##n ) - -#define MOCK_REF_ARG(z, n, d) \ - typename ref_arg< T##n >::type a##n - -#define MOCK_REF_ARG_T(z, n, d) \ - typename ref_arg< T##n >::type - -namespace mock -{ -namespace detail -{ - template< typename Signature > class default_matcher; - - template< - BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, typename T) > - class default_matcher< void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) > - : public matcher_base< void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) > - { - private: - virtual bool operator()( - BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_REF_ARG_T, _) ) - { - return true; - } - virtual void serialize( std::ostream& s ) const - { - s << "" BOOST_PP_REPEAT(MOCK_NUM_ARGS, - MOCK_EXPECTATION_SERIALIZE_ANY, _); - } - }; - -#ifndef MOCK_NUM_ARGS_0 - - template< typename Constraint, typename Signature > class single_matcher; - - template< - BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, typename Constraint_), - BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, typename T) - > - class single_matcher< - void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, Constraint_) ), - void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) - > - : public matcher_base< void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) > - { - public: - single_matcher( - BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, Constraint_, c) ) - : BOOST_PP_REPEAT(MOCK_NUM_ARGS, - MOCK_EXPECTATION_INITIALIZE, _) - {} - - private: - virtual bool operator()( - BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_REF_ARG, _) ) - { - return BOOST_PP_REPEAT(MOCK_NUM_ARGS, - MOCK_EXPECTATION_IS_VALID, _); - } - virtual void serialize( std::ostream& s ) const - { - s << BOOST_PP_REPEAT(MOCK_NUM_ARGS, - MOCK_EXPECTATION_SERIALIZE, _); - } - - private: - BOOST_PP_REPEAT( - MOCK_NUM_ARGS, MOCK_EXPECTATION_MEMBER, _) -}; - - template< typename F, typename Signature > class multi_matcher; - - template< typename F, - BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, typename T) > - class multi_matcher< F, void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) > - : public matcher_base< void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) > - { - public: - multi_matcher( const F& f ) - : f_( f ) - {} - - private: - virtual bool operator()( - BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_REF_ARG, _) ) - { - return f_( BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_EXPECTATION_PARAM, _) ); - } - virtual void serialize( std::ostream& s ) const - { - s << mock::format( f_ ); - } - - private: - F f_; - }; - -#endif - - template< typename Signature > class expectation; - - template< typename R - BOOST_PP_ENUM_TRAILING_PARAMS(MOCK_NUM_ARGS, typename T) > - class expectation< R (BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS,T)) > - : public action< R, R (BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS,T)) > - { - public: - expectation() - : invocation_( boost::make_shared< unlimited >() ) - , matcher_( - boost::make_shared< - default_matcher< - void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) - > - > () ) - , file_( "unknown location" ) - , line_( 0 ) - {} - expectation( const char* file, int line ) - : invocation_( boost::make_shared< unlimited >() ) - , matcher_( - boost::make_shared< - default_matcher< - void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) - > - > () ) - , file_( file ) - , line_( line ) - {} - - ~expectation() - { - for( sequences_cit it = sequences_.begin(); - it != sequences_.end(); ++it ) - (*it)->remove( this ); - } - - void invoke( const boost::shared_ptr< invocation >& i ) - { - invocation_ = i; - } - -#ifndef MOCK_NUM_ARGS_0 - template< - BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, typename Constraint_) - > - expectation& with( - BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, Constraint_, c) ) - { - matcher_.reset( - new single_matcher< - void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, Constraint_) ), - void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) - >( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, c) ) ); - return *this; - } -#if MOCK_NUM_ARGS > 1 - template< typename Constraint > - expectation& with( const Constraint& c ) - { - matcher_.reset( - new multi_matcher< - Constraint, - void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) - >( c ) ); - return *this; - } -#endif -#endif - - void add( sequence& s ) - { - s.impl_->add( this ); - sequences_.push_back( s.impl_ ); - } - - bool verify() const - { - return invocation_->verify(); - } - - bool is_valid( - BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_REF_ARG, _) ) const - { - return !invocation_->exhausted() - && (*matcher_)( BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_EXPECTATION_PARAM, _) ); - } - - bool invoke() const - { - for( sequences_cit it = sequences_.begin(); - it != sequences_.end(); ++it ) - if( ! (*it)->is_valid( this ) ) - return false; - bool result = invocation_->invoke(); - for( sequences_cit it = sequences_.begin(); - it != sequences_.end(); ++it ) - (*it)->invalidate( this ); - return result; - } - - const char* file() const - { - return file_; - } - int line() const - { - return line_; - } - - friend std::ostream& operator<<( - std::ostream& s, const expectation& e ) - { - return s << ( e.invocation_->exhausted() ? 'v' : '.' ) - << ' ' << *e.invocation_ -#ifndef MOCK_NUM_ARGS_0 - << ".with( " << *e.matcher_ << " )" -#endif - ; - } - - private: - typedef std::vector< - boost::shared_ptr< sequence_impl > - > sequences_type; - typedef sequences_type::const_iterator sequences_cit; - - boost::shared_ptr< invocation > invocation_; - boost::shared_ptr< - matcher_base< - void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) - > - > matcher_; - sequences_type sequences_; - const char* file_; - int line_; - }; -} -} // mock - -#undef MOCK_EXPECTATION_INITIALIZE -#undef MOCK_EXPECTATION_MEMBER -#undef MOCK_EXPECTATION_IS_VALID -#undef MOCK_EXPECTATION_SERIALIZE -#undef MOCK_EXPECTATION_SERIALIZE_ANY -#undef MOCK_EXPECTATION_PARAM -#undef MOCK_REF_ARG -#undef MOCK_REF_ARG_T -#undef MOCK_RV_REF diff --git a/thirdparty/turtle/turtle/detail/function_impl_template.hpp b/thirdparty/turtle/turtle/detail/function_impl_template.hpp deleted file mode 100644 index 3a6897115a..0000000000 --- a/thirdparty/turtle/turtle/detail/function_impl_template.hpp +++ /dev/null @@ -1,329 +0,0 @@ -// http://turtle.sourceforge.net -// -// Copyright Mathieu Champlon 2012 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include "expectation_template.hpp" - -#ifndef MOCK_ERROR_POLICY -# error no error policy has been set -#endif - -#define MOCK_FUNCTION_FORMAT(z, n, N) \ - << ' ' << mock::format( t##n ) \ - << BOOST_PP_IF(BOOST_PP_EQUAL(N,n), ' ', ',') - -#define MOCK_FUNCTION_CONTEXT \ - boost::unit_test::lazy_ostream::instance() \ - << lazy_context( this ) \ - << '(' BOOST_PP_REPEAT(MOCK_NUM_ARGS, MOCK_FUNCTION_FORMAT, \ - BOOST_PP_DEC(MOCK_NUM_ARGS)) \ - << ')' \ - << lazy_expectations( this ) - -#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_impl; - - template< typename R - BOOST_PP_ENUM_TRAILING_PARAMS(MOCK_NUM_ARGS, typename T) > - class function_impl< R ( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) > - : public verifiable, public boost::enable_shared_from_this< - function_impl< R ( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) )> > - { - public: - typedef safe_error< R, MOCK_ERROR_POLICY< R > > error_type; - - public: - function_impl() - : context_( 0 ) - , valid_( true ) - , exceptions_( exceptions() ) - , mutex_( boost::make_shared< mutex >() ) - {} - virtual ~function_impl() - { - if( valid_ && exceptions_ >= exceptions() ) - for( expectations_cit it = expectations_.begin(); - it != expectations_.end(); ++it ) - if( ! it->verify() ) - error_type::fail( "untriggered expectation", - boost::unit_test::lazy_ostream::instance() - << lazy_context( this ) - << lazy_expectations( this ), - it->file(), it->line() ); - if( context_ ) - context_->remove( *this ); - } - - virtual bool verify() const - { - lock _( mutex_ ); - for( expectations_cit it = expectations_.begin(); - it != expectations_.end(); ++it ) - if( ! it->verify() ) - { - valid_ = false; - error_type::fail( "verification failed", - boost::unit_test::lazy_ostream::instance() - << lazy_context( this ) - << lazy_expectations( this ), - it->file(), it->line() ); - } - return valid_; - } - - virtual void reset() - { - lock _( mutex_ ); - valid_ = true; - boost::shared_ptr< function_impl > guard = - this->shared_from_this(); - expectations_.clear(); - } - - private: - typedef expectation< - R( BOOST_PP_ENUM_PARAMS( MOCK_NUM_ARGS, T ) ) - > expectation_type; - - class wrapper : public wrapper_base< R, expectation_type > - { - private: - typedef wrapper_base< R, expectation_type > base_type; - BOOST_MOVABLE_BUT_NOT_COPYABLE(wrapper) - - public: - wrapper( const boost::shared_ptr< mutex >& m, expectation_type& e ) - : base_type( e ) - , lock_( m ) - {} - wrapper( BOOST_RV_REF( wrapper ) x ) - : base_type( x ) - , lock_( boost::move( x.lock_) ) - {} - wrapper& operator=( BOOST_RV_REF( wrapper ) x ) - { - static_cast< base_type& >( *this ) = x; - lock_ = boost::move( x.lock_ ); - return *this; - } - wrapper& once() - { - this->e_->invoke( boost::make_shared< detail::once >() ); - return *this; - } - wrapper& never() - { - this->e_->invoke( boost::make_shared< detail::never >() ); - return *this; - } - wrapper& exactly( std::size_t count ) - { - this->e_->invoke( - boost::make_shared< detail::exactly >( count ) ); - return *this; - } - wrapper& at_least( std::size_t min ) - { - this->e_->invoke( - boost::make_shared< detail::at_least >( min ) ); - return *this; - } - wrapper& at_most( std::size_t max ) - { - this->e_->invoke( - boost::make_shared< detail::at_most >( max ) ); - return *this; - } - wrapper& between( std::size_t min, std::size_t max ) - { - this->e_->invoke( - boost::make_shared< detail::between >( min, max ) ); - return *this; - } - -#ifndef MOCK_NUM_ARGS_0 - template< - BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, typename Constraint_) - > - wrapper& with( - BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, Constraint_, c) ) - { - this->e_->with( - BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, c) ); - return *this; - } - -#if MOCK_NUM_ARGS > 1 - template< typename Constraint > - wrapper& with( const Constraint& c ) - { - this->e_->with( c ); - return *this; - } -#endif -#endif - -#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 - - template< typename TT > - void calls( TT t ) - { - this->e_->calls( t ); - } - template< typename TT > - void throws( TT t ) - { - this->e_->throws( t ); - } - template< typename TT > - void moves( BOOST_RV_REF(TT) t ) - { - this->e_->moves( boost::move( t ) ); - } - - lock lock_; - }; - - public: - typedef wrapper wrapper_type; - - wrapper expect( const char* file, int line ) - { - lock _( mutex_ ); - expectations_.push_back( expectation_type( file, line ) ); - valid_ = true; - return wrapper( mutex_, expectations_.back() ); - } - wrapper expect() - { - lock _( mutex_ ); - expectations_.push_back( expectation_type() ); - valid_ = true; - return wrapper( mutex_, expectations_.back() ); - } - - R operator()( - BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, T, t) ) const - { - lock _( mutex_ ); - valid_ = false; - for( expectations_cit it = expectations_.begin(); - it != expectations_.end(); ++it ) - if( it->is_valid( - BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_MOVE, _) ) ) - { - if( ! it->invoke() ) - { - error_type::fail( "sequence failed", - MOCK_FUNCTION_CONTEXT, it->file(), it->line() ); - return error_type::abort(); - } - if( ! it->valid() ) - { - error_type::fail( "missing action", - MOCK_FUNCTION_CONTEXT, it->file(), it->line() ); - return error_type::abort(); - } - valid_ = true; - error_type::call( - MOCK_FUNCTION_CONTEXT, it->file(), it->line() ); - if( it->functor() ) - return it->functor()( - BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_MOVE, _) ); - return it->trigger(); - } - error_type::fail( "unexpected call", MOCK_FUNCTION_CONTEXT ); - return error_type::abort(); - } - - void add( context& c, const void* p, - boost::unit_test::const_string instance, - boost::optional< type_name > type, - boost::unit_test::const_string name ) - { - lock _( mutex_ ); - if( ! context_ ) - c.add( *this ); - c.add( p, *this, instance, type, name ); - context_ = &c; - } - - friend std::ostream& operator<<( - std::ostream& s, const function_impl& impl ) - { - lock _( impl.mutex_ ); - return s << lazy_context( &impl ) << lazy_expectations( &impl ); - } - - struct lazy_context - { - lazy_context( const function_impl* impl ) - : impl_( impl ) - {} - friend std::ostream& operator<<( - std::ostream& s, const lazy_context& c ) - { - if( c.impl_->context_ ) - c.impl_->context_->serialize( s, *c.impl_ ); - else - s << '?'; - return s; - } - const function_impl* impl_; - }; - - struct lazy_expectations - { - lazy_expectations( const function_impl* impl ) - : impl_( impl ) - {} - friend std::ostream& operator<<( - std::ostream& s, const lazy_expectations& e ) - { - for( expectations_cit it = e.impl_->expectations_.begin(); - it != e.impl_->expectations_.end(); ++it ) - s << std::endl << *it; - return s; - } - const function_impl* impl_; - }; - - typedef std::list< expectation_type > expectations_type; - typedef typename expectations_type::const_iterator expectations_cit; - - expectations_type expectations_; - context* context_; - mutable bool valid_; - const int exceptions_; - const boost::shared_ptr< mutex > mutex_; - }; -} -} // mock - -#undef MOCK_FUNCTION_FORMAT -#undef MOCK_FUNCTION_CONTEXT -#undef MOCK_MOVE diff --git a/thirdparty/turtle/turtle/detail/function_template.hpp b/thirdparty/turtle/turtle/detail/function_template.hpp deleted file mode 100644 index 0ebfe14452..0000000000 --- a/thirdparty/turtle/turtle/detail/function_template.hpp +++ /dev/null @@ -1,106 +0,0 @@ -// http://turtle.sourceforge.net -// -// Copyright Mathieu Champlon 2008 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include "function_impl_template.hpp" - -#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; - - 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 > - struct sig - { - typedef R type; - }; - - private: - 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 >() ) - {} - - bool verify() const - { - return impl_->verify(); - } - bool verify( const char* file, int line ) const - { - error_type::pass( file, line ); - return impl_->verify(); - } - void reset() - { - impl_->reset(); - } - void reset( const char* file, int line ) - { - error_type::pass( file, line ); - impl_->reset(); - } - - expectation_type expect( const char* file, int line ) - { - error_type::pass( file, line ); - return impl_->expect( file, line ); - } - expectation_type expect() - { - return impl_->expect(); - } - - 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_; - } - - function& operator()( context& c, - boost::unit_test::const_string instance ) - { - 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 - { - impl_->add( c, p, instance, type, name ); - } - - private: - boost::shared_ptr< impl_type > impl_; - }; -} -} // mock - -#undef MOCK_MOVE diff --git a/thirdparty/turtle/turtle/detail/matcher_base_template.hpp b/thirdparty/turtle/turtle/detail/matcher_base_template.hpp deleted file mode 100644 index 07fa3264fb..0000000000 --- a/thirdparty/turtle/turtle/detail/matcher_base_template.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// http://turtle.sourceforge.net -// -// Copyright Mathieu Champlon 2012 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#define MOCK_REF_ARG(z, n, d) \ - typename ref_arg< T##n >::type - -namespace mock -{ -namespace detail -{ - template< typename Signature > class matcher_base; - - template< - BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, typename T) > - class matcher_base< void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) > - : boost::noncopyable - { - public: - virtual ~matcher_base() {} - - virtual bool operator()( - BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_REF_ARG, _) ) = 0; - - friend std::ostream& operator<<( - std::ostream& s, const matcher_base& m ) - { - m.serialize( s ); - return s; - } - - private: - virtual void serialize( std::ostream& ) const = 0; - }; -} -} // mock - -#undef MOCK_REF_ARG diff --git a/thirdparty/turtle/turtle/detail/move_helper.hpp b/thirdparty/turtle/turtle/detail/move_helper.hpp deleted file mode 100644 index 87f1f2ddb7..0000000000 --- a/thirdparty/turtle/turtle/detail/move_helper.hpp +++ /dev/null @@ -1,78 +0,0 @@ -// http://turtle.sourceforge.net -// -// Copyright Mathieu Champlon 2018 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef MOCK_MOVE_HELPER_HPP_INCLUDED -#define MOCK_MOVE_HELPER_HPP_INCLUDED - -#include "../config.hpp" -#include -#include -#include -#include -#include -#include - -namespace mock -{ -namespace detail -{ -#ifdef MOCK_RVALUE_REFERENCES - template< typename T > - struct forward_type - { - typedef T type; - }; - template< typename T > - struct ref_arg - { - typedef typename boost::conditional< - boost::is_reference< T >::value, - T, - typename boost::add_rvalue_reference< T >::type >::type type; - }; - - template< typename T > - inline T&& move_if_not_lvalue_reference(typename boost::remove_reference< T >::type& t) - { - return static_cast< T&& >(t); - } - - template< typename T > - inline T&& move_if_not_lvalue_reference(typename boost::remove_reference< T >::type&& t) - { - return static_cast< T&& >(t); - } -#else - template< typename T > - struct forward_type - { - typedef typename boost::decay< const T >::type type; - }; - template< class T> - struct forward_type< boost::rv< T > > - { - typedef T type; - }; - template< typename T > - struct ref_arg - { - typedef typename boost::conditional< - boost::is_reference< T >::value, - T, - const typename boost::add_reference< T >::type >::type type; - }; - template< typename T > - inline typename boost::remove_reference< T >::type& move_if_not_lvalue_reference(typename boost::remove_reference< T >::type& t) - { - return t; - } -#endif -} -} - -#endif // MOCK_MOVE_HELPER_HPP_INCLUDED diff --git a/thirdparty/turtle/turtle/detail/parameter.hpp b/thirdparty/turtle/turtle/detail/parameter.hpp deleted file mode 100644 index 38925a2953..0000000000 --- a/thirdparty/turtle/turtle/detail/parameter.hpp +++ /dev/null @@ -1,34 +0,0 @@ -// http://turtle.sourceforge.net -// -// Copyright Mathieu Champlon 2012 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef MOCK_PARAMETER_HPP_INCLUDED -#define MOCK_PARAMETER_HPP_INCLUDED - -#include "../config.hpp" -#include -#include -#include - -namespace mock -{ -namespace detail -{ - template< typename Signature, int n > - struct parameter - { - typedef typename - boost::mpl::at_c< - typename - boost::function_types::parameter_types< Signature >, - n - >::type type; - }; -} -} // mock - -#endif // MOCK_PARAMETER_HPP_INCLUDED diff --git a/thirdparty/turtle/turtle/matcher.hpp b/thirdparty/turtle/turtle/matcher.hpp index 7854d77839..3bd9923158 100644 --- a/thirdparty/turtle/turtle/matcher.hpp +++ b/thirdparty/turtle/turtle/matcher.hpp @@ -39,7 +39,12 @@ class matcher { public: explicit matcher(const char* expected) : expected_(expected) {} - bool operator()(const char* actual) { return std::strcmp(actual, expected_) == 0; } + bool operator()(const char* actual) + { + if(!actual || !expected_) + return actual == expected_; + return std::strcmp(actual, expected_) == 0; + } friend std::ostream& operator<<(std::ostream& s, const matcher& m) { return s << mock::format(m.expected_); } private: diff --git a/thirdparty/turtle/turtle/stream.hpp b/thirdparty/turtle/turtle/stream.hpp index 52991eda6c..979e6a7552 100644 --- a/thirdparty/turtle/turtle/stream.hpp +++ b/thirdparty/turtle/turtle/stream.hpp @@ -106,7 +106,13 @@ namespace detail { { s << '"' << str << '"'; } - inline void serialize(stream& s, const char* const str) { s << '"' << str << '"'; } + inline void serialize(stream& s, const char* const str) + { + if(str) + s << '"' << str << '"'; + else + s << "nullptr"; + } inline void serialize(stream& s, unsigned char c) { s << static_cast(c); } } // namespace detail } // namespace mock diff --git a/thirdparty/turtle/turtle/detail/function_iterate.hpp b/thirdparty/turtle/turtle/version.hpp similarity index 59% rename from thirdparty/turtle/turtle/detail/function_iterate.hpp rename to thirdparty/turtle/turtle/version.hpp index f86538e4c2..f63876b7e9 100644 --- a/thirdparty/turtle/turtle/detail/function_iterate.hpp +++ b/thirdparty/turtle/turtle/version.hpp @@ -1,11 +1,10 @@ // http://turtle.sourceforge.net // -// Copyright Mathieu Champlon 2012 +// Copyright Mathieu Champlon 2013 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#define MOCK_NUM_ARGS BOOST_PP_ITERATION() -#include "function_template.hpp" -#undef MOCK_NUM_ARGS +#define MOCK_VERSION 2.0.0 +#define TURTLE_VERSION "2.0.0"