Generate random rng seed if user did not specify one

Closes #2161
This commit is contained in:
Martin Hořeňovský
2021-10-08 21:35:29 +02:00
parent 4e6d306742
commit fce42b62ad
4 changed files with 34 additions and 6 deletions
+7
View File
@@ -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