Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

dev build 2

Commit
8f66e3495bd8c161683ef7dacefbce1c2ee69ddf
Author
Phil Nash ·
Parents
d87e551efabb

Files · Download .tar.gz

Changes

 README.md                          |  2 +-
 include/internal/catch_version.hpp |  2 +-
 single_include/catch.hpp           | 25 +++++++++++++++++++++----
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index c9d9f6c3..4fee77e6 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 ![catch logo](catch-logo-small.png)
 
-*v1.2.1-develop.1*
+*v1.2.1-develop.2*
 
 Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch)
 
diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp
index bf57c617..fbd96d49 100644
--- a/include/internal/catch_version.hpp
+++ b/include/internal/catch_version.hpp
@@ -37,7 +37,7 @@ namespace Catch {
         return os;
     }
 
-    Version libraryVersion( 1, 2, 1, "develop", 1 );
+    Version libraryVersion( 1, 2, 1, "develop", 2 );
 
 }
 
diff --git a/single_include/catch.hpp b/single_include/catch.hpp
index b06810f6..713dc02b 100644
--- a/single_include/catch.hpp
+++ b/single_include/catch.hpp
@@ -1,6 +1,6 @@
 /*
- *  Catch v1.2.1-develop.1
- *  Generated: 2015-07-02 08:21:11.983471
+ *  Catch v1.2.1-develop.2
+ *  Generated: 2015-07-02 23:02:49.715552
  *  ----------------------------------------------------------
  *  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
@@ -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 ) {
@@ -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", 2 );
 
 }
 
@@ -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 << ")";