Permalink
Browse files

Moved VisualStudioOutput to its own file

  • Loading branch information...
joakimkarlsson committed Jul 26, 2011
1 parent 5f1ec41 commit 9df30e3bb33df572a71d016933e6e80e7e3d1932
@@ -8,5 +8,6 @@
#define IGLOO_OUTPUTTERS_H
#include <igloo/core/outputters/defaulttestresultsoutput.h>
+#include <igloo/core/outputters/visualstudiooutput.h>
#endif
@@ -0,0 +1,49 @@
+
+// Copyright Joakim Karlsson & Kim Gräsman 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef IGLOO_VISUALSTUDIOOUTPUT_H
+#define IGLOO_VISUALSTUDIOOUTPUT_H
+
+namespace igloo {
+
+ class VisualStudioResultsOutput
+ {
+ public:
+ VisualStudioResultsOutput(std::ostream& output)
+ : output_(output)
+ {}
+
+ void PrintResult(const TestResults& results)
+ {
+ TestResults::FailedTestsType::const_iterator it;
+
+ for(it = results.FailedTests().begin(); it != results.FailedTests().end(); it++)
+ {
+ output_ << FormatOriginString(*it) << " : assertion failed error I001: " << (*it).GetContextName() << "::" << (*it).GetSpecName() << ": " << (*it).GetErrorMessage() << std::endl;
+ }
+
+ output_ << "Test run complete. " << results.NumberOfTestsRun() << " tests run, " << results.NumberOfSucceededTests() << " succeeded, " << results.NumberOfFailedTests() << " failed." << std::endl;
+ }
+
+ private:
+
+ std::string FormatOriginString(const FailedTestResult& result)
+ {
+ if(result.HasLineNumber() && result.HasFilename())
+ {
+ std::ostringstream builder;
+ builder << result.Filename() << "(" << result.LineNumber() << ")";
+ return builder.str();
+ }
+
+ // Default to toolname if no location information is available
+ return "Igloo";
+ }
+
+ std::ostream& output_;
+ };
+}
+#endif
@@ -9,43 +9,6 @@
using namespace igloo;
-class VisualStudioResultsOutput
-{
- public:
- VisualStudioResultsOutput(std::ostream& output)
- : output_(output)
- {}
-
- void PrintResult(const TestResults& results)
- {
- TestResults::FailedTestsType::const_iterator it;
-
- for(it = results.FailedTests().begin(); it != results.FailedTests().end(); it++)
- {
- output_ << FormatOriginString(*it) << " : assertion failed error I001: " << (*it).GetContextName() << "::" << (*it).GetSpecName() << ": " << (*it).GetErrorMessage() << std::endl;
- }
-
- output_ << "Test run complete. " << results.NumberOfTestsRun() << " tests run, " << results.NumberOfSucceededTests() << " succeeded, " << results.NumberOfFailedTests() << " failed." << std::endl;
- }
-
- private:
-
- std::string FormatOriginString(const FailedTestResult& result)
- {
- if(result.HasLineNumber() && result.HasFilename())
- {
- std::ostringstream builder;
- builder << result.Filename() << "(" << result.LineNumber() << ")";
- return builder.str();
- }
-
- // Default to toolname if no location information is available
- return "Igloo";
- }
-
- std::ostream& output_;
-};
-
Context(VisualStudioResultsOutput_EmptyTestRun)
{
std::auto_ptr<VisualStudioResultsOutput> output;

0 comments on commit 9df30e3

Please sign in to comment.