Resolve reporter outside of Config

config now only only holds reporter name
This commit is contained in:
Phil Nash
2012-07-17 08:04:19 +01:00
parent 8fbd8e0f9e
commit 5d73c5a008
7 changed files with 80 additions and 85 deletions

View File

@@ -15,8 +15,7 @@
#include <string>
#include <limits>
struct TestData
{
struct TestData {
TestData()
: int_seven( 7 ),
str_hello( "hello" ),
@@ -30,6 +29,25 @@ struct TestData
double double_pi;
};
struct TestDef {
TestDef& operator + ( const std::string& ) {
return *this;
}
TestDef& operator[]( const std::string& ) {
return *this;
}
};
//TEST( "./succeeding/conditions/equality" + Description("nyaya") )
//{
// TEST_CASE( [Name("inner")] )
// {
//
// }
//}
// The "failing" tests all use the CHECK macro, which continues if the specific test fails.
// This allows us to see all results, even if an earlier check fails
@@ -37,6 +55,10 @@ struct TestData
TEST_CASE( "./succeeding/conditions/equality",
"Equality checks that should succeed" )
{
TestDef td;
td + "hello" + "hello";
TestData data;
REQUIRE( data.int_seven == 7 );
@@ -225,6 +247,21 @@ TEST_CASE( "./succeeding/conditions/negative ints",
CHECK( minInt > 2u );
}
template<typename T>
struct Ex
{
Ex( T ){}
bool operator == ( const T& ) const { return true; }
T operator * ( const T& ) const { return T(); }
};
TEST_CASE( "./succeeding/conditions/computed ints",
"Comparisons between ints where one side is computed" )
{
CHECK( 54 == 6*9 );
}
#pragma GCC diagnostic pop

View File

@@ -33,7 +33,7 @@ TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results"
SECTION( "selftest/test counts/succeeding tests",
"Number of 'succeeding' tests is fixed" ) {
runner.runMatching( "./succeeding/*" );
CHECK( runner.getTotals().assertions.passed == 284 );
CHECK( runner.getTotals().assertions.passed == 285 );
CHECK( runner.getTotals().assertions.failed == 0 );
}

View File

@@ -20,14 +20,11 @@ namespace Catch{
Config config;
config.setStreamBuf( oss.rdbuf() );
//if( reporter == "mock" ) // !TBD
config.setReporter( m_reporter.get() );
std::size_t result;
// Scoped because Runner doesn't report EndTesting until its destructor
{
Runner runner( config, config.getReporter() );
Runner runner( config, m_reporter.get() );
result = runner.runMatching( rawTestSpec );
m_totals = runner.getTotals();
}