mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
(re)Inlined isTrue()
This commit is contained in:
parent
e54dcdac8b
commit
3b965aa501
@ -63,7 +63,7 @@
|
|||||||
CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
|
CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
|
||||||
} INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
|
} INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
|
||||||
INTERNAL_CATCH_REACT( catchAssertionHandler ) \
|
INTERNAL_CATCH_REACT( catchAssertionHandler ) \
|
||||||
} while( Catch::isTrue( false && static_cast<bool>( !!(__VA_ARGS__) ) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look
|
} while( Catch::isTrue(false) && static_cast<bool>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look
|
||||||
// The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&.
|
// The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&.
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -38,7 +38,6 @@ namespace Catch {
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isTrue( bool value ){ return value; }
|
|
||||||
bool alwaysTrue() { return true; }
|
bool alwaysTrue() { return true; }
|
||||||
bool alwaysFalse() { return false; }
|
bool alwaysFalse() { return false; }
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ namespace Catch {
|
|||||||
std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info );
|
std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info );
|
||||||
|
|
||||||
// This is just here to avoid compiler warnings with macro constants and boolean literals
|
// This is just here to avoid compiler warnings with macro constants and boolean literals
|
||||||
bool isTrue( bool value );
|
inline bool isTrue( bool value ){ return value; }
|
||||||
bool alwaysTrue();
|
bool alwaysTrue();
|
||||||
bool alwaysFalse();
|
bool alwaysFalse();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user