2010-12-31 23:07:47 +01:00
|
|
|
/*
|
|
|
|
* Created by Phil on 31/12/2010.
|
|
|
|
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
|
|
|
*
|
|
|
|
* 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)
|
|
|
|
*/
|
2012-09-17 07:42:29 +02:00
|
|
|
#ifndef TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED
|
|
|
|
#define TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED
|
2010-12-31 23:07:47 +01:00
|
|
|
|
|
|
|
#include "catch_common.h"
|
2012-02-24 09:59:35 +01:00
|
|
|
#include "catch_totals.hpp"
|
2012-05-04 08:55:11 +02:00
|
|
|
#include "catch_ptr.hpp"
|
2012-08-28 09:20:18 +02:00
|
|
|
#include "catch_config.hpp"
|
2012-11-22 20:17:20 +01:00
|
|
|
#include "catch_test_case_info.h"
|
|
|
|
#include "catch_assertionresult.h"
|
2012-12-05 09:40:53 +01:00
|
|
|
#include "catch_option.hpp"
|
2010-12-31 23:07:47 +01:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <ostream>
|
2010-12-31 23:21:36 +01:00
|
|
|
#include <map>
|
2010-12-31 23:07:47 +01:00
|
|
|
|
|
|
|
namespace Catch
|
|
|
|
{
|
2012-11-29 21:31:17 +01:00
|
|
|
struct ReporterConfig {
|
|
|
|
ReporterConfig( std::ostream& _stream, ConfigData const& _fullConfig )
|
2012-11-27 00:28:00 +01:00
|
|
|
: m_stream( &_stream ), m_fullConfig( _fullConfig ) {}
|
2012-09-20 09:17:52 +02:00
|
|
|
|
2012-12-05 09:40:53 +01:00
|
|
|
std::ostream& stream() const { return *m_stream; }
|
2012-11-27 00:28:00 +01:00
|
|
|
std::string name() const { return m_fullConfig.name; }
|
|
|
|
bool includeSuccessfulResults() const { return m_fullConfig.includeWhichResults == Include::SuccessfulResults; }
|
|
|
|
bool warnAboutMissingAssertions() const { return m_fullConfig.warnings & ConfigData::WarnAbout::NoAssertions; }
|
2012-09-20 09:17:52 +02:00
|
|
|
|
|
|
|
private:
|
2012-11-27 00:28:00 +01:00
|
|
|
std::ostream* m_stream;
|
|
|
|
ConfigData m_fullConfig;
|
2012-08-28 09:20:18 +02:00
|
|
|
};
|
2012-11-22 20:17:20 +01:00
|
|
|
|
2012-11-29 21:31:17 +01:00
|
|
|
struct ReporterPreferences {
|
2012-11-29 10:05:51 +01:00
|
|
|
ReporterPreferences()
|
|
|
|
: shouldRedirectStdOut( false )
|
|
|
|
{}
|
|
|
|
|
|
|
|
bool shouldRedirectStdOut;
|
|
|
|
};
|
|
|
|
|
2012-12-02 00:49:57 +01:00
|
|
|
struct TestRunInfo {
|
|
|
|
TestRunInfo( std::string const& _name ) : name( _name ) {}
|
|
|
|
std::string name;
|
|
|
|
};
|
|
|
|
struct GroupInfo {
|
|
|
|
GroupInfo( std::string const& _name ) : name( _name ) {}
|
|
|
|
std::string name;
|
|
|
|
};
|
|
|
|
|
2012-11-29 21:31:17 +01:00
|
|
|
struct SectionInfo {
|
|
|
|
SectionInfo( std::string const& _name,
|
|
|
|
std::string const& _description,
|
|
|
|
SourceLineInfo const& _lineInfo )
|
|
|
|
: name( _name ),
|
|
|
|
description( _description ),
|
2012-11-30 09:58:46 +01:00
|
|
|
lineInfo( _lineInfo )
|
2012-11-29 21:31:17 +01:00
|
|
|
{}
|
|
|
|
|
|
|
|
std::string name;
|
|
|
|
std::string description;
|
2012-11-30 09:58:46 +01:00
|
|
|
SourceLineInfo lineInfo;
|
2012-11-29 21:31:17 +01:00
|
|
|
};
|
|
|
|
|
2012-12-05 09:40:53 +01:00
|
|
|
struct ThreadedSectionInfo : SectionInfo, SharedImpl<> {
|
|
|
|
ThreadedSectionInfo( SectionInfo const& _sectionInfo, Ptr<ThreadedSectionInfo> const& _parent = Ptr<ThreadedSectionInfo>() )
|
|
|
|
: SectionInfo( _sectionInfo ),
|
2012-12-09 12:20:46 +01:00
|
|
|
parent( _parent ),
|
|
|
|
printed( false )
|
2012-12-05 09:40:53 +01:00
|
|
|
{}
|
|
|
|
virtual ~ThreadedSectionInfo();
|
|
|
|
|
|
|
|
std::vector<Ptr<ThreadedSectionInfo> > children;
|
|
|
|
Ptr<ThreadedSectionInfo> parent;
|
2012-12-09 12:20:46 +01:00
|
|
|
bool printed;
|
2012-12-05 09:40:53 +01:00
|
|
|
};
|
|
|
|
|
2012-11-30 19:54:06 +01:00
|
|
|
struct AssertionStats : SharedImpl<> {
|
2012-11-29 21:31:17 +01:00
|
|
|
AssertionStats( AssertionResult const& _assertionResult,
|
|
|
|
Totals const& _totals )
|
2012-11-25 22:43:36 +01:00
|
|
|
: assertionResult( _assertionResult ),
|
|
|
|
totals( _totals )
|
|
|
|
{}
|
2012-11-30 19:54:06 +01:00
|
|
|
virtual ~AssertionStats();
|
2012-11-25 22:43:36 +01:00
|
|
|
|
2012-11-22 20:17:20 +01:00
|
|
|
AssertionResult assertionResult;
|
|
|
|
Totals totals;
|
|
|
|
};
|
|
|
|
|
2012-11-30 19:54:06 +01:00
|
|
|
struct SectionStats : SharedImpl<> {
|
2012-11-30 09:58:46 +01:00
|
|
|
SectionStats( SectionInfo const& _sectionInfo,
|
|
|
|
Counts const& _assertions,
|
|
|
|
bool _missingAssertions )
|
|
|
|
: sectionInfo( _sectionInfo ),
|
|
|
|
assertions( _assertions ),
|
|
|
|
missingAssertions( _missingAssertions )
|
|
|
|
{}
|
2012-11-30 19:54:06 +01:00
|
|
|
virtual ~SectionStats();
|
|
|
|
|
2012-11-29 21:31:17 +01:00
|
|
|
SectionInfo sectionInfo;
|
2012-11-30 09:58:46 +01:00
|
|
|
Counts assertions;
|
|
|
|
bool missingAssertions;
|
2012-11-29 21:31:17 +01:00
|
|
|
};
|
|
|
|
|
2012-11-30 19:54:06 +01:00
|
|
|
struct TestCaseStats : SharedImpl<> {
|
2012-11-29 21:31:17 +01:00
|
|
|
TestCaseStats( TestCaseInfo const& _testInfo,
|
|
|
|
Totals const& _totals,
|
|
|
|
std::string const& _stdOut,
|
|
|
|
std::string const& _stdErr,
|
2012-11-27 00:28:00 +01:00
|
|
|
bool _missingAssertions,
|
2012-11-25 22:43:36 +01:00
|
|
|
bool _aborting )
|
|
|
|
: testInfo( _testInfo ),
|
|
|
|
totals( _totals ),
|
|
|
|
stdOut( _stdOut ),
|
|
|
|
stdErr( _stdErr ),
|
2012-11-27 00:28:00 +01:00
|
|
|
missingAssertions( _missingAssertions ),
|
2012-11-25 22:43:36 +01:00
|
|
|
aborting( _aborting )
|
|
|
|
{}
|
2012-11-30 19:54:06 +01:00
|
|
|
virtual ~TestCaseStats();
|
2012-11-25 22:43:36 +01:00
|
|
|
|
|
|
|
TestCaseInfo testInfo;
|
2012-11-22 20:17:20 +01:00
|
|
|
Totals totals;
|
|
|
|
std::string stdOut;
|
|
|
|
std::string stdErr;
|
2012-11-27 00:28:00 +01:00
|
|
|
bool missingAssertions;
|
2012-11-22 20:17:20 +01:00
|
|
|
bool aborting;
|
|
|
|
};
|
2010-12-31 23:07:47 +01:00
|
|
|
|
2012-11-30 19:54:06 +01:00
|
|
|
struct TestGroupStats : SharedImpl<> {
|
2012-12-02 00:49:57 +01:00
|
|
|
TestGroupStats( GroupInfo const& _groupInfo,
|
2012-11-29 21:31:17 +01:00
|
|
|
Totals const& _totals,
|
2012-11-25 22:43:36 +01:00
|
|
|
bool _aborting )
|
2012-12-02 00:49:57 +01:00
|
|
|
: groupInfo( _groupInfo ),
|
2012-11-25 22:43:36 +01:00
|
|
|
totals( _totals ),
|
|
|
|
aborting( _aborting )
|
|
|
|
{}
|
2012-11-30 19:54:06 +01:00
|
|
|
virtual ~TestGroupStats();
|
2012-11-25 22:43:36 +01:00
|
|
|
|
2012-12-02 00:49:57 +01:00
|
|
|
GroupInfo groupInfo;
|
2012-11-22 20:17:20 +01:00
|
|
|
Totals totals;
|
|
|
|
bool aborting;
|
|
|
|
};
|
2010-12-31 23:07:47 +01:00
|
|
|
|
2012-11-30 19:54:06 +01:00
|
|
|
struct TestRunStats : SharedImpl<> {
|
2012-12-02 00:49:57 +01:00
|
|
|
TestRunStats( TestRunInfo const& _runInfo,
|
2012-11-29 21:31:17 +01:00
|
|
|
Totals const& _totals,
|
2012-11-25 22:43:36 +01:00
|
|
|
bool _aborting )
|
2012-12-02 00:49:57 +01:00
|
|
|
: runInfo( _runInfo ),
|
2012-11-25 22:43:36 +01:00
|
|
|
totals( _totals ),
|
|
|
|
aborting( _aborting )
|
|
|
|
{}
|
2012-11-30 19:54:06 +01:00
|
|
|
virtual ~TestRunStats();
|
2012-11-25 22:43:36 +01:00
|
|
|
|
2012-12-02 00:49:57 +01:00
|
|
|
TestRunInfo runInfo;
|
2012-11-22 20:17:20 +01:00
|
|
|
Totals totals;
|
|
|
|
bool aborting;
|
|
|
|
};
|
|
|
|
|
|
|
|
// !Work In progress
|
|
|
|
struct IStreamingReporter : IShared {
|
2012-11-25 22:43:36 +01:00
|
|
|
virtual ~IStreamingReporter();
|
2012-12-05 09:40:53 +01:00
|
|
|
|
|
|
|
// Implementing class must also provide the following static methid:
|
|
|
|
// static std::string getDescription();
|
|
|
|
|
2012-11-29 10:05:51 +01:00
|
|
|
virtual ReporterPreferences getPreferences() const = 0;
|
|
|
|
|
2012-12-02 00:49:57 +01:00
|
|
|
virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0;
|
|
|
|
virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0;
|
2012-11-22 20:17:20 +01:00
|
|
|
|
2012-11-29 21:31:17 +01:00
|
|
|
virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0;
|
2012-11-30 09:58:46 +01:00
|
|
|
virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0;
|
|
|
|
|
2012-11-29 21:31:17 +01:00
|
|
|
virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0;
|
2012-11-22 20:17:20 +01:00
|
|
|
|
2012-11-30 19:54:06 +01:00
|
|
|
virtual void assertionEnded( Ptr<AssertionStats const> const& assertionStats ) = 0;
|
|
|
|
virtual void sectionEnded( Ptr<SectionStats const> const& sectionStats ) = 0;
|
|
|
|
virtual void testCaseEnded( Ptr<TestCaseStats const> const& testCaseStats ) = 0;
|
|
|
|
virtual void testGroupEnded( Ptr<TestGroupStats const> const& testGroupStats ) = 0;
|
|
|
|
virtual void testRunEnded( Ptr<TestRunStats const> const& testRunStats ) = 0;
|
2012-11-22 20:17:20 +01:00
|
|
|
};
|
|
|
|
// !TBD: Derived helper that implements the streaming interface but holds the stats
|
|
|
|
// - declares a new interface where methods are called at the end of each event
|
|
|
|
// - this would be used by the JUnit reporter, for example.
|
|
|
|
// - it may be used by the basic reporter, too, but that would clear down the stack
|
|
|
|
// as it goes
|
2012-12-05 09:40:53 +01:00
|
|
|
struct AccumulatingReporter : SharedImpl<IStreamingReporter> {
|
|
|
|
|
|
|
|
AccumulatingReporter( ReporterConfig const& _config )
|
2012-12-09 12:20:46 +01:00
|
|
|
: m_config( _config ),
|
|
|
|
stream( _config.stream() )
|
2012-12-05 09:40:53 +01:00
|
|
|
{}
|
|
|
|
|
|
|
|
virtual ~AccumulatingReporter();
|
|
|
|
|
|
|
|
virtual void testRunStarting( TestRunInfo const& _testRunInfo ) {
|
|
|
|
testRunInfo = _testRunInfo;
|
|
|
|
}
|
|
|
|
virtual void testGroupStarting( GroupInfo const& _groupInfo ) {
|
|
|
|
unusedGroupInfo = _groupInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void testCaseStarting( TestCaseInfo const& _testInfo ) {
|
|
|
|
unusedTestCaseInfo = _testInfo;
|
|
|
|
}
|
|
|
|
virtual void sectionStarting( SectionInfo const& _sectionInfo ) {
|
|
|
|
Ptr<ThreadedSectionInfo> sectionInfo = new ThreadedSectionInfo( _sectionInfo );
|
|
|
|
unusedSectionInfo = sectionInfo;
|
|
|
|
if( !currentSectionInfo ) {
|
|
|
|
currentSectionInfo = sectionInfo;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
currentSectionInfo->children.push_back( sectionInfo );
|
|
|
|
sectionInfo->parent = currentSectionInfo;
|
|
|
|
currentSectionInfo = sectionInfo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void sectionEnded( Ptr<SectionStats const> const& /* _sectionStats */ ) {
|
|
|
|
currentSectionInfo = currentSectionInfo->parent;
|
|
|
|
unusedSectionInfo = currentSectionInfo;
|
|
|
|
}
|
|
|
|
virtual void testCaseEnded( Ptr<TestCaseStats const> const& /* _testCaseStats */ ) {
|
|
|
|
unusedTestCaseInfo.reset();
|
|
|
|
}
|
|
|
|
virtual void testGroupEnded( Ptr<TestGroupStats const> const& /* _testGroupStats */ ) {
|
|
|
|
unusedGroupInfo.reset();
|
|
|
|
}
|
|
|
|
virtual void testRunEnded( Ptr<TestRunStats const> const& /* _testRunStats */ ) {
|
|
|
|
}
|
|
|
|
|
2012-12-09 12:20:46 +01:00
|
|
|
ReporterConfig m_config;
|
2012-12-05 09:40:53 +01:00
|
|
|
Option<TestRunInfo> testRunInfo;
|
|
|
|
Option<GroupInfo> unusedGroupInfo;
|
|
|
|
Option<TestCaseInfo> unusedTestCaseInfo;
|
|
|
|
Ptr<ThreadedSectionInfo> unusedSectionInfo;
|
|
|
|
Ptr<ThreadedSectionInfo> currentSectionInfo;
|
|
|
|
bool currentSectionOpen;
|
|
|
|
std::ostream& stream;
|
|
|
|
};
|
|
|
|
|
2012-11-22 20:17:20 +01:00
|
|
|
|
|
|
|
|
2012-11-30 19:54:06 +01:00
|
|
|
// Deprecated
|
2012-05-09 09:17:51 +02:00
|
|
|
struct IReporter : IShared {
|
2012-08-13 08:46:10 +02:00
|
|
|
virtual ~IReporter();
|
2012-10-16 09:27:21 +02:00
|
|
|
|
|
|
|
virtual bool shouldRedirectStdout() const = 0;
|
|
|
|
|
2012-05-09 09:17:51 +02:00
|
|
|
virtual void StartTesting() = 0;
|
2012-11-30 19:54:06 +01:00
|
|
|
virtual void EndTesting( Totals const& totals ) = 0;
|
2012-11-29 21:31:17 +01:00
|
|
|
virtual void StartGroup( std::string const& groupName ) = 0;
|
2012-11-30 19:54:06 +01:00
|
|
|
virtual void EndGroup( std::string const& groupName, Totals const& totals ) = 0;
|
2012-11-29 21:31:17 +01:00
|
|
|
virtual void StartTestCase( TestCaseInfo const& testInfo ) = 0;
|
|
|
|
virtual void EndTestCase( TestCaseInfo const& testInfo, Totals const& totals, std::string const& stdOut, std::string const& stdErr ) = 0;
|
|
|
|
virtual void StartSection( std::string const& sectionName, std::string const& description ) = 0;
|
|
|
|
virtual void EndSection( std::string const& sectionName, const Counts& assertions ) = 0;
|
|
|
|
virtual void NoAssertionsInSection( std::string const& sectionName ) = 0;
|
|
|
|
virtual void NoAssertionsInTestCase( std::string const& testName ) = 0;
|
2012-06-01 20:40:27 +02:00
|
|
|
virtual void Aborted() = 0;
|
2012-10-16 09:27:21 +02:00
|
|
|
virtual void Result( const AssertionResult& result ) = 0;
|
2010-12-31 23:07:47 +01:00
|
|
|
};
|
2012-11-25 22:43:36 +01:00
|
|
|
|
|
|
|
class LegacyReporterAdapter : public SharedImpl<IStreamingReporter>
|
|
|
|
{
|
|
|
|
public:
|
2012-11-29 21:31:17 +01:00
|
|
|
LegacyReporterAdapter( Ptr<IReporter> const& legacyReporter, ReporterConfig const& config )
|
2012-11-27 00:28:00 +01:00
|
|
|
: m_legacyReporter( legacyReporter ),
|
|
|
|
m_config( config )
|
2012-11-25 22:43:36 +01:00
|
|
|
{}
|
|
|
|
virtual ~LegacyReporterAdapter();
|
2012-11-29 10:05:51 +01:00
|
|
|
|
|
|
|
virtual ReporterPreferences getPreferences() const {
|
|
|
|
ReporterPreferences prefs;
|
|
|
|
prefs.shouldRedirectStdOut = m_legacyReporter->shouldRedirectStdout();
|
|
|
|
return prefs;
|
|
|
|
}
|
|
|
|
|
2012-12-02 00:49:57 +01:00
|
|
|
virtual void testRunStarting( TestRunInfo const& ) {
|
2012-11-25 22:43:36 +01:00
|
|
|
m_legacyReporter->StartTesting();
|
|
|
|
}
|
2012-12-02 00:49:57 +01:00
|
|
|
virtual void testGroupStarting( GroupInfo const& groupInfo ) {
|
|
|
|
m_legacyReporter->StartGroup( groupInfo.name );
|
2012-11-25 22:43:36 +01:00
|
|
|
}
|
2012-11-29 21:31:17 +01:00
|
|
|
virtual void testCaseStarting( TestCaseInfo const& testInfo ) {
|
2012-11-25 22:43:36 +01:00
|
|
|
m_legacyReporter->StartTestCase( testInfo );
|
|
|
|
}
|
2012-11-30 09:58:46 +01:00
|
|
|
virtual void sectionStarting( SectionInfo const& sectionInfo ) {
|
|
|
|
m_legacyReporter->StartSection( sectionInfo.name, sectionInfo.description );
|
|
|
|
}
|
2012-11-29 21:31:17 +01:00
|
|
|
virtual void assertionStarting( AssertionInfo const& ) {
|
2012-11-25 22:43:36 +01:00
|
|
|
// Not on legacy interface
|
|
|
|
}
|
|
|
|
|
2012-11-30 19:54:06 +01:00
|
|
|
virtual void assertionEnded( Ptr<AssertionStats const> const& assertionStats ) {
|
|
|
|
m_legacyReporter->Result( assertionStats->assertionResult );
|
2012-11-25 22:43:36 +01:00
|
|
|
}
|
2012-11-30 19:54:06 +01:00
|
|
|
virtual void sectionEnded( Ptr<SectionStats const> const& sectionStats ) {
|
|
|
|
if( sectionStats->missingAssertions )
|
|
|
|
m_legacyReporter->NoAssertionsInSection( sectionStats->sectionInfo.name );
|
|
|
|
m_legacyReporter->EndSection( sectionStats->sectionInfo.name, sectionStats->assertions );
|
2012-11-30 09:58:46 +01:00
|
|
|
}
|
2012-11-30 19:54:06 +01:00
|
|
|
virtual void testCaseEnded( Ptr<TestCaseStats const> const& testCaseStats ) {
|
|
|
|
if( testCaseStats->missingAssertions )
|
|
|
|
m_legacyReporter->NoAssertionsInTestCase( testCaseStats->testInfo.name );
|
|
|
|
m_legacyReporter->EndTestCase
|
|
|
|
( testCaseStats->testInfo,
|
|
|
|
testCaseStats->totals,
|
|
|
|
testCaseStats->stdOut,
|
|
|
|
testCaseStats->stdErr );
|
2012-11-25 22:43:36 +01:00
|
|
|
}
|
2012-11-30 19:54:06 +01:00
|
|
|
virtual void testGroupEnded( Ptr<TestGroupStats const> const& testGroupStats ) {
|
|
|
|
if( testGroupStats->aborting )
|
2012-11-25 22:43:36 +01:00
|
|
|
m_legacyReporter->Aborted();
|
2012-12-02 00:49:57 +01:00
|
|
|
m_legacyReporter->EndGroup( testGroupStats->groupInfo.name, testGroupStats->totals );
|
2012-11-25 22:43:36 +01:00
|
|
|
}
|
2012-11-30 19:54:06 +01:00
|
|
|
virtual void testRunEnded( Ptr<TestRunStats const> const& testRunStats ) {
|
|
|
|
m_legacyReporter->EndTesting( testRunStats->totals );
|
2012-11-25 22:43:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Ptr<IReporter> m_legacyReporter;
|
2012-11-27 00:28:00 +01:00
|
|
|
ReporterConfig m_config;
|
2012-11-25 22:43:36 +01:00
|
|
|
};
|
|
|
|
|
2010-12-31 23:07:47 +01:00
|
|
|
|
2012-05-09 09:17:51 +02:00
|
|
|
struct IReporterFactory {
|
2012-08-13 08:46:10 +02:00
|
|
|
virtual ~IReporterFactory();
|
2012-11-30 20:15:23 +01:00
|
|
|
virtual IStreamingReporter* create( ReporterConfig const& config ) const = 0;
|
2012-05-09 09:17:51 +02:00
|
|
|
virtual std::string getDescription() const = 0;
|
2010-12-31 23:07:47 +01:00
|
|
|
};
|
|
|
|
|
2012-05-09 09:17:51 +02:00
|
|
|
struct IReporterRegistry {
|
2010-12-31 23:21:36 +01:00
|
|
|
typedef std::map<std::string, IReporterFactory*> FactoryMap;
|
|
|
|
|
2012-08-13 08:46:10 +02:00
|
|
|
virtual ~IReporterRegistry();
|
2012-11-30 20:15:23 +01:00
|
|
|
virtual IStreamingReporter* create( std::string const& name, ReporterConfig const& config ) const = 0;
|
2012-05-09 09:17:51 +02:00
|
|
|
virtual const FactoryMap& getFactories() const = 0;
|
2010-12-31 23:07:47 +01:00
|
|
|
};
|
|
|
|
|
2012-11-29 21:31:17 +01:00
|
|
|
inline std::string trim( std::string const& str ) {
|
2010-12-31 23:07:47 +01:00
|
|
|
std::string::size_type start = str.find_first_not_of( "\n\r\t " );
|
|
|
|
std::string::size_type end = str.find_last_not_of( "\n\r\t " );
|
|
|
|
|
2012-02-28 21:04:25 +01:00
|
|
|
return start != std::string::npos ? str.substr( start, 1+end-start ) : "";
|
2010-12-31 23:07:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-17 07:42:29 +02:00
|
|
|
#endif // TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED
|