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 @@ ...@@ -28,6 +28,9 @@
#include "otbTestHelper.h" #include "otbTestHelper.h"
#include "itkMersenneTwisterRandomVariateGenerator.h"
typedef int (*MainFuncPointer)(int, char*[]); typedef int (*MainFuncPointer)(int, char*[]);
std::map<std::string, MainFuncPointer> StringToTestFunctionMap; std::map<std::string, MainFuncPointer> StringToTestFunctionMap;
...@@ -49,6 +52,14 @@ void PrintAvailableTests() ...@@ -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[]) int main(int ac, char* av[])
{ {
bool lFlagRegression(false); bool lFlagRegression(false);
...@@ -77,6 +88,8 @@ int main(int ac, char* av[]) ...@@ -77,6 +88,8 @@ int main(int ac, char* av[])
otb::TestHelper::Pointer testHelper = otb::TestHelper::New(); otb::TestHelper::Pointer testHelper = otb::TestHelper::New();
RegisterTests(); RegisterTests();
LoadTestEnv(); // load specific treatments for testing
std::string testToRun; std::string testToRun;
if (ac < 2) 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