diff options
| author | Martin Hořeňovský | 2021-10-06 00:00:46 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-10-08 21:35:29 +0200 |
| commit | fce42b62ad86477a684ba5b77018747af9c80ac1 (patch) | |
| tree | 856bbb1d0d94e8d32dbaee69cf3e5a38cce903f4 /src/catch2/catch_session.cpp | |
| parent | 4e6d306742cdaab773bf98277e30e77922bb8ee1 (diff) | |
| download | catch3-fce42b62ad86477a684ba5b77018747af9c80ac1.tar.gz | |
Generate random rng seed if user did not specify one
Closes #2161
Diffstat (limited to 'src/catch2/catch_session.cpp')
| -rw-r--r-- | src/catch2/catch_session.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/catch2/catch_session.cpp b/src/catch2/catch_session.cpp index 66e9e482..913c7111 100644 --- a/src/catch2/catch_session.cpp +++ b/src/catch2/catch_session.cpp @@ -24,6 +24,7 @@ #include <catch2/internal/catch_move_and_forward.hpp> #include <algorithm> +#include <ctime> #include <iomanip> #include <set> @@ -170,6 +171,10 @@ namespace Catch { if( m_startupExceptions ) return 1; + if (!m_configData.rngSeed) { + m_configData.rngSeed = static_cast<unsigned int>(std::time(nullptr)); + } + auto result = m_cli.parse( Clara::Args( argc, argv ) ); if( !result ) { config(); @@ -187,6 +192,7 @@ namespace Catch { showHelp(); if( m_configData.libIdentify ) libIdentify(); + m_config.reset(); return 0; } @@ -256,6 +262,7 @@ namespace Catch { return 0; } + CATCH_TRY { config(); // Force config to be constructed |