mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-30 16:37:56 +00:00
reseeds rng before each test case and provides access to seed through Catch::rngSeed() function
This commit is contained in:
parent
b971fe785b
commit
d87e551efa
5 changed files with 18 additions and 1 deletions
|
@ -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 << ")";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue