Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/catch_session.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2021-10-06 00:00:46 +0200
committerMartin Hořeňovský2021-10-08 21:35:29 +0200
commitfce42b62ad86477a684ba5b77018747af9c80ac1 (patch)
tree856bbb1d0d94e8d32dbaee69cf3e5a38cce903f4 /src/catch2/catch_session.cpp
parent4e6d306742cdaab773bf98277e30e77922bb8ee1 (diff)
downloadcatch3-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.cpp7
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