Renamed ShouldNegate to FalseTest

This commit is contained in:
Phil Nash
2014-05-29 08:00:20 +01:00
parent 10801c2876
commit be9fe76101
4 changed files with 16 additions and 18 deletions

View File

@@ -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;

View File

@@ -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();

View File

@@ -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