mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-29 16:53:30 +01:00
Added evaluator overloads for case when comparing pointers against NULLs that decay to ints
This commit is contained in:
parent
a8570dfdfe
commit
2ffb372290
@ -125,6 +125,7 @@ namespace Internal {
|
|||||||
return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs );
|
return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pointer to long (when comparing against NULL)
|
||||||
template<Operator Op, typename T>
|
template<Operator Op, typename T>
|
||||||
bool compare( long lhs, const T* rhs ) {
|
bool compare( long lhs, const T* rhs ) {
|
||||||
return Evaluator<const T*, const T*, Op>::evaluate( reinterpret_cast<const T*>( lhs ), rhs );
|
return Evaluator<const T*, const T*, Op>::evaluate( reinterpret_cast<const T*>( lhs ), rhs );
|
||||||
@ -145,6 +146,27 @@ namespace Internal {
|
|||||||
return Evaluator<T*, T*, Op>::evaluate( lhs, reinterpret_cast<T*>( rhs ) );
|
return Evaluator<T*, T*, Op>::evaluate( lhs, reinterpret_cast<T*>( rhs ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pointer to int (when comparing against NULL)
|
||||||
|
template<Operator Op, typename T>
|
||||||
|
bool compare( int lhs, const T* rhs ) {
|
||||||
|
return Evaluator<const T*, const T*, Op>::evaluate( reinterpret_cast<const T*>( lhs ), rhs );
|
||||||
|
}
|
||||||
|
|
||||||
|
template<Operator Op, typename T>
|
||||||
|
bool compare( int lhs, T* rhs ) {
|
||||||
|
return Evaluator<T*, T*, Op>::evaluate( reinterpret_cast<T*>( lhs ), rhs );
|
||||||
|
}
|
||||||
|
|
||||||
|
template<Operator Op, typename T>
|
||||||
|
bool compare( const T* lhs, int rhs ) {
|
||||||
|
return Evaluator<const T*, const T*, Op>::evaluate( lhs, reinterpret_cast<const T*>( rhs ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
template<Operator Op, typename T>
|
||||||
|
bool compare( T* lhs, int rhs ) {
|
||||||
|
return Evaluator<T*, T*, Op>::evaluate( lhs, reinterpret_cast<T*>( rhs ) );
|
||||||
|
}
|
||||||
|
|
||||||
} // end of namespace Internal
|
} // end of namespace Internal
|
||||||
} // end of namespace Catch
|
} // end of namespace Catch
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user