PlasCom2  1.0
XPACC Multi-physics simluation application
UtilTest.H
Go to the documentation of this file.
1 #include "Testing.H"
7 
8 
9 namespace ix { namespace util {
10 
11 
12  // The basic overaching test object for the primitive
13  // utilities
14  class testmanager : public test::manager<test::results>
15  {
16  private:
17  std::string TestString1;
18  public:
19  void Prologue(){
20  std::ostringstream Ostr;
21  Ostr << "#" << std::endl
22  << " " << std::endl
23  << "\t" << std::endl
24  << "Test # Comment" << std::endl
25  << "# " << std::endl;
26  TestString1.assign(Ostr.str());
27  }
28  // An actual test of the function called
29  // GetNextContent. The name Test__XXXXX will
30  // eventually help automated utilities with
31  // running tests by name.
33  std::istringstream Istr(TestString1);
34  std::string next_content(util::GetNextContent(Istr));
35  std::string line;
36  std::getline(Istr,line);
37  result.UpdateResult("GetNextContent:CommentsAndWhiteSpace",
38  next_content == "Test ");
39  result.UpdateResult("GetNextContent:StreamObject",
40  line == "# ");
41  }
42 
43  // This runs all the tests
44  void Process(test::results &result){
45  Prologue();
46  Test__GetNextContent(result);
47  Epilogue();
48  }
49 
50  // This runs the tests named in a list
51  void ProcessTests(std::list<std::string> &test_names,test::results &result){
52  Prologue();
53  std::list<std::string>::iterator tni = test_names.begin();
54  while(tni != test_names.end())
55  {
56  std::string testname(*tni++);
57  if(testname == "GetNextContent")
58  Test__GetNextContent(result);
59  }
60  Epilogue();
61  }
62  };
63  };
64 };
std::string TestString1
Definition: UtilTest.H:17
virtual void Epilogue()
Clean up any test fixtures that need cleaning.
Definition: Testing.H:121
std::string GetNextContent(std::istream &In)
Defines MPI-specific parallel global and program classes.
void ProcessTests(std::list< std::string > &test_names, test::results &result)
Process named tests from a list and populate a "results" object.
Definition: UtilTest.H:51
Encapsulating class for collections of test results.
Definition: Testing.H:18
void Test__GetNextContent(test::results &result)
Definition: UtilTest.H:32
void Process(test::results &result)
Process all tests and populate a "results" object.
Definition: UtilTest.H:44
Testing constructs for unit testing.
void UpdateResult(const std::string &name, const ValueType &result)
Updates an existing test result.
Definition: Testing.H:55
void Prologue()
Set up the tests and any test fixture constructs.
Definition: UtilTest.H:19
Interface for a general testing object.
Definition: Testing.H:84