mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-17 03:02:24 +01:00
Fix order of config override when no override of first test
This commit is contained in:
parent
b019773537
commit
132f23cfff
@ -42,70 +42,122 @@ namespace CatchOverrides {
|
||||
const Catch::Ptr<Catch::IConfig const> origConfig;
|
||||
};
|
||||
|
||||
enum OverrideType { OverrideUpdate, OverrideReset}; // Note: ordered; update must be before reset
|
||||
|
||||
template <typename T>
|
||||
class Config
|
||||
{
|
||||
typedef std::map<int, int> LineData;
|
||||
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::map<int, std::string> StringLineData;
|
||||
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 c) const
|
||||
{
|
||||
bool result(false);
|
||||
FileLineData::const_iterator it = showSuccessfulTestsData.find(file);
|
||||
FileBoolLineData::const_iterator it = showSuccessfulTestsData.find(file);
|
||||
if( it != showSuccessfulTestsData.end() )
|
||||
{
|
||||
for( LineData::const_iterator lineIt = it->second.begin(); lineIt != it->second.end(); ++lineIt )
|
||||
{
|
||||
if( c <= lineIt->first )
|
||||
break;
|
||||
result = lineIt->second ? true : false;
|
||||
BoolLineData::const_iterator start = it->second.begin();
|
||||
BoolLineData::const_iterator end = it->second.end();
|
||||
for( BoolLineData::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 ) {
|
||||
result = lineIt->second;
|
||||
end = lineIt;
|
||||
break;
|
||||
}
|
||||
else
|
||||
start = lineIt;
|
||||
}
|
||||
}
|
||||
for( BoolLineData::const_iterator lineIt = start; lineIt != end; ++lineIt ) {
|
||||
const std::pair<int,OverrideType>& current = lineIt->first;
|
||||
if( current.second == OverrideUpdate ) {
|
||||
if( c < current.first )
|
||||
break;
|
||||
result = lineIt->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
void insertSuccessfulResults(const std::string& file, int c, bool v)
|
||||
void insertSuccessfulResults(const std::string& file, OverrideType overRide, int c, bool v)
|
||||
{
|
||||
FileLineData::iterator it = showSuccessfulTestsData.find(file);
|
||||
FileBoolLineData::iterator it = showSuccessfulTestsData.find(file);
|
||||
if( it == showSuccessfulTestsData.end() )
|
||||
{
|
||||
LineData tmp;
|
||||
tmp.insert(std::make_pair(c,(v ? 1 : 0)));
|
||||
BoolLineData tmp;
|
||||
std::pair<int,OverrideType> current = std::make_pair(c, overRide);
|
||||
tmp.insert(std::make_pair(current,v));
|
||||
showSuccessfulTestsData.insert(std::make_pair(file, tmp));
|
||||
}
|
||||
else
|
||||
{
|
||||
it->second.insert(std::make_pair(c,(v ? 1 : 0)));
|
||||
std::pair<int,OverrideType> current = std::make_pair(c, overRide);
|
||||
BoolLineData::iterator lineIt = it->second.find(current);
|
||||
if( lineIt == it->second.end() ) {
|
||||
it->second.insert(std::make_pair(current,v));
|
||||
}
|
||||
else {
|
||||
lineIt->second = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool warnAboutMissingAssertions(const std::string& file, int c) const
|
||||
{
|
||||
bool result(false);
|
||||
FileLineData::const_iterator it = missingAssertionData.find(file);
|
||||
FileBoolLineData::const_iterator it = missingAssertionData.find(file);
|
||||
if( it != missingAssertionData.end() )
|
||||
{
|
||||
for( LineData::const_iterator lineIt = it->second.begin(); lineIt != it->second.end(); ++lineIt )
|
||||
{
|
||||
if( c <= lineIt->first )
|
||||
break;
|
||||
result = lineIt->second ? true : false;
|
||||
BoolLineData::const_iterator start = it->second.begin();
|
||||
BoolLineData::const_iterator end = it->second.end();
|
||||
for( BoolLineData::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 ) {
|
||||
result = lineIt->second;
|
||||
end = lineIt;
|
||||
break;
|
||||
}
|
||||
else
|
||||
start = lineIt;
|
||||
}
|
||||
}
|
||||
for( BoolLineData::const_iterator lineIt = start; lineIt != end; ++lineIt ) {
|
||||
const std::pair<int,OverrideType>& current = lineIt->first;
|
||||
if( current.second == OverrideUpdate ) {
|
||||
if( c < current.first )
|
||||
break;
|
||||
result = lineIt->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
void insertMissingAssertions(const std::string& file, int c, bool v)
|
||||
void insertMissingAssertions(const std::string& file, OverrideType overRide, int c, bool v)
|
||||
{
|
||||
FileLineData::iterator it = missingAssertionData.find(file);
|
||||
FileBoolLineData::iterator it = missingAssertionData.find(file);
|
||||
if( it == missingAssertionData.end() )
|
||||
{
|
||||
LineData tmp;
|
||||
tmp.insert(std::make_pair(c,(v ? 1 : 0)));
|
||||
BoolLineData tmp;
|
||||
std::pair<int,OverrideType> current = std::make_pair(c, overRide);
|
||||
tmp.insert(std::make_pair(current,v));
|
||||
missingAssertionData.insert(std::make_pair(file, tmp));
|
||||
}
|
||||
else
|
||||
{
|
||||
it->second.insert(std::make_pair(c,(v ? 1 : 0)));
|
||||
std::pair<int,OverrideType> current = std::make_pair(c, overRide);
|
||||
BoolLineData::iterator lineIt = it->second.find(current);
|
||||
if( lineIt == it->second.end() ) {
|
||||
it->second.insert(std::make_pair(current,v));
|
||||
}
|
||||
else {
|
||||
lineIt->second = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
int abortAfter(const std::string& file, int c) const
|
||||
@ -114,41 +166,71 @@ namespace CatchOverrides {
|
||||
FileLineData::const_iterator it = abortAfterData.find(file);
|
||||
if( it != abortAfterData.end() )
|
||||
{
|
||||
for( LineData::const_iterator lineIt = it->second.begin(); lineIt != it->second.end(); ++lineIt )
|
||||
{
|
||||
if( c <= lineIt->first )
|
||||
break;
|
||||
result = lineIt->second;
|
||||
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 ) {
|
||||
if( c == current.first ) {
|
||||
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 ) {
|
||||
if( c < current.first )
|
||||
break;
|
||||
result = lineIt->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
void insertAbortAfter(const std::string& file, int c, int v)
|
||||
{
|
||||
void insertAbortAfter(const std::string& file, OverrideType overRide, int c, int v) {
|
||||
FileLineData::iterator it = abortAfterData.find(file);
|
||||
if( it == abortAfterData.end() )
|
||||
{
|
||||
if( it == abortAfterData.end() ) {
|
||||
LineData tmp;
|
||||
tmp.insert(std::make_pair(c,v));
|
||||
std::pair<int,OverrideType> current = std::make_pair(c, overRide);
|
||||
tmp.insert(std::make_pair(current,v));
|
||||
abortAfterData.insert(std::make_pair(file, tmp));
|
||||
}
|
||||
else
|
||||
{
|
||||
it->second.insert(std::make_pair(c,v));
|
||||
else {
|
||||
std::pair<int,OverrideType> current = std::make_pair(c, overRide);
|
||||
LineData::iterator lineIt = it->second.find(current);
|
||||
if( lineIt == it->second.end() ) {
|
||||
it->second.insert(std::make_pair(current,v));
|
||||
}
|
||||
else {
|
||||
lineIt->second = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::vector<std::string> listOfTests(const std::string& file, int c) const
|
||||
{
|
||||
std::vector<std::string> listOfTests(const std::string& file, int c) const {
|
||||
std::vector<std::string> result;
|
||||
FileStringLineData::const_iterator it = testData.find(file);
|
||||
if( it != testData.end() )
|
||||
{
|
||||
for( StringLineData::const_iterator lineIt = it->second.begin(); lineIt != it->second.end(); ++lineIt )
|
||||
{
|
||||
if( lineIt->second.empty() && c > lineIt->first)
|
||||
result.clear();
|
||||
else {
|
||||
if( c <= lineIt->first )
|
||||
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 )
|
||||
break;
|
||||
result.push_back(lineIt->second);
|
||||
}
|
||||
@ -156,31 +238,28 @@ namespace CatchOverrides {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
void insertTest(const std::string& file, int c, const std::string& v)
|
||||
{
|
||||
void insertTest(const std::string& file, OverrideType overRide, int c, const std::string& v) {
|
||||
FileStringLineData::iterator it = testData.find(file);
|
||||
if( it == testData.end() )
|
||||
{
|
||||
if( it == testData.end() ) {
|
||||
StringLineData tmp;
|
||||
tmp.insert(std::make_pair(c,v));
|
||||
std::pair<int,OverrideType> current = std::make_pair(c, overRide);
|
||||
tmp.insert(std::make_pair(current,v));
|
||||
testData.insert(std::make_pair(file, tmp));
|
||||
}
|
||||
else
|
||||
{
|
||||
it->second.insert(std::make_pair(c,v));
|
||||
else {
|
||||
std::pair<int,OverrideType> current = std::make_pair(c, overRide);
|
||||
it->second.insert(std::make_pair(current,v));
|
||||
}
|
||||
}
|
||||
static Config<T>& instance()
|
||||
{
|
||||
if( !s_instance )
|
||||
{
|
||||
static Config<T>& instance() {
|
||||
if( !s_instance ) {
|
||||
s_instance = new Config<T>();
|
||||
}
|
||||
return *s_instance;
|
||||
}
|
||||
private:
|
||||
FileLineData showSuccessfulTestsData;
|
||||
FileLineData missingAssertionData;
|
||||
FileBoolLineData showSuccessfulTestsData;
|
||||
FileBoolLineData missingAssertionData;
|
||||
FileLineData abortAfterData;
|
||||
FileStringLineData testData;
|
||||
|
||||
@ -190,54 +269,44 @@ namespace CatchOverrides {
|
||||
Config<T>* Config<T>::s_instance = NULL;
|
||||
|
||||
template <typename T>
|
||||
struct ConfigReset
|
||||
{
|
||||
ConfigReset( const std::string& file, int c, int defaultAbortAfter )
|
||||
{
|
||||
Config<T>::instance().insertSuccessfulResults(file, c, false);
|
||||
Config<T>::instance().insertMissingAssertions(file, c, false);
|
||||
Config<T>::instance().insertAbortAfter(file, c, defaultAbortAfter);
|
||||
Config<T>::instance().insertTest(file, c, "");
|
||||
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, "");
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ConfigShowSuccessfulTests
|
||||
{
|
||||
struct ConfigShowSuccessfulTests {
|
||||
template <typename U>
|
||||
ConfigShowSuccessfulTests( const std::string& file, int c, U v )
|
||||
{
|
||||
Config<T>::instance().insertSuccessfulResults(file, c, v ? true : false);
|
||||
ConfigShowSuccessfulTests( const std::string& file, int c, U v ) {
|
||||
Config<T>::instance().insertSuccessfulResults(file, OverrideUpdate, c, v ? true : false);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ConfigWarnMissingAssertions
|
||||
{
|
||||
struct ConfigWarnMissingAssertions {
|
||||
template <typename U>
|
||||
ConfigWarnMissingAssertions( const std::string& file, int c, U v )
|
||||
{
|
||||
Config<T>::instance().insertMissingAssertions(file, c, v ? true : false);
|
||||
ConfigWarnMissingAssertions( const std::string& file, int c, U v ) {
|
||||
Config<T>::instance().insertMissingAssertions(file, OverrideUpdate, c, v ? true : false);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ConfigAbortAfter
|
||||
{
|
||||
struct ConfigAbortAfter {
|
||||
template <typename U>
|
||||
ConfigAbortAfter( const std::string& file, int c, U v )
|
||||
{
|
||||
Config<T>::instance().insertAbortAfter(file, c, v);
|
||||
ConfigAbortAfter( const std::string& file, int c, U v ) {
|
||||
Config<T>::instance().insertAbortAfter(file, OverrideUpdate, c, v);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ConfigAddTest
|
||||
{
|
||||
struct ConfigAddTest {
|
||||
template <typename U>
|
||||
ConfigAddTest( const std::string& file, int c, U v )
|
||||
{
|
||||
Config<T>::instance().insertTest(file, c, v);
|
||||
ConfigAddTest( const std::string& file, int c, U v ) {
|
||||
Config<T>::instance().insertTest(file, OverrideUpdate, c, v);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -278,7 +278,6 @@ private:
|
||||
{ CatchOverrides::ConfigGuard cg; \
|
||||
Catch::ConfigData cd(cg.value().get()); \
|
||||
cd.name = name_desc.name; \
|
||||
cd.abortAfter = 1; \
|
||||
cd.showSuccessfulTests = CatchOverrides::Config<Catch::IConfig const*>::instance().includeSuccessfulResults(__FILE__, Count ); \
|
||||
cd.warnings = (CatchOverrides::Config<Catch::IConfig const*>::instance().warnAboutMissingAssertions(__FILE__, Count ) ? Catch::WarnAbout::NoAssertions : Catch::WarnAbout::Nothing); \
|
||||
cd.abortAfter = CatchOverrides::Config<Catch::IConfig const*>::instance().abortAfter(__FILE__, Count ); \
|
||||
|
107
projects/SelfTest/VisualStudioConfigTests.cpp
Normal file
107
projects/SelfTest/VisualStudioConfigTests.cpp
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Created by Phil on 22/10/2010.
|
||||
* Copyright 2010 Two Blue Cubes Ltd
|
||||
*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
#include "catch.hpp"
|
||||
|
||||
#if defined(INTERNAL_CATCH_VS_MANAGED) || defined(INTERNAL_CATCH_VS_NATIVE)
|
||||
|
||||
namespace VisualStudioConfigTests
|
||||
{
|
||||
struct Z1 {};
|
||||
TEST_CASE("VSRequire 1, initial config defaults are set", "[vs]")
|
||||
{
|
||||
CatchOverrides::ConfigReset<Z1> guard("VisualStudioConfigTests.cpp",0, 1);
|
||||
REQUIRE(!CatchOverrides::Config<Z1>::instance().includeSuccessfulResults("VisualStudioConfigTests.cpp",0));
|
||||
REQUIRE(!CatchOverrides::Config<Z1>::instance().warnAboutMissingAssertions("VisualStudioConfigTests.cpp",0));
|
||||
REQUIRE(CatchOverrides::Config<Z1>::instance().abortAfter("VisualStudioConfigTests.cpp",0) == 1);
|
||||
std::vector<std::string> tests = CatchOverrides::Config<Z1>::instance().listOfTests("VisualStudioConfigTests.cpp",0);
|
||||
REQUIRE(tests.empty());
|
||||
}
|
||||
|
||||
struct Z2 {};
|
||||
TEST_CASE("VSRequire 2, initial config defaults are overridden", "[vs]")
|
||||
{
|
||||
CatchOverrides::ConfigShowSuccessfulTests<Z2> isr1("VisualStudioConfigTests.cpp",0, true);
|
||||
CatchOverrides::ConfigWarnMissingAssertions<Z2> wma1("VisualStudioConfigTests.cpp",0, true);
|
||||
CatchOverrides::ConfigAbortAfter<Z2> aa1("VisualStudioConfigTests.cpp",0, 42);
|
||||
CatchOverrides::ConfigAddTest<Z2> at1("VisualStudioConfigTests.cpp",0,"T1");
|
||||
CatchOverrides::ConfigReset<Z2> guard("VisualStudioConfigTests.cpp",0, 1);
|
||||
REQUIRE(CatchOverrides::Config<Z2>::instance().includeSuccessfulResults("VisualStudioConfigTests.cpp",0));
|
||||
REQUIRE(CatchOverrides::Config<Z2>::instance().warnAboutMissingAssertions("VisualStudioConfigTests.cpp",0));
|
||||
REQUIRE(CatchOverrides::Config<Z2>::instance().abortAfter("VisualStudioConfigTests.cpp",0) == 42);
|
||||
std::vector<std::string> tests = CatchOverrides::Config<Z2>::instance().listOfTests("VisualStudioConfigTests.cpp",0);
|
||||
REQUIRE(tests.size() == 1);
|
||||
REQUIRE(tests[0] == "T1");
|
||||
}
|
||||
|
||||
struct Z3 {};
|
||||
TEST_CASE("VSRequire 3, initial config defaults are reset", "[vs]")
|
||||
{
|
||||
CatchOverrides::ConfigShowSuccessfulTests<Z3> isr1("VisualStudioConfigTests.cpp",0, true);
|
||||
CatchOverrides::ConfigWarnMissingAssertions<Z3> wma1("VisualStudioConfigTests.cpp",0, true);
|
||||
CatchOverrides::ConfigAbortAfter<Z3> aa1("VisualStudioConfigTests.cpp",0, 42);
|
||||
CatchOverrides::ConfigAddTest<Z3> at1("VisualStudioConfigTests.cpp",0,"T1");
|
||||
CatchOverrides::ConfigReset<Z3> guard0("VisualStudioConfigTests.cpp",0, 1);
|
||||
CatchOverrides::ConfigReset<Z3> guard1("VisualStudioConfigTests.cpp",1, 1);
|
||||
REQUIRE(CatchOverrides::Config<Z3>::instance().includeSuccessfulResults("VisualStudioConfigTests.cpp",0));
|
||||
REQUIRE(CatchOverrides::Config<Z3>::instance().warnAboutMissingAssertions("VisualStudioConfigTests.cpp",0));
|
||||
REQUIRE(CatchOverrides::Config<Z3>::instance().abortAfter("VisualStudioConfigTests.cpp",0) == 42);
|
||||
std::vector<std::string> tests = CatchOverrides::Config<Z3>::instance().listOfTests("VisualStudioConfigTests.cpp",0);
|
||||
REQUIRE(tests.size() == 1);
|
||||
REQUIRE(tests[0] == "T1");
|
||||
|
||||
REQUIRE(!CatchOverrides::Config<Z3>::instance().includeSuccessfulResults("VisualStudioConfigTests.cpp",1));
|
||||
REQUIRE(!CatchOverrides::Config<Z3>::instance().warnAboutMissingAssertions("VisualStudioConfigTests.cpp",1));
|
||||
REQUIRE(CatchOverrides::Config<Z3>::instance().abortAfter("VisualStudioConfigTests.cpp",1) == 1);
|
||||
tests = CatchOverrides::Config<Z3>::instance().listOfTests("VisualStudioConfigTests.cpp",1);
|
||||
REQUIRE(tests.empty());
|
||||
}
|
||||
|
||||
struct Z7 {};
|
||||
TEST_CASE("VSRequire 7, initial multi-line list config gets all values", "[vs]")
|
||||
{
|
||||
CatchOverrides::ConfigAddTest<Z7> a1("VisualStudioConfigTests.cpp",0,"T1");
|
||||
CatchOverrides::ConfigAddTest<Z7> a2("VisualStudioConfigTests.cpp",0,"T2");
|
||||
CatchOverrides::ConfigAddTest<Z7> a3("VisualStudioConfigTests.cpp",0,"T3");
|
||||
CatchOverrides::ConfigReset<Z7> guard0("VisualStudioConfigTests.cpp",0, 1);
|
||||
CatchOverrides::ConfigReset<Z7> guard1("VisualStudioConfigTests.cpp",1, 1);
|
||||
|
||||
std::vector<std::string> tests = CatchOverrides::Config<Z7>::instance().listOfTests("VisualStudioConfigTests.cpp",0);
|
||||
REQUIRE(tests.size() == 3);
|
||||
REQUIRE(tests[0] == "T1");
|
||||
REQUIRE(tests[1] == "T2");
|
||||
REQUIRE(tests[2] == "T3");
|
||||
tests = CatchOverrides::Config<Z7>::instance().listOfTests("VisualStudioConfigTests.cpp",1);
|
||||
REQUIRE(tests.empty());
|
||||
}
|
||||
|
||||
struct Z8 {};
|
||||
TEST_CASE("VSRequire 8, initial incrementing 'line' sets values", "[vs]")
|
||||
{
|
||||
CatchOverrides::ConfigShowSuccessfulTests<Z8> isr1("VisualStudioConfigTests.cpp",0, true);
|
||||
CatchOverrides::ConfigWarnMissingAssertions<Z8> wma1("VisualStudioConfigTests.cpp",1, true);
|
||||
CatchOverrides::ConfigAbortAfter<Z8> aa1("VisualStudioConfigTests.cpp",2, 42);
|
||||
CatchOverrides::ConfigAddTest<Z8> at1("VisualStudioConfigTests.cpp",3,"T1");
|
||||
CatchOverrides::ConfigReset<Z8> guard0("VisualStudioConfigTests.cpp",4, 1);
|
||||
CatchOverrides::ConfigReset<Z8> guard1("VisualStudioConfigTests.cpp",5, 1);
|
||||
REQUIRE(CatchOverrides::Config<Z8>::instance().includeSuccessfulResults("VisualStudioConfigTests.cpp",4));
|
||||
REQUIRE(CatchOverrides::Config<Z8>::instance().warnAboutMissingAssertions("VisualStudioConfigTests.cpp",4));
|
||||
REQUIRE(CatchOverrides::Config<Z8>::instance().abortAfter("VisualStudioConfigTests.cpp",4) == 42);
|
||||
std::vector<std::string> tests = CatchOverrides::Config<Z8>::instance().listOfTests("VisualStudioConfigTests.cpp",4);
|
||||
REQUIRE(tests.size() == 1);
|
||||
REQUIRE(tests[0] == "T1");
|
||||
|
||||
REQUIRE(!CatchOverrides::Config<Z8>::instance().includeSuccessfulResults("VisualStudioConfigTests.cpp",5));
|
||||
REQUIRE(!CatchOverrides::Config<Z8>::instance().warnAboutMissingAssertions("VisualStudioConfigTests.cpp",5));
|
||||
REQUIRE(CatchOverrides::Config<Z8>::instance().abortAfter("VisualStudioConfigTests.cpp",5) == 1);
|
||||
tests = CatchOverrides::Config<Z8>::instance().listOfTests("VisualStudioConfigTests.cpp",5);
|
||||
REQUIRE(tests.empty());
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
@ -28,6 +28,8 @@ namespace VisualStudioTests
|
||||
{
|
||||
bool show = Catch::getCurrentContext().getConfig()->includeSuccessfulResults();
|
||||
REQUIRE(!show);
|
||||
int abortAfter = Catch::getCurrentContext().getConfig()->abortAfter();
|
||||
REQUIRE(abortAfter == 1);
|
||||
}
|
||||
|
||||
CATCH_CONFIG_SHOW_SUCCESS(true)
|
||||
|
@ -151,6 +151,7 @@
|
||||
<ClCompile Include="..\..\SelfTest\TestMain.cpp" />
|
||||
<ClCompile Include="..\..\SelfTest\TrickyTests.cpp" />
|
||||
<ClCompile Include="..\..\SelfTest\VariadicMacrosTests.cpp" />
|
||||
<ClCompile Include="..\..\SelfTest\VisualStudioConfigTests.cpp" />
|
||||
<ClCompile Include="..\..\SelfTest\VisualStudioTests.cpp" />
|
||||
<ClCompile Include="AssemblyInfo.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
@ -72,6 +72,9 @@
|
||||
<ClCompile Include="..\..\SelfTest\VisualStudioTests.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\SelfTest\VisualStudioConfigTests.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
|
@ -170,6 +170,7 @@
|
||||
<ClCompile Include="..\..\SelfTest\TestMain.cpp" />
|
||||
<ClCompile Include="..\..\SelfTest\TrickyTests.cpp" />
|
||||
<ClCompile Include="..\..\SelfTest\VariadicMacrosTests.cpp" />
|
||||
<ClCompile Include="..\..\SelfTest\VisualStudioConfigTests.cpp" />
|
||||
<ClCompile Include="..\..\SelfTest\VisualStudioTests.cpp" />
|
||||
<ClCompile Include="AssemblyInfo.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
@ -72,6 +72,9 @@
|
||||
<ClCompile Include="..\..\SelfTest\VisualStudioTests.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\SelfTest\VisualStudioConfigTests.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
|
@ -166,6 +166,7 @@
|
||||
<ClCompile Include="..\..\SelfTest\TestMain.cpp" />
|
||||
<ClCompile Include="..\..\SelfTest\TrickyTests.cpp" />
|
||||
<ClCompile Include="..\..\SelfTest\VariadicMacrosTests.cpp" />
|
||||
<ClCompile Include="..\..\SelfTest\VisualStudioConfigTests.cpp" />
|
||||
<ClCompile Include="..\..\SelfTest\VisualStudioTests.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
|
@ -77,5 +77,8 @@
|
||||
<ClCompile Include="..\..\SelfTest\MessageInstantiationTests2.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\SelfTest\VisualStudioConfigTests.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user