mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Moved some components into a detail sub-directory
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@521 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
f08108a9c5
commit
0530c4c18c
5 changed files with 92 additions and 6 deletions
|
|
@ -41,7 +41,6 @@
|
||||||
<ClInclude Include="..\..\turtle\detail\is_functor.hpp" />
|
<ClInclude Include="..\..\turtle\detail\is_functor.hpp" />
|
||||||
<ClInclude Include="..\..\turtle\detail\lambda.hpp" />
|
<ClInclude Include="..\..\turtle\detail\lambda.hpp" />
|
||||||
<ClInclude Include="..\..\turtle\detail\object_impl.hpp" />
|
<ClInclude Include="..\..\turtle\detail\object_impl.hpp" />
|
||||||
<ClInclude Include="..\..\turtle\detail\operators.hpp" />
|
|
||||||
<ClInclude Include="..\..\turtle\detail\parameter.hpp" />
|
<ClInclude Include="..\..\turtle\detail\parameter.hpp" />
|
||||||
<ClInclude Include="..\..\turtle\detail\parent.hpp" />
|
<ClInclude Include="..\..\turtle\detail\parent.hpp" />
|
||||||
<ClInclude Include="..\..\turtle\detail\root.hpp" />
|
<ClInclude Include="..\..\turtle\detail\root.hpp" />
|
||||||
|
|
|
||||||
|
|
@ -97,9 +97,6 @@
|
||||||
<ClInclude Include="..\..\turtle\detail\invocation.hpp">
|
<ClInclude Include="..\..\turtle\detail\invocation.hpp">
|
||||||
<Filter>Source Files\detail</Filter>
|
<Filter>Source Files\detail</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\turtle\detail\operators.hpp">
|
|
||||||
<Filter>Source Files\detail</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\turtle\detail\object_impl.hpp">
|
<ClInclude Include="..\..\turtle\detail\object_impl.hpp">
|
||||||
<Filter>Source Files\detail</Filter>
|
<Filter>Source Files\detail</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
#include <turtle/constraints.hpp>
|
#include <turtle/constraints.hpp>
|
||||||
#include <turtle/detail/operators.hpp>
|
|
||||||
#include <boost/test/auto_unit_test.hpp>
|
#include <boost/test/auto_unit_test.hpp>
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE( all_comparison_constraints_can_be_instanciated )
|
BOOST_AUTO_TEST_CASE( all_comparison_constraints_can_be_instanciated )
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,98 @@ namespace mock
|
||||||
{}
|
{}
|
||||||
Constraint f_;
|
Constraint f_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template< typename Constraint1, typename Constraint2 >
|
||||||
|
class and_
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
and_( const Constraint1& c1, const Constraint2& c2 )
|
||||||
|
: c1_( c1 )
|
||||||
|
, c2_( c2 )
|
||||||
|
{}
|
||||||
|
template< typename Actual >
|
||||||
|
bool operator()( const Actual& actual ) const
|
||||||
|
{
|
||||||
|
return c1_( actual ) && c2_( actual );
|
||||||
|
}
|
||||||
|
friend std::ostream& operator<<( std::ostream& s, const and_& a )
|
||||||
|
{
|
||||||
|
return s << "( " << mock::format( a.c1_ )
|
||||||
|
<< " && " << mock::format( a.c2_ ) << " )";
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
Constraint1 c1_;
|
||||||
|
Constraint2 c2_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename Constraint1, typename Constraint2 >
|
||||||
|
class or_
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
or_( const Constraint1& c1, const Constraint2& c2 )
|
||||||
|
: c1_( c1 )
|
||||||
|
, c2_( c2 )
|
||||||
|
{}
|
||||||
|
template< typename Actual >
|
||||||
|
bool operator()( const Actual& actual ) const
|
||||||
|
{
|
||||||
|
return c1_( actual ) || c2_( actual );
|
||||||
|
}
|
||||||
|
friend std::ostream& operator<<( std::ostream& s, const or_& o )
|
||||||
|
{
|
||||||
|
return s << "( " << mock::format( o.c1_ )
|
||||||
|
<< " || " << mock::format( o.c2_ )<< " )";
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
Constraint1 c1_;
|
||||||
|
Constraint2 c2_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename Constraint >
|
||||||
|
class not_
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit not_( const Constraint& f )
|
||||||
|
: f_( f )
|
||||||
|
{}
|
||||||
|
template< typename Actual >
|
||||||
|
bool operator()( const Actual& actual ) const
|
||||||
|
{
|
||||||
|
return ! f_( actual );
|
||||||
|
}
|
||||||
|
friend std::ostream& operator<<( std::ostream& s, const not_& n )
|
||||||
|
{
|
||||||
|
return s << "! " << mock::format( n.f_ );
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
Constraint f_;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename Constraint1, typename Constraint2 >
|
||||||
|
const constraint< detail::or_< Constraint1, Constraint2 > >
|
||||||
|
operator||( const constraint< Constraint1 >& lhs,
|
||||||
|
const constraint< Constraint2 >& rhs )
|
||||||
|
{
|
||||||
|
return detail::or_< Constraint1, Constraint2 >( lhs.f_, rhs.f_ );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename Constraint1, typename Constraint2 >
|
||||||
|
const constraint< detail::and_< Constraint1, Constraint2 > >
|
||||||
|
operator&&( const constraint< Constraint1 >& lhs,
|
||||||
|
const constraint< Constraint2 >& rhs )
|
||||||
|
{
|
||||||
|
return detail::and_< Constraint1, Constraint2 >( lhs.f_, rhs.f_ );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename Constraint >
|
||||||
|
const constraint< detail::not_< Constraint > >
|
||||||
|
operator!( const constraint< Constraint >& c )
|
||||||
|
{
|
||||||
|
return detail::not_< Constraint >( c.f_ );
|
||||||
|
}
|
||||||
} // mock
|
} // mock
|
||||||
|
|
||||||
#define MOCK_UNARY_CONSTRAINT(N,Expr) \
|
#define MOCK_UNARY_CONSTRAINT(N,Expr) \
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
#ifndef MOCK_CHECK_HPP_INCLUDED
|
#ifndef MOCK_CHECK_HPP_INCLUDED
|
||||||
#define MOCK_CHECK_HPP_INCLUDED
|
#define MOCK_CHECK_HPP_INCLUDED
|
||||||
|
|
||||||
#include "operators.hpp"
|
|
||||||
#include "is_functor.hpp"
|
#include "is_functor.hpp"
|
||||||
#include "../log.hpp"
|
#include "../log.hpp"
|
||||||
#include <boost/utility/enable_if.hpp>
|
#include <boost/utility/enable_if.hpp>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue