ElmerFoamFSI  2.0
ElmerFoamFSI is fluid-solid interaction simulation application built up from OpenFOAM CFD and Elmer CSM coupled through the IMPACT multiphysics software integration infrastructure.
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Groups Pages
virtual void Test__LoadUnitTestData ( ResultsType &  result)
inlinevirtual

Definition at line 274 of file OpenFoamModuleDriverTest.H.

References TestingObject< ResultsType >::GetInputData(), and TestingObject< ResultsType >::SourceDirPath.

Referenced by TestingObject< ResultsType >::Process(), and TestingObject< ResultsType >::RunTest().

274  {
275  std::cout << "Running Test__LoadUnitTestData" << std::endl;
276 
277  bool works=false;
278  //Call GetInputData to copy input test data to temp directory for running tests.
279  std::string suffix = "/share/Testing/test_data/HronTurekFsi";
280  std::string dirName = SourceDirPath + suffix;
281 
282  //Make path for directory to run the test in.
283  std::string TestDir = IRAD::Sys::CWD() + "/UnitTestData";
284  int IntDir = GetInputData(dirName, TestDir);
285 
286  //Check if GetInputData exited correctly.
287  if(IntDir != 0){
288  std::cout << "LoadUnitTestData Error: GetInputData call failed."
289  << std::endl;
290  result.UpdateResult("LoadUnitTestData:Works", false);
291  return;
292  }
293 
294  //Check if TestDir directory (from GetInputData) exists in current directory
295  if(!IRAD::Sys::FILEEXISTS(TestDir)){
296  std::cout << "LoadUnitTestData Error: Could not find directory, "
297  << TestDir << ", for running tests." << std::endl;
298  result.UpdateResult("LoadUnitTestData:Works", false);
299  return;
300  }
301 
302  //Save original directory name for later
303  std::string OrgDir = IRAD::Sys::CWD();
304 
305  //Change directories to TestDir directory for running
306  IntDir = IRAD::Sys::ChDir(TestDir);
307  if(IntDir == -1){
308  std::cout << "LoadUnitTestData Error: Could not change directories to "
309  << TestDir << "." << std::endl;
310  result.UpdateResult("LoadUnitTestData:Works", false);
311  return;
312  }
313  result.UpdateResult("LoadUnitTestData:Works", true);
314 
315  IntDir = IRAD::Sys::ChDir(OrgDir);
316 
317  return;
318  }
virtual int GetInputData(std::string sourceDir, std::string destDir)
Function to copy input data from source testing directory for use in unit tests.
std::string SourceDirPath
The string for the testing source directory.

Here is the call graph for this function:

Here is the caller graph for this function: