Skip to content
Snippets Groups Projects
Commit af579d5f authored by Jonathan Guinet's avatar Jonathan Guinet
Browse files

ENH: explicit setseed for rand() and itkMersenneTwister for Testing.

parent 1af64bde
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,9 @@
#include "otbTestHelper.h"
#include "itkMersenneTwisterRandomVariateGenerator.h"
typedef int (*MainFuncPointer)(int, char*[]);
std::map<std::string, MainFuncPointer> StringToTestFunctionMap;
......@@ -49,6 +52,14 @@ void PrintAvailableTests()
}
}
//apply dedicated treatment to test
void LoadTestEnv()
{
//Set seed for rand and itk mersenne twister
srand(1);
itk::Statistics::MersenneTwisterRandomVariateGenerator::GetInstance()->SetSeed(1234);
}
int main(int ac, char* av[])
{
bool lFlagRegression(false);
......@@ -77,6 +88,8 @@ int main(int ac, char* av[])
otb::TestHelper::Pointer testHelper = otb::TestHelper::New();
RegisterTests();
LoadTestEnv(); // load specific treatments for testing
std::string testToRun;
if (ac < 2)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment