PlasCom2  1.0
XPACC Multi-physics simluation application
TestingProgram.C
Go to the documentation of this file.
1 #include "ComLine.H"
11 #include "TestingProgram.H"
12 
13 namespace ix {
14  namespace test {
44  int Program::Run()
45  {
46  // If the user specified a name, then run only the named test
47  if(!testName.empty()){
48  // This call runs a test by name
49  test.RunTest(TestName,results);
50  } else if(!listName.empty()){
51  std::ifstream listInf;
52  listInf.open(ListName.c_str());
53  if(!listInf){
54  std::ostringstream errStream;
55  errStream << "Error: Could not open list of tests in file "
56  << listName << "." << std::endl;
57  ErrOut(errStream.str());
58  return(1);
59  }
60  std::string testName;
61  while(std::getline(listInf,testName))
62  test.RunTest(testName,results);
63  listInf.close();
64  }
65  else {
66  // This call runs all the tests for the Codelet3 namespace.
67  test.Process(results);
68  }
69  };
70 
71  int TestingProgram::Finalize(){
72  *Out << results << std::endl;
73  if(verblevel > 2)
74  *Out << "Test: Exiting test function (success)" << std::endl;
75 
76  // Don't open until the end - race condition resolution
77  if(!OutFileName.empty()){
78  Ouf.open(OutFileName.c_str());
79  if(!Ouf){
80  std::cout << "Test> Error: Could not open output file, "
81  << OutFileName << " for test output. Exiting (fail)." << std::endl;
82  return(1);
83  }
84  Ouf << outStream.str();
85  Ouf.close();
86  }
87  // if(Ouf)
88  // Ouf.close();
89 
90  return(0);
91  }
92 };
93 
94 int main(int argc,char *argv[])
95 {
96  return(Test(argc,argv));
97 }
Implements a program object for testing.
Defines MPI-specific parallel global and program classes.
ComLineObject header.
int main(int argc, char *argv[])
Definition: pc2compare.C:4
int Test(int argc, char *argv[])
Drives the plascom2::TestObject.
Definition: PC2TestDriver.C:45