diff --git a/Code/Testing/otbTestMain.h b/Code/Testing/otbTestMain.h index 01fd9c54e6b33bdb4767d6e8b022f9b9dceedb6d..8daee5c11cf94b61c5a6afa38efbaea79e8e2acf 100644 --- a/Code/Testing/otbTestMain.h +++ b/Code/Testing/otbTestMain.h @@ -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) {