2010-11-12 20:55:53 +01:00
|
|
|
/*
|
|
|
|
* Created by Phil on 08/11/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_CONFIG_HPP_INCLUDED
|
|
|
|
#define TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
|
2010-11-12 20:55:53 +01:00
|
|
|
|
2012-08-23 21:08:50 +02:00
|
|
|
#include "catch_test_spec.h"
|
2012-05-10 08:58:48 +02:00
|
|
|
#include "catch_context.h"
|
2012-08-28 09:20:18 +02:00
|
|
|
#include "catch_interfaces_config.h"
|
2013-12-03 19:52:41 +01:00
|
|
|
#include "catch_stream.h"
|
2010-11-12 20:55:53 +01:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2011-01-05 22:04:13 +01:00
|
|
|
#include <iostream>
|
2010-11-12 20:55:53 +01:00
|
|
|
|
2013-01-26 21:06:55 +01:00
|
|
|
#ifndef CATCH_CONFIG_CONSOLE_WIDTH
|
|
|
|
#define CATCH_CONFIG_CONSOLE_WIDTH 80
|
|
|
|
#endif
|
|
|
|
|
2013-12-09 15:18:35 +01:00
|
|
|
namespace CatchOverrides {
|
|
|
|
|
2013-12-19 17:25:50 +01:00
|
|
|
class ConfigGuard {
|
2013-12-09 15:18:35 +01:00
|
|
|
public:
|
|
|
|
ConfigGuard()
|
|
|
|
: origConfig(Catch::getCurrentContext().getConfig())
|
|
|
|
{}
|
2013-12-19 17:25:50 +01:00
|
|
|
~ConfigGuard() {
|
2013-12-09 15:18:35 +01:00
|
|
|
Catch::getCurrentMutableContext().setConfig(origConfig);
|
|
|
|
}
|
|
|
|
const Catch::Ptr<Catch::IConfig const>& value() const {return origConfig;}
|
|
|
|
private:
|
|
|
|
ConfigGuard(const ConfigGuard&);
|
|
|
|
ConfigGuard& operator=(const ConfigGuard&);
|
|
|
|
|
|
|
|
const Catch::Ptr<Catch::IConfig const> origConfig;
|
|
|
|
};
|
|
|
|
|
2013-12-16 23:17:34 +01:00
|
|
|
enum OverrideType { OverrideUpdate, OverrideReset}; // Note: ordered; update must be before reset
|
|
|
|
|
2013-12-09 15:18:35 +01:00
|
|
|
template <typename T>
|
2013-12-19 17:25:50 +01:00
|
|
|
class ConfigLineData {
|
|
|
|
typedef std::map<std::pair<int,OverrideType>, T> LineData;
|
2013-12-09 15:18:35 +01:00
|
|
|
typedef std::map<std::string, LineData> FileLineData;
|
|
|
|
public:
|
2013-12-19 17:25:50 +01:00
|
|
|
T getValueForFileLine(const std::string& file, int line) const {
|
|
|
|
T result(false);
|
|
|
|
FileLineData::const_iterator it = m_data.find(file);
|
|
|
|
if( it != m_data.end() ) {
|
2013-12-16 23:17:34 +01:00
|
|
|
LineData::const_iterator start = it->second.begin();
|
|
|
|
LineData::const_iterator end = it->second.end();
|
|
|
|
for( LineData::const_iterator lineIt = it->second.begin(); lineIt != it->second.end(); ++lineIt ) {
|
|
|
|
const std::pair<int,OverrideType>& current = lineIt->first;
|
|
|
|
if( current.second == OverrideReset ) {
|
2013-12-19 17:25:50 +01:00
|
|
|
if( line == current.first ) {
|
2013-12-16 23:17:34 +01:00
|
|
|
result = lineIt->second;
|
|
|
|
end = lineIt;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
start = lineIt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for( LineData::const_iterator lineIt = start; lineIt != end; ++lineIt ) {
|
|
|
|
const std::pair<int,OverrideType>& current = lineIt->first;
|
|
|
|
if( current.second == OverrideUpdate ) {
|
2013-12-19 17:25:50 +01:00
|
|
|
if( line < current.first )
|
2013-12-16 23:17:34 +01:00
|
|
|
break;
|
|
|
|
result = lineIt->second;
|
|
|
|
}
|
2013-12-10 00:12:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
2013-12-19 17:25:50 +01:00
|
|
|
void recordValueForFileLine(const std::string& file, OverrideType overRide, int line, const T& v)
|
|
|
|
{
|
|
|
|
FileLineData::iterator it = m_data.find(file);
|
|
|
|
if( it == m_data.end() ) {
|
2013-12-10 00:12:05 +01:00
|
|
|
LineData tmp;
|
2013-12-19 17:25:50 +01:00
|
|
|
std::pair<int,OverrideType> current = std::make_pair(line, overRide);
|
2013-12-16 23:17:34 +01:00
|
|
|
tmp.insert(std::make_pair(current,v));
|
2013-12-19 17:25:50 +01:00
|
|
|
m_data.insert(std::make_pair(file, tmp));
|
2013-12-10 00:12:05 +01:00
|
|
|
}
|
2013-12-16 23:17:34 +01:00
|
|
|
else {
|
2013-12-19 17:25:50 +01:00
|
|
|
std::pair<int,OverrideType> current = std::make_pair(line, overRide);
|
2013-12-16 23:17:34 +01:00
|
|
|
LineData::iterator lineIt = it->second.find(current);
|
|
|
|
if( lineIt == it->second.end() ) {
|
|
|
|
it->second.insert(std::make_pair(current,v));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
lineIt->second = v;
|
|
|
|
}
|
2013-12-10 00:12:05 +01:00
|
|
|
}
|
|
|
|
}
|
2013-12-19 17:25:50 +01:00
|
|
|
private:
|
|
|
|
FileLineData m_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
class Config {
|
|
|
|
typedef std::map<std::pair<int,OverrideType>, bool> BoolLineData;
|
|
|
|
typedef std::map<std::string, BoolLineData> FileBoolLineData;
|
|
|
|
typedef std::map<std::pair<int,OverrideType>, int> LineData;
|
|
|
|
typedef std::map<std::string, LineData> FileLineData;
|
|
|
|
typedef std::multimap<std::pair<int,OverrideType>, std::string> StringLineData;
|
|
|
|
typedef std::map<std::string, StringLineData> FileStringLineData;
|
|
|
|
public:
|
|
|
|
bool includeSuccessfulResults(const std::string& file, int line) const {
|
|
|
|
return showSuccessfulTestsData.getValueForFileLine(file,line);
|
|
|
|
}
|
|
|
|
void insertSuccessfulResults(const std::string& file, OverrideType overRide, int line, bool v) {
|
|
|
|
showSuccessfulTestsData.recordValueForFileLine(file, overRide, line, v);
|
|
|
|
}
|
|
|
|
bool warnAboutMissingAssertions(const std::string& file, int line) const {
|
|
|
|
return missingAssertionData.getValueForFileLine(file,line);
|
|
|
|
}
|
|
|
|
void insertMissingAssertions(const std::string& file, OverrideType overRide, int line, bool v) {
|
|
|
|
missingAssertionData.recordValueForFileLine(file, overRide, line, v);
|
|
|
|
}
|
|
|
|
int abortAfter(const std::string& file, int line) const {
|
|
|
|
return abortAfterData.getValueForFileLine(file,line);
|
|
|
|
}
|
|
|
|
void insertAbortAfter(const std::string& file, OverrideType overRide, int line, int v) {
|
|
|
|
abortAfterData.recordValueForFileLine(file, overRide, line, v);
|
|
|
|
}
|
2013-12-16 23:17:34 +01:00
|
|
|
std::vector<std::string> listOfTests(const std::string& file, int c) const {
|
2013-12-10 00:12:05 +01:00
|
|
|
std::vector<std::string> result;
|
|
|
|
FileStringLineData::const_iterator it = testData.find(file);
|
2013-12-16 23:17:34 +01:00
|
|
|
if( it != testData.end() ) {
|
|
|
|
StringLineData::const_iterator start = it->second.begin();
|
|
|
|
StringLineData::const_iterator end = it->second.end();
|
|
|
|
for( StringLineData::const_iterator lineIt = it->second.begin(); lineIt != it->second.end(); ++lineIt ) {
|
|
|
|
const std::pair<int,OverrideType>& current = lineIt->first;
|
|
|
|
if( current.second == OverrideReset ) {
|
|
|
|
if( c == current.first ) {
|
|
|
|
end = lineIt;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
start = lineIt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for( StringLineData::const_iterator lineIt = start; lineIt != end; ++lineIt ) {
|
|
|
|
const std::pair<int,OverrideType>& current = lineIt->first;
|
|
|
|
if( current.second == OverrideUpdate ) {
|
|
|
|
if( c < current.first )
|
2013-12-10 00:12:05 +01:00
|
|
|
break;
|
|
|
|
result.push_back(lineIt->second);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
2013-12-16 23:17:34 +01:00
|
|
|
void insertTest(const std::string& file, OverrideType overRide, int c, const std::string& v) {
|
2013-12-10 00:12:05 +01:00
|
|
|
FileStringLineData::iterator it = testData.find(file);
|
2013-12-16 23:17:34 +01:00
|
|
|
if( it == testData.end() ) {
|
2013-12-10 00:12:05 +01:00
|
|
|
StringLineData tmp;
|
2013-12-16 23:17:34 +01:00
|
|
|
std::pair<int,OverrideType> current = std::make_pair(c, overRide);
|
|
|
|
tmp.insert(std::make_pair(current,v));
|
2013-12-10 00:12:05 +01:00
|
|
|
testData.insert(std::make_pair(file, tmp));
|
|
|
|
}
|
2013-12-16 23:17:34 +01:00
|
|
|
else {
|
|
|
|
std::pair<int,OverrideType> current = std::make_pair(c, overRide);
|
|
|
|
it->second.insert(std::make_pair(current,v));
|
2013-12-09 15:18:35 +01:00
|
|
|
}
|
|
|
|
}
|
2013-12-16 23:17:34 +01:00
|
|
|
static Config<T>& instance() {
|
|
|
|
if( !s_instance ) {
|
2013-12-09 15:18:35 +01:00
|
|
|
s_instance = new Config<T>();
|
|
|
|
}
|
|
|
|
return *s_instance;
|
|
|
|
}
|
|
|
|
private:
|
2013-12-19 17:25:50 +01:00
|
|
|
ConfigLineData<bool> showSuccessfulTestsData;
|
|
|
|
ConfigLineData<bool> missingAssertionData;
|
|
|
|
ConfigLineData<int> abortAfterData;
|
2013-12-10 00:12:05 +01:00
|
|
|
FileStringLineData testData;
|
2013-12-09 15:18:35 +01:00
|
|
|
|
|
|
|
static Config<T>* s_instance;
|
|
|
|
};
|
|
|
|
template <typename T>
|
|
|
|
Config<T>* Config<T>::s_instance = NULL;
|
|
|
|
|
|
|
|
template <typename T>
|
2013-12-16 23:17:34 +01:00
|
|
|
struct ConfigReset {
|
|
|
|
ConfigReset( const std::string& file, int c, int defaultAbortAfter ) {
|
|
|
|
Config<T>::instance().insertSuccessfulResults(file, OverrideReset, c, false);
|
|
|
|
Config<T>::instance().insertMissingAssertions(file, OverrideReset, c, false);
|
|
|
|
Config<T>::instance().insertAbortAfter(file, OverrideReset, c, defaultAbortAfter);
|
|
|
|
Config<T>::instance().insertTest(file, OverrideReset, c, "");
|
2013-12-09 15:18:35 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
2013-12-16 23:17:34 +01:00
|
|
|
struct ConfigShowSuccessfulTests {
|
2013-12-09 15:18:35 +01:00
|
|
|
template <typename U>
|
2013-12-16 23:17:34 +01:00
|
|
|
ConfigShowSuccessfulTests( const std::string& file, int c, U v ) {
|
|
|
|
Config<T>::instance().insertSuccessfulResults(file, OverrideUpdate, c, v ? true : false);
|
2013-12-09 15:18:35 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
2013-12-16 23:17:34 +01:00
|
|
|
struct ConfigWarnMissingAssertions {
|
2013-12-09 15:18:35 +01:00
|
|
|
template <typename U>
|
2013-12-16 23:17:34 +01:00
|
|
|
ConfigWarnMissingAssertions( const std::string& file, int c, U v ) {
|
|
|
|
Config<T>::instance().insertMissingAssertions(file, OverrideUpdate, c, v ? true : false);
|
2013-12-09 15:18:35 +01:00
|
|
|
}
|
|
|
|
};
|
2013-12-10 00:12:05 +01:00
|
|
|
|
|
|
|
template <typename T>
|
2013-12-16 23:17:34 +01:00
|
|
|
struct ConfigAbortAfter {
|
2013-12-10 00:12:05 +01:00
|
|
|
template <typename U>
|
2013-12-16 23:17:34 +01:00
|
|
|
ConfigAbortAfter( const std::string& file, int c, U v ) {
|
|
|
|
Config<T>::instance().insertAbortAfter(file, OverrideUpdate, c, v);
|
2013-12-10 00:12:05 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
2013-12-16 23:17:34 +01:00
|
|
|
struct ConfigAddTest {
|
2013-12-10 00:12:05 +01:00
|
|
|
template <typename U>
|
2013-12-16 23:17:34 +01:00
|
|
|
ConfigAddTest( const std::string& file, int c, U v ) {
|
|
|
|
Config<T>::instance().insertTest(file, OverrideUpdate, c, v);
|
2013-12-10 00:12:05 +01:00
|
|
|
}
|
|
|
|
};
|
2013-12-09 15:18:35 +01:00
|
|
|
}
|
|
|
|
|
2012-05-16 00:58:23 +02:00
|
|
|
namespace Catch {
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2012-06-08 09:22:56 +02:00
|
|
|
struct ConfigData {
|
2012-08-28 09:20:18 +02:00
|
|
|
|
2012-06-08 09:22:56 +02:00
|
|
|
ConfigData()
|
2013-05-29 19:42:46 +02:00
|
|
|
: listTests( false ),
|
|
|
|
listTags( false ),
|
|
|
|
listReporters( false ),
|
2013-11-26 21:57:34 +01:00
|
|
|
listTestNamesOnly( false ),
|
2013-05-29 19:34:11 +02:00
|
|
|
showSuccessfulTests( false ),
|
2013-05-29 09:12:57 +02:00
|
|
|
shouldDebugBreak( false ),
|
2013-05-29 19:34:11 +02:00
|
|
|
noThrow( false ),
|
2013-05-29 20:01:06 +02:00
|
|
|
showHelp( false ),
|
2013-05-31 09:01:56 +02:00
|
|
|
abortAfter( -1 ),
|
2013-05-29 20:01:06 +02:00
|
|
|
verbosity( Verbosity::Normal ),
|
2013-08-07 19:56:35 +02:00
|
|
|
warnings( WarnAbout::Nothing ),
|
|
|
|
showDurations( ShowDurations::DefaultForReporter )
|
2012-06-08 09:22:56 +02:00
|
|
|
{}
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2013-12-09 15:18:35 +01:00
|
|
|
explicit ConfigData(const IConfig* other)
|
|
|
|
: listTests( false ),
|
|
|
|
listTags( false ),
|
|
|
|
listReporters( false ),
|
|
|
|
showSuccessfulTests( other ? other->includeSuccessfulResults() : false ),
|
|
|
|
shouldDebugBreak( false ),
|
|
|
|
noThrow( other ? !other->allowThrows() : false ),
|
|
|
|
showHelp( false ),
|
|
|
|
abortAfter( -1 ),
|
|
|
|
verbosity( Verbosity::Normal ),
|
|
|
|
warnings( other ? (other->warnAboutMissingAssertions() ? WarnAbout::NoAssertions : WarnAbout::Nothing) : WarnAbout::Nothing ),
|
|
|
|
showDurations( other ? other->showDurations() : ShowDurations::DefaultForReporter ),
|
|
|
|
name( other ? other->name() : std::string() )
|
|
|
|
{}
|
|
|
|
|
2013-05-29 19:42:46 +02:00
|
|
|
bool listTests;
|
|
|
|
bool listTags;
|
|
|
|
bool listReporters;
|
2013-11-26 21:57:34 +01:00
|
|
|
bool listTestNamesOnly;
|
2013-05-29 20:01:06 +02:00
|
|
|
|
2013-05-29 19:34:11 +02:00
|
|
|
bool showSuccessfulTests;
|
2012-06-08 09:22:56 +02:00
|
|
|
bool shouldDebugBreak;
|
2013-05-29 19:34:11 +02:00
|
|
|
bool noThrow;
|
2013-05-29 20:01:06 +02:00
|
|
|
bool showHelp;
|
2013-05-29 09:12:57 +02:00
|
|
|
|
2013-05-31 09:01:56 +02:00
|
|
|
int abortAfter;
|
2013-05-29 09:12:57 +02:00
|
|
|
|
2013-05-29 20:01:06 +02:00
|
|
|
Verbosity::Level verbosity;
|
2012-08-28 09:20:18 +02:00
|
|
|
WarnAbout::What warnings;
|
2013-08-07 19:56:35 +02:00
|
|
|
ShowDurations::OrNot showDurations;
|
2013-05-29 09:12:57 +02:00
|
|
|
|
2013-05-31 09:01:56 +02:00
|
|
|
std::string reporterName;
|
2013-05-29 09:12:57 +02:00
|
|
|
std::string outputFilename;
|
|
|
|
std::string name;
|
2013-06-04 09:37:28 +02:00
|
|
|
std::string processName;
|
2013-05-29 09:12:57 +02:00
|
|
|
|
2013-05-29 19:56:29 +02:00
|
|
|
std::vector<std::string> testsOrTags;
|
2012-06-08 09:22:56 +02:00
|
|
|
};
|
2013-07-03 20:14:59 +02:00
|
|
|
|
|
|
|
|
2013-05-28 19:39:32 +02:00
|
|
|
class Config : public SharedImpl<IConfig> {
|
2010-12-31 23:07:47 +01:00
|
|
|
private:
|
2013-04-23 19:58:56 +02:00
|
|
|
Config( Config const& other );
|
|
|
|
Config& operator = ( Config const& other );
|
2012-08-13 08:46:10 +02:00
|
|
|
virtual void dummy();
|
2010-12-31 23:07:47 +01:00
|
|
|
public:
|
2012-08-13 08:46:10 +02:00
|
|
|
|
2011-01-01 01:20:14 +01:00
|
|
|
Config()
|
2012-09-26 19:36:58 +02:00
|
|
|
: m_os( std::cout.rdbuf() )
|
2012-06-08 09:22:56 +02:00
|
|
|
{}
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2013-04-23 19:58:56 +02:00
|
|
|
Config( ConfigData const& data )
|
2012-06-08 09:22:56 +02:00
|
|
|
: m_data( data ),
|
2013-05-29 19:56:29 +02:00
|
|
|
m_os( std::cout.rdbuf() )
|
|
|
|
{
|
2013-06-07 20:06:30 +02:00
|
|
|
if( !data.testsOrTags.empty() ) {
|
|
|
|
std::string groupName;
|
|
|
|
for( std::size_t i = 0; i < data.testsOrTags.size(); ++i ) {
|
|
|
|
if( i != 0 )
|
|
|
|
groupName += " ";
|
|
|
|
groupName += data.testsOrTags[i];
|
|
|
|
}
|
|
|
|
TestCaseFilters filters( groupName );
|
|
|
|
for( std::size_t i = 0; i < data.testsOrTags.size(); ++i ) {
|
|
|
|
std::string filter = data.testsOrTags[i];
|
|
|
|
if( startsWith( filter, "[" ) || startsWith( filter, "~[" ) )
|
|
|
|
filters.addTags( filter );
|
|
|
|
else
|
|
|
|
filters.addFilter( TestCaseFilter( filter ) );
|
|
|
|
}
|
|
|
|
m_filterSets.push_back( filters );
|
2013-05-29 19:56:29 +02:00
|
|
|
}
|
|
|
|
}
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2012-08-13 08:46:10 +02:00
|
|
|
virtual ~Config() {
|
2011-05-31 19:47:30 +02:00
|
|
|
m_os.rdbuf( std::cout.rdbuf() );
|
2012-09-26 19:36:58 +02:00
|
|
|
m_stream.release();
|
2011-01-18 10:20:06 +01:00
|
|
|
}
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2013-04-23 19:58:56 +02:00
|
|
|
void setFilename( std::string const& filename ) {
|
2012-06-08 09:22:56 +02:00
|
|
|
m_data.outputFilename = filename;
|
2010-11-12 20:55:53 +01:00
|
|
|
}
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2013-04-23 19:58:56 +02:00
|
|
|
std::string const& getFilename() const {
|
2012-06-08 09:22:56 +02:00
|
|
|
return m_data.outputFilename ;
|
2010-11-12 20:55:53 +01:00
|
|
|
}
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2013-05-29 19:42:46 +02:00
|
|
|
bool listTests() const { return m_data.listTests; }
|
2013-11-26 21:57:34 +01:00
|
|
|
bool listTestNamesOnly() const { return m_data.listTestNamesOnly; }
|
2013-05-29 19:42:46 +02:00
|
|
|
bool listTags() const { return m_data.listTags; }
|
|
|
|
bool listReporters() const { return m_data.listReporters; }
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2013-06-05 09:18:52 +02:00
|
|
|
std::string getProcessName() const {
|
|
|
|
return m_data.processName;
|
2011-04-12 09:07:39 +02:00
|
|
|
}
|
2013-06-05 09:18:52 +02:00
|
|
|
|
2012-05-16 00:58:23 +02:00
|
|
|
bool shouldDebugBreak() const {
|
2012-06-08 09:22:56 +02:00
|
|
|
return m_data.shouldDebugBreak;
|
2010-12-30 19:51:02 +01:00
|
|
|
}
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2012-05-16 00:58:23 +02:00
|
|
|
void setStreamBuf( std::streambuf* buf ) {
|
2011-01-18 10:20:06 +01:00
|
|
|
m_os.rdbuf( buf ? buf : std::cout.rdbuf() );
|
2013-07-03 20:14:59 +02:00
|
|
|
}
|
2011-01-01 01:18:35 +01:00
|
|
|
|
2013-04-23 19:58:56 +02:00
|
|
|
void useStream( std::string const& streamName ) {
|
2012-09-26 19:36:58 +02:00
|
|
|
Stream stream = createStream( streamName );
|
|
|
|
setStreamBuf( stream.streamBuf );
|
|
|
|
m_stream.release();
|
|
|
|
m_stream = stream;
|
2012-05-04 08:55:11 +02:00
|
|
|
}
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2013-05-31 09:01:56 +02:00
|
|
|
std::string getReporterName() const { return m_data.reporterName; }
|
2012-09-07 18:52:15 +02:00
|
|
|
|
2013-04-23 19:58:56 +02:00
|
|
|
void addTestSpec( std::string const& testSpec ) {
|
2012-09-07 18:52:15 +02:00
|
|
|
TestCaseFilters filters( testSpec );
|
|
|
|
filters.addFilter( TestCaseFilter( testSpec ) );
|
2013-05-29 19:56:29 +02:00
|
|
|
m_filterSets.push_back( filters );
|
2012-09-07 18:52:15 +02:00
|
|
|
}
|
2013-05-31 09:01:56 +02:00
|
|
|
|
2013-05-28 19:51:53 +02:00
|
|
|
int abortAfter() const {
|
2013-05-31 09:01:56 +02:00
|
|
|
return m_data.abortAfter;
|
2012-06-01 20:40:27 +02:00
|
|
|
}
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2013-05-28 20:07:29 +02:00
|
|
|
std::vector<TestCaseFilters> const& filters() const {
|
2013-05-29 19:56:29 +02:00
|
|
|
return m_filterSets;
|
2012-06-05 21:50:47 +02:00
|
|
|
}
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2013-06-04 23:49:14 +02:00
|
|
|
bool showHelp() const { return m_data.showHelp; }
|
2012-08-31 09:10:36 +02:00
|
|
|
|
2013-05-28 19:39:32 +02:00
|
|
|
// IConfig interface
|
2013-05-29 19:34:11 +02:00
|
|
|
virtual bool allowThrows() const { return !m_data.noThrow; }
|
2013-05-28 19:39:32 +02:00
|
|
|
virtual std::ostream& stream() const { return m_os; }
|
2013-06-05 09:18:52 +02:00
|
|
|
virtual std::string name() const { return m_data.name.empty() ? m_data.processName : m_data.name; }
|
2013-05-29 19:34:11 +02:00
|
|
|
virtual bool includeSuccessfulResults() const { return m_data.showSuccessfulTests; }
|
2013-08-07 19:56:35 +02:00
|
|
|
virtual bool warnAboutMissingAssertions() const { return m_data.warnings & WarnAbout::NoAssertions; }
|
|
|
|
virtual ShowDurations::OrNot showDurations() const { return m_data.showDurations; }
|
|
|
|
|
2013-05-28 19:39:32 +02:00
|
|
|
|
2011-01-18 20:49:00 +01:00
|
|
|
private:
|
2012-06-08 09:22:56 +02:00
|
|
|
ConfigData m_data;
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2012-09-26 19:36:58 +02:00
|
|
|
Stream m_stream;
|
2011-01-01 01:18:35 +01:00
|
|
|
mutable std::ostream m_os;
|
2013-05-29 19:56:29 +02:00
|
|
|
std::vector<TestCaseFilters> m_filterSets;
|
2012-05-31 20:40:26 +02:00
|
|
|
};
|
2013-07-03 20:14:59 +02:00
|
|
|
|
|
|
|
|
2010-11-12 20:55:53 +01:00
|
|
|
} // end namespace Catch
|
|
|
|
|
2012-09-17 07:42:29 +02:00
|
|
|
#endif // TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
|