mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Renamed ShouldNegate to FalseTest
This commit is contained in:
@@ -55,7 +55,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
std::string AssertionResult::getExpression() const {
|
||||
if( shouldNegate( m_info.resultDisposition ) )
|
||||
if( isFalseTest( m_info.resultDisposition ) )
|
||||
return "!" + m_info.capturedExpression;
|
||||
else
|
||||
return m_info.capturedExpression;
|
||||
|
@@ -18,10 +18,6 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
inline bool isFalseTest( int flags ) {
|
||||
return ( flags & ResultDisposition::NegateResult ) != 0;
|
||||
}
|
||||
|
||||
ResultBuilder::ResultBuilder( char const* macroName,
|
||||
SourceLineInfo const& lineInfo,
|
||||
char const* capturedExpression,
|
||||
@@ -94,10 +90,12 @@ namespace Catch {
|
||||
AssertionResultData data = m_data;
|
||||
|
||||
// Flip bool results if testFalse is set
|
||||
if( m_exprComponents.testFalse && data.resultType == ResultWas::Ok )
|
||||
data.resultType = ResultWas::ExpressionFailed;
|
||||
else if( m_exprComponents.testFalse && data.resultType == ResultWas::ExpressionFailed )
|
||||
data.resultType = ResultWas::Ok;
|
||||
if( m_exprComponents.testFalse ) {
|
||||
if( data.resultType == ResultWas::Ok )
|
||||
data.resultType = ResultWas::ExpressionFailed;
|
||||
else if( data.resultType == ResultWas::ExpressionFailed )
|
||||
data.resultType = ResultWas::Ok;
|
||||
}
|
||||
|
||||
data.message = m_stream.oss.str();
|
||||
data.reconstructedExpression = reconstructExpression();
|
||||
|
@@ -39,11 +39,11 @@ namespace Catch {
|
||||
|
||||
// ResultDisposition::Flags enum
|
||||
struct ResultDisposition { enum Flags {
|
||||
Normal = 0x00,
|
||||
Normal = 0x00,
|
||||
|
||||
ContinueOnFailure = 0x01, // Failures fail test, but execution continues
|
||||
NegateResult = 0x02, // Prefix expressiom with !
|
||||
SuppressFail = 0x04 // Failures are reported but do not fail the test
|
||||
ContinueOnFailure = 0x01, // Failures fail test, but execution continues
|
||||
FalseTest = 0x02, // Prefix expression with !
|
||||
SuppressFail = 0x04 // Failures are reported but do not fail the test
|
||||
}; };
|
||||
|
||||
inline ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) {
|
||||
@@ -51,7 +51,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
inline bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; }
|
||||
inline bool shouldNegate( int flags ) { return ( flags & ResultDisposition::NegateResult ) != 0; }
|
||||
inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; }
|
||||
inline bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; }
|
||||
|
||||
} // end namespace Catch
|
||||
|
Reference in New Issue
Block a user