blitzdg
an open-source project aiming to implement parallel discontinuous Galerkin (dg) solvers for common partial differential equations systems using blitz++ for array and tensor manipulations and MPI for distributed parallelism.
visualstudiooutput.h
1 
2 // Copyright Joakim Karlsson & Kim Gräsman 2010-2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 
7 #ifndef IGLOO_VISUALSTUDIOOUTPUT_H
8 #define IGLOO_VISUALSTUDIOOUTPUT_H
9 
10 namespace igloo {
11 
13  {
14  public:
15  VisualStudioResultsOutput(std::ostream& outstream = std::cout) : TestResultsOutput(outstream) {}
16 
17  void PrintResult(const TestResults& results) const
18  {
19  TestResults::FailedTestsType::const_iterator it;
20 
21  for(it = results.FailedTests().begin(); it != results.FailedTests().end(); it++)
22  {
23  output << FormatOriginString(*it) << " : assertion failed error: " << (*it).GetContextName() << "::" << (*it).GetSpecName() << ":" << std::endl << (*it).GetErrorMessage() << std::endl;
24  }
25 
26  output << "Test run complete. " << results.NumberOfTestsRun() << " tests run, " << results.NumberOfSucceededTests() << " succeeded, " << results.NumberOfFailedTests() << " failed." << std::endl;
27  }
28 
29  private:
30 
31  std::string FormatOriginString(const FailedTestResult& result) const
32  {
33  if(result.HasLineNumber() && result.HasFilename())
34  {
35  std::ostringstream builder;
36  builder << result.Filename() << "(" << result.LineNumber() << ")";
37  return builder.str();
38  }
39 
40  // Default to toolname if no location information is available
41  return "Igloo";
42  }
43  };
44 }
45 #endif
Definition: testresult.h:52
Definition: testresultsoutput.h:12
Definition: visualstudiooutput.h:12
Definition: context.h:13
Definition: testresults.h:12