mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-04 05:09:53 +01:00
Reformatted expression
This commit is contained in:
parent
a6855f7eab
commit
c9ba82b503
@ -20,115 +20,58 @@ class Expression
|
|||||||
void operator = ( const Expression& );
|
void operator = ( const Expression& );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
///////////////////////////////////////////////////////////////////////////
|
Expression( ResultInfoBuilder& result, T lhs )
|
||||||
Expression
|
|
||||||
(
|
|
||||||
ResultInfoBuilder& result,
|
|
||||||
T lhs
|
|
||||||
)
|
|
||||||
: m_result( result ),
|
: m_result( result ),
|
||||||
m_lhs( lhs )
|
m_lhs( lhs )
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
ResultInfoBuilder& operator ==
|
ResultInfoBuilder& operator == ( const RhsT& rhs ) {
|
||||||
(
|
|
||||||
const RhsT& rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return m_result.captureExpression<Internal::IsEqualTo>( m_lhs, rhs );
|
return m_result.captureExpression<Internal::IsEqualTo>( m_lhs, rhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
ResultInfoBuilder& operator !=
|
ResultInfoBuilder& operator != ( const RhsT& rhs ) {
|
||||||
(
|
|
||||||
const RhsT& rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return m_result.captureExpression<Internal::IsNotEqualTo>( m_lhs, rhs );
|
return m_result.captureExpression<Internal::IsNotEqualTo>( m_lhs, rhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
ResultInfoBuilder& operator <
|
ResultInfoBuilder& operator < ( const RhsT& rhs ) {
|
||||||
(
|
|
||||||
const RhsT& rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return m_result.captureExpression<Internal::IsLessThan>( m_lhs, rhs );
|
return m_result.captureExpression<Internal::IsLessThan>( m_lhs, rhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
ResultInfoBuilder& operator >
|
ResultInfoBuilder& operator > ( const RhsT& rhs ) {
|
||||||
(
|
|
||||||
const RhsT& rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return m_result.captureExpression<Internal::IsGreaterThan>( m_lhs, rhs );
|
return m_result.captureExpression<Internal::IsGreaterThan>( m_lhs, rhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
ResultInfoBuilder& operator <=
|
ResultInfoBuilder& operator <= ( const RhsT& rhs ) {
|
||||||
(
|
|
||||||
const RhsT& rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return m_result.captureExpression<Internal::IsLessThanOrEqualTo>( m_lhs, rhs );
|
return m_result.captureExpression<Internal::IsLessThanOrEqualTo>( m_lhs, rhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
ResultInfoBuilder& operator >=
|
ResultInfoBuilder& operator >= ( const RhsT& rhs ) {
|
||||||
(
|
|
||||||
const RhsT& rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return m_result.captureExpression<Internal::IsGreaterThanOrEqualTo>( m_lhs, rhs );
|
return m_result.captureExpression<Internal::IsGreaterThanOrEqualTo>( m_lhs, rhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
ResultInfoBuilder& operator == ( bool rhs ) {
|
||||||
ResultInfoBuilder& operator ==
|
|
||||||
(
|
|
||||||
bool rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return m_result.captureExpression<Internal::IsEqualTo>( m_lhs, rhs );
|
return m_result.captureExpression<Internal::IsEqualTo>( m_lhs, rhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
ResultInfoBuilder& operator != ( bool rhs ) {
|
||||||
ResultInfoBuilder& operator !=
|
|
||||||
(
|
|
||||||
bool rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return m_result.captureExpression<Internal::IsNotEqualTo>( m_lhs, rhs );
|
return m_result.captureExpression<Internal::IsNotEqualTo>( m_lhs, rhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
operator ResultInfoBuilder& () {
|
||||||
operator ResultInfoBuilder&
|
|
||||||
()
|
|
||||||
{
|
|
||||||
return m_result.captureBoolExpression( m_lhs );
|
return m_result.captureBoolExpression( m_lhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator +
|
STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator + ( const RhsT& );
|
||||||
(
|
|
||||||
const RhsT&
|
|
||||||
);
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator -
|
STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator - ( const RhsT& );
|
||||||
(
|
|
||||||
const RhsT&
|
|
||||||
);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ResultInfoBuilder& m_result;
|
ResultInfoBuilder& m_result;
|
||||||
@ -140,64 +83,35 @@ class PtrExpression
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
PtrExpression ( ResultInfoBuilder& result, const LhsT* lhs )
|
||||||
PtrExpression
|
|
||||||
(
|
|
||||||
ResultInfoBuilder& result,
|
|
||||||
const LhsT* lhs
|
|
||||||
)
|
|
||||||
: m_result( &result ),
|
: m_result( &result ),
|
||||||
m_lhs( lhs )
|
m_lhs( lhs )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
ResultInfoBuilder& operator ==
|
ResultInfoBuilder& operator == ( const RhsT* rhs ) {
|
||||||
(
|
|
||||||
const RhsT* rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return m_result->captureExpression<Internal::IsEqualTo>( m_lhs, rhs );
|
return m_result->captureExpression<Internal::IsEqualTo>( m_lhs, rhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// This catches NULL
|
// This catches NULL
|
||||||
ResultInfoBuilder& operator ==
|
ResultInfoBuilder& operator == ( LhsT* rhs ) {
|
||||||
(
|
|
||||||
LhsT* rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return m_result->captureExpression<Internal::IsEqualTo>( m_lhs, rhs );
|
return m_result->captureExpression<Internal::IsEqualTo>( m_lhs, rhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
ResultInfoBuilder& operator !=
|
ResultInfoBuilder& operator != ( const RhsT* rhs ) {
|
||||||
(
|
|
||||||
const RhsT* rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return m_result->captureExpression<Internal::IsNotEqualTo>( m_lhs, rhs );
|
return m_result->captureExpression<Internal::IsNotEqualTo>( m_lhs, rhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// This catches NULL
|
// This catches NULL
|
||||||
ResultInfoBuilder& operator !=
|
ResultInfoBuilder& operator != ( LhsT* rhs ) {
|
||||||
(
|
|
||||||
LhsT* rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return m_result->captureExpression<Internal::IsNotEqualTo>( m_lhs, rhs );
|
return m_result->captureExpression<Internal::IsNotEqualTo>( m_lhs, rhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
operator ResultInfoBuilder& () {
|
||||||
operator ResultInfoBuilder&
|
|
||||||
()
|
|
||||||
{
|
|
||||||
return m_result->captureBoolExpression( m_lhs );
|
return m_result->captureBoolExpression( m_lhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ResultInfoBuilder* m_result;
|
ResultInfoBuilder* m_result;
|
||||||
const LhsT* m_lhs;
|
const LhsT* m_lhs;
|
||||||
|
Loading…
Reference in New Issue
Block a user