mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Small clean-ups
This commit is contained in:
parent
a3632facf3
commit
b76e80ed3d
@ -17,8 +17,6 @@
|
|||||||
#include "catch_capture_matchers.h"
|
#include "catch_capture_matchers.h"
|
||||||
#include "catch_run_context.h"
|
#include "catch_run_context.h"
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& {
|
auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& {
|
||||||
|
@ -73,7 +73,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UnaryExpr( LhsT lhs )
|
explicit UnaryExpr( LhsT lhs )
|
||||||
: ITransientExpression{ false, lhs ? true : false },
|
: ITransientExpression{ false, lhs ? true : false },
|
||||||
m_lhs( lhs )
|
m_lhs( lhs )
|
||||||
{}
|
{}
|
||||||
@ -108,43 +108,43 @@ namespace Catch {
|
|||||||
class ExprLhs {
|
class ExprLhs {
|
||||||
LhsT m_lhs;
|
LhsT m_lhs;
|
||||||
public:
|
public:
|
||||||
ExprLhs( LhsT lhs ) : m_lhs( lhs ) {}
|
explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {}
|
||||||
|
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
auto operator == ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
auto operator == ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
||||||
return BinaryExpr<LhsT, RhsT const&>( compareEqual( m_lhs, rhs ), m_lhs, "==", rhs );
|
return { compareEqual( m_lhs, rhs ), m_lhs, "==", rhs };
|
||||||
}
|
}
|
||||||
auto operator == ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
|
auto operator == ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
|
||||||
return BinaryExpr<LhsT, bool>( m_lhs == rhs, m_lhs, "==", rhs );
|
return { m_lhs == rhs, m_lhs, "==", rhs };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
auto operator != ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
auto operator != ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
||||||
return BinaryExpr<LhsT, RhsT const&>( compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs );
|
return { compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs };
|
||||||
}
|
}
|
||||||
auto operator != ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
|
auto operator != ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
|
||||||
return BinaryExpr<LhsT, bool>( m_lhs != rhs, m_lhs, "!=", rhs );
|
return { m_lhs != rhs, m_lhs, "!=", rhs };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
auto operator > ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
auto operator > ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
||||||
return BinaryExpr<LhsT, RhsT const&>( m_lhs > rhs, m_lhs, ">", rhs );
|
return { m_lhs > rhs, m_lhs, ">", rhs };
|
||||||
}
|
}
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
auto operator < ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
auto operator < ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
||||||
return BinaryExpr<LhsT, RhsT const&>( m_lhs < rhs, m_lhs, "<", rhs );
|
return { m_lhs < rhs, m_lhs, "<", rhs };
|
||||||
}
|
}
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
auto operator >= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
auto operator >= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
||||||
return BinaryExpr<LhsT, RhsT const&>( m_lhs >= rhs, m_lhs, ">=", rhs );
|
return { m_lhs >= rhs, m_lhs, ">=", rhs };
|
||||||
}
|
}
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
||||||
return BinaryExpr<LhsT, RhsT const&>( m_lhs <= rhs, m_lhs, "<=", rhs );
|
return { m_lhs <= rhs, m_lhs, "<=", rhs };
|
||||||
}
|
}
|
||||||
|
|
||||||
auto makeUnaryExpr() const -> UnaryExpr<LhsT> {
|
auto makeUnaryExpr() const -> UnaryExpr<LhsT> {
|
||||||
return UnaryExpr<LhsT>( m_lhs );
|
return UnaryExpr<LhsT>{ m_lhs };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -158,10 +158,11 @@ namespace Catch {
|
|||||||
struct Decomposer {
|
struct Decomposer {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto operator <= ( T const& lhs ) -> ExprLhs<T const&> {
|
auto operator <= ( T const& lhs ) -> ExprLhs<T const&> {
|
||||||
return ExprLhs<T const&>( lhs );
|
return ExprLhs<T const&>{ lhs };
|
||||||
}
|
}
|
||||||
|
|
||||||
auto operator <=( bool value ) -> ExprLhs<bool> {
|
auto operator <=( bool value ) -> ExprLhs<bool> {
|
||||||
return ExprLhs<bool>( value );
|
return ExprLhs<bool>{ value };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ namespace Catch {
|
|||||||
// order of writes and cannot use StreamRedirect on its own
|
// order of writes and cannot use StreamRedirect on its own
|
||||||
class StdErrRedirect {
|
class StdErrRedirect {
|
||||||
public:
|
public:
|
||||||
StdErrRedirect(std::string& targetString);
|
explicit StdErrRedirect( std::string& targetString );
|
||||||
~StdErrRedirect();
|
~StdErrRedirect();
|
||||||
private:
|
private:
|
||||||
std::streambuf* m_cerrBuf;
|
std::streambuf* m_cerrBuf;
|
||||||
@ -65,7 +65,7 @@ namespace Catch {
|
|||||||
|
|
||||||
explicit RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter);
|
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 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);
|
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
|
public: // IResultCapture
|
||||||
|
|
||||||
void assertionEnded(AssertionResult const& result); // devirt
|
void assertionEnded(AssertionResult const& result);
|
||||||
|
|
||||||
bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override;
|
bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override;
|
||||||
bool testForMissingAssertions(Counts& assertions);
|
bool testForMissingAssertions(Counts& assertions);
|
||||||
@ -171,8 +171,6 @@ namespace Catch {
|
|||||||
bool m_includeSuccessfulResults;
|
bool m_includeSuccessfulResults;
|
||||||
};
|
};
|
||||||
|
|
||||||
IResultCapture& getResultCapture();
|
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED
|
||||||
|
Loading…
Reference in New Issue
Block a user