From b76e80ed3db0f91bbec99f5d4cf19e42ba27f898 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 28 Nov 2017 11:24:26 +0300 Subject: [PATCH] Small clean-ups --- include/internal/catch_assertionhandler.cpp | 2 -- include/internal/catch_decomposer.h | 27 +++++++++++---------- include/internal/catch_run_context.h | 8 +++--- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/include/internal/catch_assertionhandler.cpp b/include/internal/catch_assertionhandler.cpp index b174c40e..d7311e9a 100644 --- a/include/internal/catch_assertionhandler.cpp +++ b/include/internal/catch_assertionhandler.cpp @@ -17,8 +17,6 @@ #include "catch_capture_matchers.h" #include "catch_run_context.h" -#include - namespace Catch { auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& { diff --git a/include/internal/catch_decomposer.h b/include/internal/catch_decomposer.h index 973190b2..d663114b 100644 --- a/include/internal/catch_decomposer.h +++ b/include/internal/catch_decomposer.h @@ -73,7 +73,7 @@ namespace Catch { } public: - UnaryExpr( LhsT lhs ) + explicit UnaryExpr( LhsT lhs ) : ITransientExpression{ false, lhs ? true : false }, m_lhs( lhs ) {} @@ -108,43 +108,43 @@ namespace Catch { class ExprLhs { LhsT m_lhs; public: - ExprLhs( LhsT lhs ) : m_lhs( lhs ) {} + explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {} template auto operator == ( RhsT const& rhs ) -> BinaryExpr const { - return BinaryExpr( compareEqual( m_lhs, rhs ), m_lhs, "==", rhs ); + return { compareEqual( m_lhs, rhs ), m_lhs, "==", rhs }; } auto operator == ( bool rhs ) -> BinaryExpr const { - return BinaryExpr( m_lhs == rhs, m_lhs, "==", rhs ); + return { m_lhs == rhs, m_lhs, "==", rhs }; } template auto operator != ( RhsT const& rhs ) -> BinaryExpr const { - return BinaryExpr( compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs ); + return { compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs }; } auto operator != ( bool rhs ) -> BinaryExpr const { - return BinaryExpr( m_lhs != rhs, m_lhs, "!=", rhs ); + return { m_lhs != rhs, m_lhs, "!=", rhs }; } template auto operator > ( RhsT const& rhs ) -> BinaryExpr const { - return BinaryExpr( m_lhs > rhs, m_lhs, ">", rhs ); + return { m_lhs > rhs, m_lhs, ">", rhs }; } template auto operator < ( RhsT const& rhs ) -> BinaryExpr const { - return BinaryExpr( m_lhs < rhs, m_lhs, "<", rhs ); + return { m_lhs < rhs, m_lhs, "<", rhs }; } template auto operator >= ( RhsT const& rhs ) -> BinaryExpr const { - return BinaryExpr( m_lhs >= rhs, m_lhs, ">=", rhs ); + return { m_lhs >= rhs, m_lhs, ">=", rhs }; } template auto operator <= ( RhsT const& rhs ) -> BinaryExpr const { - return BinaryExpr( m_lhs <= rhs, m_lhs, "<=", rhs ); + return { m_lhs <= rhs, m_lhs, "<=", rhs }; } auto makeUnaryExpr() const -> UnaryExpr { - return UnaryExpr( m_lhs ); + return UnaryExpr{ m_lhs }; } }; @@ -158,10 +158,11 @@ namespace Catch { struct Decomposer { template auto operator <= ( T const& lhs ) -> ExprLhs { - return ExprLhs( lhs ); + return ExprLhs{ lhs }; } + auto operator <=( bool value ) -> ExprLhs { - return ExprLhs( value ); + return ExprLhs{ value }; } }; diff --git a/include/internal/catch_run_context.h b/include/internal/catch_run_context.h index 37e1d1c9..5b5bc253 100644 --- a/include/internal/catch_run_context.h +++ b/include/internal/catch_run_context.h @@ -46,7 +46,7 @@ namespace Catch { // order of writes and cannot use StreamRedirect on its own class StdErrRedirect { public: - StdErrRedirect(std::string& targetString); + explicit StdErrRedirect( std::string& targetString ); ~StdErrRedirect(); private: std::streambuf* m_cerrBuf; @@ -65,7 +65,7 @@ namespace Catch { explicit RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter); - virtual ~RunContext(); + ~RunContext() override; void testGroupStarting(std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount); void testGroupEnded(std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount); @@ -109,7 +109,7 @@ namespace Catch { public: // IResultCapture - void assertionEnded(AssertionResult const& result); // devirt + void assertionEnded(AssertionResult const& result); bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override; bool testForMissingAssertions(Counts& assertions); @@ -171,8 +171,6 @@ namespace Catch { bool m_includeSuccessfulResults; }; - IResultCapture& getResultCapture(); - } // end namespace Catch #endif // TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED