diff options
| author | Martin Hořeňovský | 2017-07-19 10:13:47 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2017-07-19 15:32:58 +0200 |
| commit | 4a1e898eaeab7910a872e3d1d1e26932bfaadcce (patch) | |
| tree | 59c174cc41c9bbc2562488e2b58ede2d4f2aabd3 /include/internal/catch_assertionresult.cpp | |
| parent | d7ff62430a009cca04dcdb10a320dd6162f2a3d2 (diff) | |
| download | catch3-4a1e898eaeab7910a872e3d1d1e26932bfaadcce.tar.gz | |
More method bodies moved out of line
Diffstat (limited to 'include/internal/catch_assertionresult.cpp')
| -rw-r--r-- | include/internal/catch_assertionresult.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/internal/catch_assertionresult.cpp b/include/internal/catch_assertionresult.cpp index 77c69281..9a4b0c65 100644 --- a/include/internal/catch_assertionresult.cpp +++ b/include/internal/catch_assertionresult.cpp @@ -11,6 +11,10 @@ namespace Catch { + bool DecomposedExpression::isBinaryExpression() const { + return false; + } + AssertionInfo::AssertionInfo( char const * _macroName, SourceLineInfo const& _lineInfo, char const * _capturedExpression, @@ -21,6 +25,30 @@ namespace Catch { resultDisposition( _resultDisposition ) {} + void AssertionResultData::negate( bool parenthesize ) { + negated = !negated; + parenthesized = parenthesize; + if( resultType == ResultWas::Ok ) + resultType = ResultWas::ExpressionFailed; + else if( resultType == ResultWas::ExpressionFailed ) + resultType = ResultWas::Ok; + } + + std::string const& AssertionResultData::reconstructExpression() const { + if( decomposedExpression != nullptr ) { + decomposedExpression->reconstructExpression( reconstructedExpression ); + if( parenthesized ) { + reconstructedExpression.insert( 0, 1, '(' ); + reconstructedExpression.append( 1, ')' ); + } + if( negated ) { + reconstructedExpression.insert( 0, 1, '!' ); + } + decomposedExpression = nullptr; + } + return reconstructedExpression; + } + AssertionResult::AssertionResult() {} AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data ) |