mirror of
https://github.com/catchorg/Catch2.git
synced 2025-10-05 11:31:05 +02:00
Compare commits
8 Commits
v1.2.1-dev
...
v1.2.1-dev
Author | SHA1 | Date | |
---|---|---|---|
|
584032dfa4 | ||
|
18acff62d3 | ||
|
c1ca0fdabe | ||
|
d6f1446e4e | ||
|
62e517f833 | ||
|
6160a2b079 | ||
|
8f66e3495b | ||
|
d87e551efa |
@@ -1,6 +1,6 @@
|
|||||||

|

|
||||||
|
|
||||||
*v1.2.1-develop.1*
|
*v1.2.1-develop.4*
|
||||||
|
|
||||||
Build status (on Travis CI) [](https://travis-ci.org/philsquared/Catch)
|
Build status (on Travis CI) [](https://travis-ci.org/philsquared/Catch)
|
||||||
|
|
||||||
|
@@ -112,7 +112,7 @@ namespace Catch {
|
|||||||
std::set<std::string> tags = test.tags;
|
std::set<std::string> tags = test.tags;
|
||||||
|
|
||||||
std::string filename = test.lineInfo.file;
|
std::string filename = test.lineInfo.file;
|
||||||
std::string::size_type lastSlash = filename.find_last_of( "\//" );
|
std::string::size_type lastSlash = filename.find_last_of( "\\/" );
|
||||||
if( lastSlash != std::string::npos )
|
if( lastSlash != std::string::npos )
|
||||||
filename = filename.substr( lastSlash+1 );
|
filename = filename.substr( lastSlash+1 );
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ namespace Catch {
|
|||||||
if( m_configData.filenamesAsTags )
|
if( m_configData.filenamesAsTags )
|
||||||
applyFilenamesAsTags();
|
applyFilenamesAsTags();
|
||||||
|
|
||||||
std::srand( m_configData.rngSeed );
|
seedRng( *m_config );
|
||||||
|
|
||||||
Runner runner( m_config );
|
Runner runner( m_config );
|
||||||
|
|
||||||
|
@@ -22,6 +22,8 @@
|
|||||||
#include "catch_compiler_capabilities.h"
|
#include "catch_compiler_capabilities.h"
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
|
struct IConfig;
|
||||||
|
|
||||||
class NonCopyable {
|
class NonCopyable {
|
||||||
#ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
|
#ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
|
||||||
@@ -109,6 +111,9 @@ namespace Catch {
|
|||||||
|
|
||||||
void throwLogicError( std::string const& message, SourceLineInfo const& locationInfo );
|
void throwLogicError( std::string const& message, SourceLineInfo const& locationInfo );
|
||||||
|
|
||||||
|
void seedRng( IConfig const& config );
|
||||||
|
unsigned int rngSeed();
|
||||||
|
|
||||||
// Use this in variadic streaming macros to allow
|
// Use this in variadic streaming macros to allow
|
||||||
// >> +StreamEndStop
|
// >> +StreamEndStop
|
||||||
// as well as
|
// as well as
|
||||||
|
@@ -82,6 +82,14 @@ namespace Catch {
|
|||||||
return line < other.line || ( line == other.line && file < other.file );
|
return line < other.line || ( line == other.line && file < other.file );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void seedRng( IConfig const& config ) {
|
||||||
|
if( config.rngSeed() != 0 )
|
||||||
|
std::srand( config.rngSeed() );
|
||||||
|
}
|
||||||
|
unsigned int rngSeed() {
|
||||||
|
return getCurrentContext().getConfig()->rngSeed();
|
||||||
|
}
|
||||||
|
|
||||||
std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
|
std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
|
||||||
#ifndef __GNUG__
|
#ifndef __GNUG__
|
||||||
os << info.file << "(" << info.line << ")";
|
os << info.file << "(" << info.line << ")";
|
||||||
|
@@ -60,12 +60,13 @@ namespace {
|
|||||||
{
|
{
|
||||||
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
|
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
|
||||||
GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo );
|
GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo );
|
||||||
originalAttributes = csbiInfo.wAttributes;
|
originalForegroundAttributes = csbiInfo.wAttributes & ~( BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY );
|
||||||
|
originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void use( Colour::Code _colourCode ) {
|
virtual void use( Colour::Code _colourCode ) {
|
||||||
switch( _colourCode ) {
|
switch( _colourCode ) {
|
||||||
case Colour::None: return setTextAttribute( originalAttributes );
|
case Colour::None: return setTextAttribute( originalForegroundAttributes );
|
||||||
case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
|
case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
|
||||||
case Colour::Red: return setTextAttribute( FOREGROUND_RED );
|
case Colour::Red: return setTextAttribute( FOREGROUND_RED );
|
||||||
case Colour::Green: return setTextAttribute( FOREGROUND_GREEN );
|
case Colour::Green: return setTextAttribute( FOREGROUND_GREEN );
|
||||||
@@ -85,10 +86,11 @@ namespace {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void setTextAttribute( WORD _textAttribute ) {
|
void setTextAttribute( WORD _textAttribute ) {
|
||||||
SetConsoleTextAttribute( stdoutHandle, _textAttribute );
|
SetConsoleTextAttribute( stdoutHandle, _textAttribute | originalBackgroundAttributes );
|
||||||
}
|
}
|
||||||
HANDLE stdoutHandle;
|
HANDLE stdoutHandle;
|
||||||
WORD originalAttributes;
|
WORD originalForegroundAttributes;
|
||||||
|
WORD originalBackgroundAttributes;
|
||||||
};
|
};
|
||||||
|
|
||||||
IColourImpl* platformColourInstance() {
|
IColourImpl* platformColourInstance() {
|
||||||
|
@@ -78,7 +78,7 @@ namespace Catch {
|
|||||||
virtual ~RunContext() {
|
virtual ~RunContext() {
|
||||||
m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, aborting() ) );
|
m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, aborting() ) );
|
||||||
m_context.setRunner( m_prevRunner );
|
m_context.setRunner( m_prevRunner );
|
||||||
m_context.setConfig( CATCH_NULL );
|
m_context.setConfig( Ptr<IConfig const>() );
|
||||||
m_context.setResultCapture( m_prevResultCapture );
|
m_context.setResultCapture( m_prevResultCapture );
|
||||||
m_context.setConfig( m_prevConfig );
|
m_context.setConfig( m_prevConfig );
|
||||||
}
|
}
|
||||||
@@ -259,6 +259,8 @@ namespace Catch {
|
|||||||
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal );
|
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal );
|
||||||
TestCaseTracker::Guard guard( *m_testCaseTracker );
|
TestCaseTracker::Guard guard( *m_testCaseTracker );
|
||||||
|
|
||||||
|
seedRng( *m_config );
|
||||||
|
|
||||||
Timer timer;
|
Timer timer;
|
||||||
timer.start();
|
timer.start();
|
||||||
if( m_reporter->getPreferences().shouldRedirectStdOut ) {
|
if( m_reporter->getPreferences().shouldRedirectStdOut ) {
|
||||||
|
@@ -90,6 +90,8 @@ namespace Catch {
|
|||||||
break;
|
break;
|
||||||
case RunTests::InRandomOrder:
|
case RunTests::InRandomOrder:
|
||||||
{
|
{
|
||||||
|
seedRng( config );
|
||||||
|
|
||||||
RandomNumberGenerator rng;
|
RandomNumberGenerator rng;
|
||||||
std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng );
|
std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng );
|
||||||
}
|
}
|
||||||
|
@@ -37,7 +37,7 @@ namespace Catch {
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
Version libraryVersion( 1, 2, 1, "develop", 1 );
|
Version libraryVersion( 1, 2, 1, "develop", 4 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,6 +9,9 @@
|
|||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
#include "catch_test_spec_parser.hpp"
|
#include "catch_test_spec_parser.hpp"
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
# pragma clang diagnostic ignored "-Wc++98-compat"
|
||||||
|
#endif
|
||||||
|
|
||||||
inline Catch::TestCase fakeTestCase( const char* name, const char* desc = "" ){ return Catch::makeTestCase( CATCH_NULL, "", name, desc, CATCH_INTERNAL_LINEINFO ); }
|
inline Catch::TestCase fakeTestCase( const char* name, const char* desc = "" ){ return Catch::makeTestCase( CATCH_NULL, "", name, desc, CATCH_INTERNAL_LINEINFO ); }
|
||||||
|
|
||||||
|
@@ -6,7 +6,8 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostic ignored "-Wpadded"
|
# pragma clang diagnostic ignored "-Wpadded"
|
||||||
|
# pragma clang diagnostic ignored "-Wc++98-compat"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
|
@@ -7,7 +7,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostic ignored "-Wpadded"
|
# pragma clang diagnostic ignored "-Wpadded"
|
||||||
|
# pragma clang diagnostic ignored "-Wc++98-compat"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "internal/catch_test_case_tracker.hpp"
|
#include "internal/catch_test_case_tracker.hpp"
|
||||||
|
@@ -1,2 +1,4 @@
|
|||||||
// This file is only here to verify (to the extent possible) the self sufficiency of the header
|
// This file is only here to verify (to the extent possible) the self sufficiency of the header
|
||||||
|
#include "catch_suppress_warnings.h"
|
||||||
#include "catch_xmlwriter.hpp"
|
#include "catch_xmlwriter.hpp"
|
||||||
|
#include "catch_reenable_warnings.h"
|
||||||
|
@@ -16,8 +16,9 @@ CATCH_REGISTER_TAG_ALIAS( "[@tricky]", "[tricky]~[.]" )
|
|||||||
|
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostic ignored "-Wpadded"
|
# pragma clang diagnostic ignored "-Wpadded"
|
||||||
#pragma clang diagnostic ignored "-Wweak-vtables"
|
# pragma clang diagnostic ignored "-Wweak-vtables"
|
||||||
|
# pragma clang diagnostic ignored "-Wc++98-compat"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Catch v1.2.1-develop.1
|
* Catch v1.2.1-develop.4
|
||||||
* Generated: 2015-07-02 08:21:11.983471
|
* Generated: 2015-07-06 06:21:18.816844
|
||||||
* ----------------------------------------------------------
|
* ----------------------------------------------------------
|
||||||
* This file has been merged from multiple headers. Please don't edit it directly
|
* This file has been merged from multiple headers. Please don't edit it directly
|
||||||
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
|
||||||
@@ -233,6 +233,8 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
|
struct IConfig;
|
||||||
|
|
||||||
class NonCopyable {
|
class NonCopyable {
|
||||||
#ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
|
#ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
|
||||||
NonCopyable( NonCopyable const& ) = delete;
|
NonCopyable( NonCopyable const& ) = delete;
|
||||||
@@ -319,6 +321,9 @@ namespace Catch {
|
|||||||
|
|
||||||
void throwLogicError( std::string const& message, SourceLineInfo const& locationInfo );
|
void throwLogicError( std::string const& message, SourceLineInfo const& locationInfo );
|
||||||
|
|
||||||
|
void seedRng( IConfig const& config );
|
||||||
|
unsigned int rngSeed();
|
||||||
|
|
||||||
// Use this in variadic streaming macros to allow
|
// Use this in variadic streaming macros to allow
|
||||||
// >> +StreamEndStop
|
// >> +StreamEndStop
|
||||||
// as well as
|
// as well as
|
||||||
@@ -5208,7 +5213,7 @@ namespace Catch {
|
|||||||
virtual ~RunContext() {
|
virtual ~RunContext() {
|
||||||
m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, aborting() ) );
|
m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, aborting() ) );
|
||||||
m_context.setRunner( m_prevRunner );
|
m_context.setRunner( m_prevRunner );
|
||||||
m_context.setConfig( CATCH_NULL );
|
m_context.setConfig( Ptr<IConfig const>() );
|
||||||
m_context.setResultCapture( m_prevResultCapture );
|
m_context.setResultCapture( m_prevResultCapture );
|
||||||
m_context.setConfig( m_prevConfig );
|
m_context.setConfig( m_prevConfig );
|
||||||
}
|
}
|
||||||
@@ -5388,6 +5393,8 @@ namespace Catch {
|
|||||||
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal );
|
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal );
|
||||||
TestCaseTracker::Guard guard( *m_testCaseTracker );
|
TestCaseTracker::Guard guard( *m_testCaseTracker );
|
||||||
|
|
||||||
|
seedRng( *m_config );
|
||||||
|
|
||||||
Timer timer;
|
Timer timer;
|
||||||
timer.start();
|
timer.start();
|
||||||
if( m_reporter->getPreferences().shouldRedirectStdOut ) {
|
if( m_reporter->getPreferences().shouldRedirectStdOut ) {
|
||||||
@@ -5611,7 +5618,7 @@ namespace Catch {
|
|||||||
std::set<std::string> tags = test.tags;
|
std::set<std::string> tags = test.tags;
|
||||||
|
|
||||||
std::string filename = test.lineInfo.file;
|
std::string filename = test.lineInfo.file;
|
||||||
std::string::size_type lastSlash = filename.find_last_of( "\//" );
|
std::string::size_type lastSlash = filename.find_last_of( "\\/" );
|
||||||
if( lastSlash != std::string::npos )
|
if( lastSlash != std::string::npos )
|
||||||
filename = filename.substr( lastSlash+1 );
|
filename = filename.substr( lastSlash+1 );
|
||||||
|
|
||||||
@@ -5697,7 +5704,7 @@ namespace Catch {
|
|||||||
if( m_configData.filenamesAsTags )
|
if( m_configData.filenamesAsTags )
|
||||||
applyFilenamesAsTags();
|
applyFilenamesAsTags();
|
||||||
|
|
||||||
std::srand( m_configData.rngSeed );
|
seedRng( *m_config );
|
||||||
|
|
||||||
Runner runner( m_config );
|
Runner runner( m_config );
|
||||||
|
|
||||||
@@ -5822,6 +5829,8 @@ namespace Catch {
|
|||||||
break;
|
break;
|
||||||
case RunTests::InRandomOrder:
|
case RunTests::InRandomOrder:
|
||||||
{
|
{
|
||||||
|
seedRng( config );
|
||||||
|
|
||||||
RandomNumberGenerator rng;
|
RandomNumberGenerator rng;
|
||||||
std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng );
|
std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng );
|
||||||
}
|
}
|
||||||
@@ -6324,12 +6333,13 @@ namespace {
|
|||||||
{
|
{
|
||||||
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
|
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
|
||||||
GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo );
|
GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo );
|
||||||
originalAttributes = csbiInfo.wAttributes;
|
originalForegroundAttributes = csbiInfo.wAttributes & ~( BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY );
|
||||||
|
originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void use( Colour::Code _colourCode ) {
|
virtual void use( Colour::Code _colourCode ) {
|
||||||
switch( _colourCode ) {
|
switch( _colourCode ) {
|
||||||
case Colour::None: return setTextAttribute( originalAttributes );
|
case Colour::None: return setTextAttribute( originalForegroundAttributes );
|
||||||
case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
|
case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
|
||||||
case Colour::Red: return setTextAttribute( FOREGROUND_RED );
|
case Colour::Red: return setTextAttribute( FOREGROUND_RED );
|
||||||
case Colour::Green: return setTextAttribute( FOREGROUND_GREEN );
|
case Colour::Green: return setTextAttribute( FOREGROUND_GREEN );
|
||||||
@@ -6349,10 +6359,11 @@ namespace {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void setTextAttribute( WORD _textAttribute ) {
|
void setTextAttribute( WORD _textAttribute ) {
|
||||||
SetConsoleTextAttribute( stdoutHandle, _textAttribute );
|
SetConsoleTextAttribute( stdoutHandle, _textAttribute | originalBackgroundAttributes );
|
||||||
}
|
}
|
||||||
HANDLE stdoutHandle;
|
HANDLE stdoutHandle;
|
||||||
WORD originalAttributes;
|
WORD originalForegroundAttributes;
|
||||||
|
WORD originalBackgroundAttributes;
|
||||||
};
|
};
|
||||||
|
|
||||||
IColourImpl* platformColourInstance() {
|
IColourImpl* platformColourInstance() {
|
||||||
@@ -6812,7 +6823,7 @@ namespace Catch {
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
Version libraryVersion( 1, 2, 1, "develop", 1 );
|
Version libraryVersion( 1, 2, 1, "develop", 4 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7104,6 +7115,14 @@ namespace Catch {
|
|||||||
return line < other.line || ( line == other.line && file < other.file );
|
return line < other.line || ( line == other.line && file < other.file );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void seedRng( IConfig const& config ) {
|
||||||
|
if( config.rngSeed() != 0 )
|
||||||
|
std::srand( config.rngSeed() );
|
||||||
|
}
|
||||||
|
unsigned int rngSeed() {
|
||||||
|
return getCurrentContext().getConfig()->rngSeed();
|
||||||
|
}
|
||||||
|
|
||||||
std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
|
std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
|
||||||
#ifndef __GNUG__
|
#ifndef __GNUG__
|
||||||
os << info.file << "(" << info.line << ")";
|
os << info.file << "(" << info.line << ")";
|
||||||
|
Reference in New Issue
Block a user