mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-16 18:15:42 +02:00
Compare commits
5 Commits
v1.2.1-dev
...
v1.2.1-dev
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c1ca0fdabe | ||
![]() |
d6f1446e4e | ||
![]() |
62e517f833 | ||
![]() |
8f66e3495b | ||
![]() |
d87e551efa |
@@ -1,6 +1,6 @@
|
||||

|
||||
|
||||
*v1.2.1-develop.1*
|
||||
*v1.2.1-develop.3*
|
||||
|
||||
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::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 )
|
||||
filename = filename.substr( lastSlash+1 );
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace Catch {
|
||||
if( m_configData.filenamesAsTags )
|
||||
applyFilenamesAsTags();
|
||||
|
||||
std::srand( m_configData.rngSeed );
|
||||
seedRng( *m_config );
|
||||
|
||||
Runner runner( m_config );
|
||||
|
||||
|
@@ -22,6 +22,8 @@
|
||||
#include "catch_compiler_capabilities.h"
|
||||
|
||||
namespace Catch {
|
||||
|
||||
struct IConfig;
|
||||
|
||||
class NonCopyable {
|
||||
#ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
|
||||
@@ -109,6 +111,9 @@ namespace Catch {
|
||||
|
||||
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
|
||||
// >> +StreamEndStop
|
||||
// as well as
|
||||
|
@@ -82,6 +82,14 @@ namespace Catch {
|
||||
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 ) {
|
||||
#ifndef __GNUG__
|
||||
os << info.file << "(" << info.line << ")";
|
||||
|
@@ -78,7 +78,7 @@ namespace Catch {
|
||||
virtual ~RunContext() {
|
||||
m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, aborting() ) );
|
||||
m_context.setRunner( m_prevRunner );
|
||||
m_context.setConfig( CATCH_NULL );
|
||||
m_context.setConfig( Ptr<IConfig const>() );
|
||||
m_context.setResultCapture( m_prevResultCapture );
|
||||
m_context.setConfig( m_prevConfig );
|
||||
}
|
||||
@@ -259,6 +259,8 @@ namespace Catch {
|
||||
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal );
|
||||
TestCaseTracker::Guard guard( *m_testCaseTracker );
|
||||
|
||||
seedRng( *m_config );
|
||||
|
||||
Timer timer;
|
||||
timer.start();
|
||||
if( m_reporter->getPreferences().shouldRedirectStdOut ) {
|
||||
|
@@ -90,6 +90,8 @@ namespace Catch {
|
||||
break;
|
||||
case RunTests::InRandomOrder:
|
||||
{
|
||||
seedRng( config );
|
||||
|
||||
RandomNumberGenerator rng;
|
||||
std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng );
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ namespace Catch {
|
||||
return os;
|
||||
}
|
||||
|
||||
Version libraryVersion( 1, 2, 1, "develop", 1 );
|
||||
Version libraryVersion( 1, 2, 1, "develop", 3 );
|
||||
|
||||
}
|
||||
|
||||
|
@@ -9,6 +9,9 @@
|
||||
#include "catch.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 ); }
|
||||
|
||||
|
@@ -6,7 +6,8 @@
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wpadded"
|
||||
# pragma clang diagnostic ignored "-Wpadded"
|
||||
# pragma clang diagnostic ignored "-Wc++98-compat"
|
||||
#endif
|
||||
|
||||
#include "catch.hpp"
|
||||
|
@@ -7,7 +7,8 @@
|
||||
*/
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wpadded"
|
||||
# pragma clang diagnostic ignored "-Wpadded"
|
||||
# pragma clang diagnostic ignored "-Wc++98-compat"
|
||||
#endif
|
||||
|
||||
#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
|
||||
#include "catch_suppress_warnings.h"
|
||||
#include "catch_xmlwriter.hpp"
|
||||
#include "catch_reenable_warnings.h"
|
||||
|
@@ -16,8 +16,9 @@ CATCH_REGISTER_TAG_ALIAS( "[@tricky]", "[tricky]~[.]" )
|
||||
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wpadded"
|
||||
#pragma clang diagnostic ignored "-Wweak-vtables"
|
||||
# pragma clang diagnostic ignored "-Wpadded"
|
||||
# pragma clang diagnostic ignored "-Wweak-vtables"
|
||||
# pragma clang diagnostic ignored "-Wc++98-compat"
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Catch v1.2.1-develop.1
|
||||
* Generated: 2015-07-02 08:21:11.983471
|
||||
* Catch v1.2.1-develop.3
|
||||
* Generated: 2015-07-03 18:29:49.753953
|
||||
* ----------------------------------------------------------
|
||||
* This file has been merged from multiple headers. Please don't edit it directly
|
||||
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
|
||||
@@ -233,6 +233,8 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
struct IConfig;
|
||||
|
||||
class NonCopyable {
|
||||
#ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
|
||||
NonCopyable( NonCopyable const& ) = delete;
|
||||
@@ -319,6 +321,9 @@ namespace Catch {
|
||||
|
||||
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
|
||||
// >> +StreamEndStop
|
||||
// as well as
|
||||
@@ -5208,7 +5213,7 @@ namespace Catch {
|
||||
virtual ~RunContext() {
|
||||
m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, aborting() ) );
|
||||
m_context.setRunner( m_prevRunner );
|
||||
m_context.setConfig( CATCH_NULL );
|
||||
m_context.setConfig( Ptr<IConfig const>() );
|
||||
m_context.setResultCapture( m_prevResultCapture );
|
||||
m_context.setConfig( m_prevConfig );
|
||||
}
|
||||
@@ -5388,6 +5393,8 @@ namespace Catch {
|
||||
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal );
|
||||
TestCaseTracker::Guard guard( *m_testCaseTracker );
|
||||
|
||||
seedRng( *m_config );
|
||||
|
||||
Timer timer;
|
||||
timer.start();
|
||||
if( m_reporter->getPreferences().shouldRedirectStdOut ) {
|
||||
@@ -5611,7 +5618,7 @@ namespace Catch {
|
||||
std::set<std::string> tags = test.tags;
|
||||
|
||||
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 )
|
||||
filename = filename.substr( lastSlash+1 );
|
||||
|
||||
@@ -5697,7 +5704,7 @@ namespace Catch {
|
||||
if( m_configData.filenamesAsTags )
|
||||
applyFilenamesAsTags();
|
||||
|
||||
std::srand( m_configData.rngSeed );
|
||||
seedRng( *m_config );
|
||||
|
||||
Runner runner( m_config );
|
||||
|
||||
@@ -5822,6 +5829,8 @@ namespace Catch {
|
||||
break;
|
||||
case RunTests::InRandomOrder:
|
||||
{
|
||||
seedRng( config );
|
||||
|
||||
RandomNumberGenerator rng;
|
||||
std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng );
|
||||
}
|
||||
@@ -6812,7 +6821,7 @@ namespace Catch {
|
||||
return os;
|
||||
}
|
||||
|
||||
Version libraryVersion( 1, 2, 1, "develop", 1 );
|
||||
Version libraryVersion( 1, 2, 1, "develop", 3 );
|
||||
|
||||
}
|
||||
|
||||
@@ -7104,6 +7113,14 @@ namespace Catch {
|
||||
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 ) {
|
||||
#ifndef __GNUG__
|
||||
os << info.file << "(" << info.line << ")";
|
||||
|
Reference in New Issue
Block a user