mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-24 12:03:29 +01:00
Removed old generators implementation (and tests)
This commit is contained in:
parent
e4fa62a14e
commit
e55273db19
@ -33,7 +33,6 @@
|
|||||||
#include "internal/catch_test_registry.hpp"
|
#include "internal/catch_test_registry.hpp"
|
||||||
#include "internal/catch_capture.hpp"
|
#include "internal/catch_capture.hpp"
|
||||||
#include "internal/catch_section.h"
|
#include "internal/catch_section.h"
|
||||||
#include "internal/catch_generators.hpp"
|
|
||||||
#include "internal/catch_interfaces_exception.h"
|
#include "internal/catch_interfaces_exception.h"
|
||||||
#include "internal/catch_approx.hpp"
|
#include "internal/catch_approx.hpp"
|
||||||
#include "internal/catch_matchers.hpp"
|
#include "internal/catch_matchers.hpp"
|
||||||
@ -115,8 +114,6 @@
|
|||||||
#define CATCH_REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
|
#define CATCH_REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
|
||||||
#define CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType )
|
#define CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType )
|
||||||
|
|
||||||
#define CATCH_GENERATE( expr) INTERNAL_CATCH_GENERATE( expr )
|
|
||||||
|
|
||||||
// "BDD-style" convenience wrappers
|
// "BDD-style" convenience wrappers
|
||||||
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
||||||
#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ )
|
#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ )
|
||||||
@ -182,8 +179,6 @@
|
|||||||
#define REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
|
#define REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
|
||||||
#define REGISTER_LEGACY_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType )
|
#define REGISTER_LEGACY_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType )
|
||||||
|
|
||||||
#define GENERATE( expr) INTERNAL_CATCH_GENERATE( expr )
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )
|
#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#ifndef TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
|
#define TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
|
||||||
|
|
||||||
#include "catch_interfaces_generators.h"
|
|
||||||
#include "catch_ptr.hpp"
|
#include "catch_ptr.hpp"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -21,7 +20,6 @@ namespace Catch {
|
|||||||
class Stream;
|
class Stream;
|
||||||
struct IResultCapture;
|
struct IResultCapture;
|
||||||
struct IRunner;
|
struct IRunner;
|
||||||
struct IGeneratorsForTest;
|
|
||||||
struct IConfig;
|
struct IConfig;
|
||||||
|
|
||||||
struct IContext
|
struct IContext
|
||||||
@ -30,8 +28,6 @@ namespace Catch {
|
|||||||
|
|
||||||
virtual IResultCapture* getResultCapture() = 0;
|
virtual IResultCapture* getResultCapture() = 0;
|
||||||
virtual IRunner* getRunner() = 0;
|
virtual IRunner* getRunner() = 0;
|
||||||
virtual size_t getGeneratorIndex( std::string const& fileInfo, size_t totalSize ) = 0;
|
|
||||||
virtual bool advanceGeneratorsForCurrentTest() = 0;
|
|
||||||
virtual Ptr<IConfig const> getConfig() const = 0;
|
virtual Ptr<IConfig const> getConfig() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,16 +28,6 @@ namespace Catch {
|
|||||||
virtual IRunner* getRunner() {
|
virtual IRunner* getRunner() {
|
||||||
return m_runner;
|
return m_runner;
|
||||||
}
|
}
|
||||||
virtual size_t getGeneratorIndex( std::string const& fileInfo, size_t totalSize ) {
|
|
||||||
return getGeneratorsForCurrentTest()
|
|
||||||
.getGeneratorInfo( fileInfo, totalSize )
|
|
||||||
.getCurrentIndex();
|
|
||||||
}
|
|
||||||
virtual bool advanceGeneratorsForCurrentTest() {
|
|
||||||
IGeneratorsForTest* generators = findGeneratorsForCurrentTest();
|
|
||||||
return generators && generators->moveNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual Ptr<IConfig const> getConfig() const {
|
virtual Ptr<IConfig const> getConfig() const {
|
||||||
return m_config;
|
return m_config;
|
||||||
}
|
}
|
||||||
@ -55,32 +45,10 @@ namespace Catch {
|
|||||||
|
|
||||||
friend IMutableContext& getCurrentMutableContext();
|
friend IMutableContext& getCurrentMutableContext();
|
||||||
|
|
||||||
private:
|
|
||||||
IGeneratorsForTest* findGeneratorsForCurrentTest() {
|
|
||||||
std::string testName = getResultCapture()->getCurrentTestName();
|
|
||||||
|
|
||||||
std::map<std::string, IGeneratorsForTest*>::const_iterator it =
|
|
||||||
m_generatorsByTestName.find( testName );
|
|
||||||
return it != m_generatorsByTestName.end()
|
|
||||||
? it->second
|
|
||||||
: CATCH_NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
IGeneratorsForTest& getGeneratorsForCurrentTest() {
|
|
||||||
IGeneratorsForTest* generators = findGeneratorsForCurrentTest();
|
|
||||||
if( !generators ) {
|
|
||||||
std::string testName = getResultCapture()->getCurrentTestName();
|
|
||||||
generators = createGeneratorsForTest();
|
|
||||||
m_generatorsByTestName.insert( std::make_pair( testName, generators ) );
|
|
||||||
}
|
|
||||||
return *generators;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ptr<IConfig const> m_config;
|
Ptr<IConfig const> m_config;
|
||||||
IRunner* m_runner;
|
IRunner* m_runner;
|
||||||
IResultCapture* m_resultCapture;
|
IResultCapture* m_resultCapture;
|
||||||
std::map<std::string, IGeneratorsForTest*> m_generatorsByTestName;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -1,190 +0,0 @@
|
|||||||
/*
|
|
||||||
* Created by Phil on 27/01/2011.
|
|
||||||
* Copyright 2011 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)
|
|
||||||
*/
|
|
||||||
#ifndef TWOBLUECUBES_CATCH_GENERATORS_HPP_INCLUDED
|
|
||||||
#define TWOBLUECUBES_CATCH_GENERATORS_HPP_INCLUDED
|
|
||||||
|
|
||||||
#include "catch_context.h"
|
|
||||||
|
|
||||||
#include <iterator>
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
namespace Catch {
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct IGenerator {
|
|
||||||
virtual ~IGenerator() {}
|
|
||||||
virtual T getValue( std::size_t index ) const = 0;
|
|
||||||
virtual std::size_t size () const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
class BetweenGenerator : public IGenerator<T> {
|
|
||||||
public:
|
|
||||||
BetweenGenerator( T from, T to ) : m_from( from ), m_to( to ){}
|
|
||||||
|
|
||||||
virtual T getValue( std::size_t index ) const {
|
|
||||||
return m_from+static_cast<int>( index );
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::size_t size() const {
|
|
||||||
return static_cast<std::size_t>( 1+m_to-m_from );
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
T m_from;
|
|
||||||
T m_to;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
class ValuesGenerator : public IGenerator<T> {
|
|
||||||
public:
|
|
||||||
ValuesGenerator(){}
|
|
||||||
|
|
||||||
void add( T value ) {
|
|
||||||
m_values.push_back( value );
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual T getValue( std::size_t index ) const {
|
|
||||||
return m_values[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::size_t size() const {
|
|
||||||
return m_values.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::vector<T> m_values;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
class CompositeGenerator {
|
|
||||||
public:
|
|
||||||
CompositeGenerator() : m_totalSize( 0 ) {}
|
|
||||||
|
|
||||||
// *** Move semantics, similar to auto_ptr ***
|
|
||||||
CompositeGenerator( CompositeGenerator& other )
|
|
||||||
: m_fileInfo( other.m_fileInfo ),
|
|
||||||
m_totalSize( 0 )
|
|
||||||
{
|
|
||||||
move( other );
|
|
||||||
}
|
|
||||||
|
|
||||||
CompositeGenerator& setFileInfo( const char* fileInfo ) {
|
|
||||||
m_fileInfo = fileInfo;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
~CompositeGenerator() {
|
|
||||||
deleteAll( m_composed );
|
|
||||||
}
|
|
||||||
|
|
||||||
operator T () const {
|
|
||||||
size_t overallIndex = getCurrentContext().getGeneratorIndex( m_fileInfo, m_totalSize );
|
|
||||||
|
|
||||||
typename std::vector<const IGenerator<T>*>::const_iterator it = m_composed.begin();
|
|
||||||
typename std::vector<const IGenerator<T>*>::const_iterator itEnd = m_composed.end();
|
|
||||||
for( size_t index = 0; it != itEnd; ++it )
|
|
||||||
{
|
|
||||||
const IGenerator<T>* generator = *it;
|
|
||||||
if( overallIndex >= index && overallIndex < index + generator->size() )
|
|
||||||
{
|
|
||||||
return generator->getValue( overallIndex-index );
|
|
||||||
}
|
|
||||||
index += generator->size();
|
|
||||||
}
|
|
||||||
CATCH_INTERNAL_ERROR( "Indexed past end of generated range" );
|
|
||||||
return T(); // Suppress spurious "not all control paths return a value" warning in Visual Studio - if you know how to fix this please do so
|
|
||||||
}
|
|
||||||
|
|
||||||
void add( const IGenerator<T>* generator ) {
|
|
||||||
m_totalSize += generator->size();
|
|
||||||
m_composed.push_back( generator );
|
|
||||||
}
|
|
||||||
|
|
||||||
CompositeGenerator& then( CompositeGenerator& other ) {
|
|
||||||
move( other );
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
CompositeGenerator& then( T value ) {
|
|
||||||
ValuesGenerator<T>* valuesGen = new ValuesGenerator<T>();
|
|
||||||
valuesGen->add( value );
|
|
||||||
add( valuesGen );
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void move( CompositeGenerator& other ) {
|
|
||||||
std::copy( other.m_composed.begin(), other.m_composed.end(), std::back_inserter( m_composed ) );
|
|
||||||
m_totalSize += other.m_totalSize;
|
|
||||||
other.m_composed.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<const IGenerator<T>*> m_composed;
|
|
||||||
std::string m_fileInfo;
|
|
||||||
size_t m_totalSize;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace Generators
|
|
||||||
{
|
|
||||||
template<typename T>
|
|
||||||
CompositeGenerator<T> between( T from, T to ) {
|
|
||||||
CompositeGenerator<T> generators;
|
|
||||||
generators.add( new BetweenGenerator<T>( from, to ) );
|
|
||||||
return generators;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
CompositeGenerator<T> values( T val1, T val2 ) {
|
|
||||||
CompositeGenerator<T> generators;
|
|
||||||
ValuesGenerator<T>* valuesGen = new ValuesGenerator<T>();
|
|
||||||
valuesGen->add( val1 );
|
|
||||||
valuesGen->add( val2 );
|
|
||||||
generators.add( valuesGen );
|
|
||||||
return generators;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
CompositeGenerator<T> values( T val1, T val2, T val3 ){
|
|
||||||
CompositeGenerator<T> generators;
|
|
||||||
ValuesGenerator<T>* valuesGen = new ValuesGenerator<T>();
|
|
||||||
valuesGen->add( val1 );
|
|
||||||
valuesGen->add( val2 );
|
|
||||||
valuesGen->add( val3 );
|
|
||||||
generators.add( valuesGen );
|
|
||||||
return generators;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
CompositeGenerator<T> values( T val1, T val2, T val3, T val4 ) {
|
|
||||||
CompositeGenerator<T> generators;
|
|
||||||
ValuesGenerator<T>* valuesGen = new ValuesGenerator<T>();
|
|
||||||
valuesGen->add( val1 );
|
|
||||||
valuesGen->add( val2 );
|
|
||||||
valuesGen->add( val3 );
|
|
||||||
valuesGen->add( val4 );
|
|
||||||
generators.add( valuesGen );
|
|
||||||
return generators;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end namespace Generators
|
|
||||||
|
|
||||||
using namespace Generators;
|
|
||||||
|
|
||||||
} // end namespace Catch
|
|
||||||
|
|
||||||
#define INTERNAL_CATCH_LINESTR2( line ) #line
|
|
||||||
#define INTERNAL_CATCH_LINESTR( line ) INTERNAL_CATCH_LINESTR2( line )
|
|
||||||
|
|
||||||
#define INTERNAL_CATCH_GENERATE( expr ) expr.setFileInfo( __FILE__ "(" INTERNAL_CATCH_LINESTR( __LINE__ ) ")" )
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_GENERATORS_HPP_INCLUDED
|
|
@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* Created by Phil on 28/01/2011.
|
|
||||||
* Copyright 2011 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)
|
|
||||||
*/
|
|
||||||
#ifndef TWOBLUECUBES_CATCH_GENERATORS_IMPL_HPP_INCLUDED
|
|
||||||
#define TWOBLUECUBES_CATCH_GENERATORS_IMPL_HPP_INCLUDED
|
|
||||||
|
|
||||||
#include "catch_interfaces_generators.h"
|
|
||||||
|
|
||||||
#include "catch_common.h"
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
namespace Catch {
|
|
||||||
|
|
||||||
struct GeneratorInfo : IGeneratorInfo {
|
|
||||||
|
|
||||||
GeneratorInfo( std::size_t size )
|
|
||||||
: m_size( size ),
|
|
||||||
m_currentIndex( 0 )
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool moveNext() {
|
|
||||||
if( ++m_currentIndex == m_size ) {
|
|
||||||
m_currentIndex = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t getCurrentIndex() const {
|
|
||||||
return m_currentIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t m_size;
|
|
||||||
std::size_t m_currentIndex;
|
|
||||||
};
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class GeneratorsForTest : public IGeneratorsForTest {
|
|
||||||
|
|
||||||
public:
|
|
||||||
~GeneratorsForTest() {
|
|
||||||
deleteAll( m_generatorsInOrder );
|
|
||||||
}
|
|
||||||
|
|
||||||
IGeneratorInfo& getGeneratorInfo( std::string const& fileInfo, std::size_t size ) {
|
|
||||||
std::map<std::string, IGeneratorInfo*>::const_iterator it = m_generatorsByName.find( fileInfo );
|
|
||||||
if( it == m_generatorsByName.end() ) {
|
|
||||||
IGeneratorInfo* info = new GeneratorInfo( size );
|
|
||||||
m_generatorsByName.insert( std::make_pair( fileInfo, info ) );
|
|
||||||
m_generatorsInOrder.push_back( info );
|
|
||||||
return *info;
|
|
||||||
}
|
|
||||||
return *it->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool moveNext() {
|
|
||||||
std::vector<IGeneratorInfo*>::const_iterator it = m_generatorsInOrder.begin();
|
|
||||||
std::vector<IGeneratorInfo*>::const_iterator itEnd = m_generatorsInOrder.end();
|
|
||||||
for(; it != itEnd; ++it ) {
|
|
||||||
if( (*it)->moveNext() )
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::map<std::string, IGeneratorInfo*> m_generatorsByName;
|
|
||||||
std::vector<IGeneratorInfo*> m_generatorsInOrder;
|
|
||||||
};
|
|
||||||
|
|
||||||
IGeneratorsForTest* createGeneratorsForTest()
|
|
||||||
{
|
|
||||||
return new GeneratorsForTest();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end namespace Catch
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_GENERATORS_IMPL_HPP_INCLUDED
|
|
@ -21,7 +21,6 @@
|
|||||||
#include "catch_notimplemented_exception.hpp"
|
#include "catch_notimplemented_exception.hpp"
|
||||||
#include "catch_context_impl.hpp"
|
#include "catch_context_impl.hpp"
|
||||||
#include "catch_console_colour_impl.hpp"
|
#include "catch_console_colour_impl.hpp"
|
||||||
#include "catch_generators_impl.hpp"
|
|
||||||
#include "catch_assertionresult.hpp"
|
#include "catch_assertionresult.hpp"
|
||||||
#include "catch_test_case_info.hpp"
|
#include "catch_test_case_info.hpp"
|
||||||
#include "catch_test_spec.hpp"
|
#include "catch_test_spec.hpp"
|
||||||
@ -83,8 +82,6 @@ namespace Catch {
|
|||||||
JunitReporter::~JunitReporter() {}
|
JunitReporter::~JunitReporter() {}
|
||||||
TestRegistry::~TestRegistry() {}
|
TestRegistry::~TestRegistry() {}
|
||||||
FreeFunctionTestCase::~FreeFunctionTestCase() {}
|
FreeFunctionTestCase::~FreeFunctionTestCase() {}
|
||||||
IGeneratorInfo::~IGeneratorInfo() {}
|
|
||||||
IGeneratorsForTest::~IGeneratorsForTest() {}
|
|
||||||
WildcardPattern::~WildcardPattern() {}
|
WildcardPattern::~WildcardPattern() {}
|
||||||
TestSpec::Pattern::~Pattern() {}
|
TestSpec::Pattern::~Pattern() {}
|
||||||
TestSpec::NamePattern::~NamePattern() {}
|
TestSpec::NamePattern::~NamePattern() {}
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* Created by Phil on 7/8/2012.
|
|
||||||
* Copyright 2011 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)
|
|
||||||
*/
|
|
||||||
#ifndef TWOBLUECUBES_CATCH_INTERFACES_GENERATORS_H_INCLUDED
|
|
||||||
#define TWOBLUECUBES_CATCH_INTERFACES_GENERATORS_H_INCLUDED
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace Catch {
|
|
||||||
|
|
||||||
struct IGeneratorInfo {
|
|
||||||
virtual ~IGeneratorInfo();
|
|
||||||
virtual bool moveNext() = 0;
|
|
||||||
virtual std::size_t getCurrentIndex() const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct IGeneratorsForTest {
|
|
||||||
virtual ~IGeneratorsForTest();
|
|
||||||
|
|
||||||
virtual IGeneratorInfo& getGeneratorInfo( std::string const& fileInfo, std::size_t size ) = 0;
|
|
||||||
virtual bool moveNext() = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
IGeneratorsForTest* createGeneratorsForTest();
|
|
||||||
|
|
||||||
} // end namespace Catch
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_INTERFACES_GENERATORS_H_INCLUDED
|
|
@ -96,17 +96,13 @@ namespace Catch {
|
|||||||
m_activeTestCase = &testCase;
|
m_activeTestCase = &testCase;
|
||||||
|
|
||||||
|
|
||||||
|
m_trackerContext.startRun();
|
||||||
do {
|
do {
|
||||||
m_trackerContext.startRun();
|
m_trackerContext.startCycle();
|
||||||
do {
|
m_testCaseTracker = &SectionTracker::acquire( m_trackerContext, testInfo.name );
|
||||||
m_trackerContext.startCycle();
|
runCurrentTest( redirectedCout, redirectedCerr );
|
||||||
m_testCaseTracker = &SectionTracker::acquire( m_trackerContext, testInfo.name );
|
|
||||||
runCurrentTest( redirectedCout, redirectedCerr );
|
|
||||||
}
|
|
||||||
while( !m_testCaseTracker->isSuccessfullyCompleted() && !aborting() );
|
|
||||||
}
|
}
|
||||||
// !TBD: deprecated - this will be replaced by indexed trackers
|
while( !m_testCaseTracker->isSuccessfullyCompleted() && !aborting() );
|
||||||
while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() );
|
|
||||||
|
|
||||||
Totals deltaTotals = m_totals.delta( prevTotals );
|
Totals deltaTotals = m_totals.delta( prevTotals );
|
||||||
m_totals.testCases += deltaTotals.testCases;
|
m_totals.testCases += deltaTotals.testCases;
|
||||||
|
@ -1,42 +1,2 @@
|
|||||||
/*
|
// The old generators have been removed
|
||||||
* Created by Phil on 28/01/2011.
|
// A new generator implementation is coming
|
||||||
* Copyright 2011 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)
|
|
||||||
*/
|
|
||||||
|
|
||||||
// This define means we have to prefix all the CATCH macros with CATCH_
|
|
||||||
// We're using it here to test it out
|
|
||||||
#define CATCH_CONFIG_PREFIX_ALL
|
|
||||||
#include "catch.hpp"
|
|
||||||
|
|
||||||
inline int multiply( int a, int b )
|
|
||||||
{
|
|
||||||
return a*b;
|
|
||||||
}
|
|
||||||
|
|
||||||
CATCH_TEST_CASE( "Generators over two ranges", "[generators]" )
|
|
||||||
{
|
|
||||||
using namespace Catch::Generators;
|
|
||||||
|
|
||||||
int i = CATCH_GENERATE( between( 1, 5 ).then( values( 15, 20, 21 ).then( 36 ) ) );
|
|
||||||
int j = CATCH_GENERATE( between( 100, 107 ) );
|
|
||||||
|
|
||||||
CATCH_REQUIRE( multiply( i, 2 ) == i*2 );
|
|
||||||
CATCH_REQUIRE( multiply( j, 2 ) == j*2 );
|
|
||||||
}
|
|
||||||
|
|
||||||
struct IntPair { int first, second; };
|
|
||||||
|
|
||||||
CATCH_TEST_CASE( "Generator over a range of pairs", "[generators]" )
|
|
||||||
{
|
|
||||||
using namespace Catch::Generators;
|
|
||||||
|
|
||||||
IntPair p[] = { { 0, 1 }, { 2, 3 } };
|
|
||||||
|
|
||||||
IntPair* i = CATCH_GENERATE( between( p, &p[1] ) );
|
|
||||||
|
|
||||||
CATCH_REQUIRE( i->first == i->second-1 );
|
|
||||||
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
#include "catch_interfaces_generators.h"
|
|
@ -149,8 +149,6 @@
|
|||||||
4A6D0C4C149B3E3D00DB3EAA /* catch_default_main.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_default_main.hpp; sourceTree = "<group>"; };
|
4A6D0C4C149B3E3D00DB3EAA /* catch_default_main.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_default_main.hpp; sourceTree = "<group>"; };
|
||||||
4A6D0C4D149B3E3D00DB3EAA /* catch_evaluate.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_evaluate.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
4A6D0C4D149B3E3D00DB3EAA /* catch_evaluate.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_evaluate.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
||||||
4A6D0C4E149B3E3D00DB3EAA /* catch_exception_translator_registry.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_exception_translator_registry.hpp; sourceTree = "<group>"; };
|
4A6D0C4E149B3E3D00DB3EAA /* catch_exception_translator_registry.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_exception_translator_registry.hpp; sourceTree = "<group>"; };
|
||||||
4A6D0C4F149B3E3D00DB3EAA /* catch_generators.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_generators.hpp; sourceTree = "<group>"; };
|
|
||||||
4A6D0C50149B3E3D00DB3EAA /* catch_generators_impl.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_generators_impl.hpp; sourceTree = "<group>"; };
|
|
||||||
4A6D0C51149B3E3D00DB3EAA /* catch_context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_context.h; sourceTree = "<group>"; };
|
4A6D0C51149B3E3D00DB3EAA /* catch_context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_context.h; sourceTree = "<group>"; };
|
||||||
4A6D0C52149B3E3D00DB3EAA /* catch_context_impl.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_context_impl.hpp; sourceTree = "<group>"; };
|
4A6D0C52149B3E3D00DB3EAA /* catch_context_impl.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_context_impl.hpp; sourceTree = "<group>"; };
|
||||||
4A6D0C53149B3E3D00DB3EAA /* catch_interfaces_capture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_capture.h; sourceTree = "<group>"; };
|
4A6D0C53149B3E3D00DB3EAA /* catch_interfaces_capture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_capture.h; sourceTree = "<group>"; };
|
||||||
@ -175,7 +173,6 @@
|
|||||||
4A6D0C68149B3E3D00DB3EAA /* catch_reporter_xml.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_reporter_xml.hpp; sourceTree = "<group>"; };
|
4A6D0C68149B3E3D00DB3EAA /* catch_reporter_xml.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_reporter_xml.hpp; sourceTree = "<group>"; };
|
||||||
4A7ADB4314F631E10094FE10 /* catch_totals.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_totals.hpp; sourceTree = "<group>"; };
|
4A7ADB4314F631E10094FE10 /* catch_totals.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_totals.hpp; sourceTree = "<group>"; };
|
||||||
4A7DB2CD1652FE4B00FA6523 /* catch_version.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = catch_version.h; path = ../../../../include/internal/catch_version.h; sourceTree = "<group>"; };
|
4A7DB2CD1652FE4B00FA6523 /* catch_version.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = catch_version.h; path = ../../../../include/internal/catch_version.h; sourceTree = "<group>"; };
|
||||||
4A90B59B15D0F61A00EF71BC /* catch_interfaces_generators.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_generators.h; sourceTree = "<group>"; };
|
|
||||||
4A90B59D15D24FE900EF71BC /* catch_assertionresult.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_assertionresult.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
4A90B59D15D24FE900EF71BC /* catch_assertionresult.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_assertionresult.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
||||||
4AA7B8B4165428BA003155F6 /* catch_version.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = catch_version.hpp; path = ../../../../include/internal/catch_version.hpp; sourceTree = "<group>"; };
|
4AA7B8B4165428BA003155F6 /* catch_version.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = catch_version.hpp; path = ../../../../include/internal/catch_version.hpp; sourceTree = "<group>"; };
|
||||||
4AB1C73514F97BDA00F31DF7 /* catch_console_colour_impl.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_console_colour_impl.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
4AB1C73514F97BDA00F31DF7 /* catch_console_colour_impl.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_console_colour_impl.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
||||||
@ -358,7 +355,6 @@
|
|||||||
263FD06017AF8DF200988A20 /* catch_timer.hpp */,
|
263FD06017AF8DF200988A20 /* catch_timer.hpp */,
|
||||||
4A4B0F9C15CEFA8300AE2392 /* catch_impl.hpp */,
|
4A4B0F9C15CEFA8300AE2392 /* catch_impl.hpp */,
|
||||||
4A4B0F9715CE6CFB00AE2392 /* catch_registry_hub.hpp */,
|
4A4B0F9715CE6CFB00AE2392 /* catch_registry_hub.hpp */,
|
||||||
4A6D0C50149B3E3D00DB3EAA /* catch_generators_impl.hpp */,
|
|
||||||
4A6D0C52149B3E3D00DB3EAA /* catch_context_impl.hpp */,
|
4A6D0C52149B3E3D00DB3EAA /* catch_context_impl.hpp */,
|
||||||
4A6D0C5E149B3E3D00DB3EAA /* catch_run_context.hpp */,
|
4A6D0C5E149B3E3D00DB3EAA /* catch_run_context.hpp */,
|
||||||
4A6D0C62149B3E3D00DB3EAA /* catch_test_case_registry_impl.hpp */,
|
4A6D0C62149B3E3D00DB3EAA /* catch_test_case_registry_impl.hpp */,
|
||||||
@ -379,7 +375,6 @@
|
|||||||
269831E519078C1600BB0CE0 /* catch_tostring.h */,
|
269831E519078C1600BB0CE0 /* catch_tostring.h */,
|
||||||
269831E619078CA200BB0CE0 /* catch_tostring.hpp */,
|
269831E619078CA200BB0CE0 /* catch_tostring.hpp */,
|
||||||
4A6D0C4D149B3E3D00DB3EAA /* catch_evaluate.hpp */,
|
4A6D0C4D149B3E3D00DB3EAA /* catch_evaluate.hpp */,
|
||||||
4A6D0C4F149B3E3D00DB3EAA /* catch_generators.hpp */,
|
|
||||||
4A6D0C5C149B3E3D00DB3EAA /* catch_result_type.h */,
|
4A6D0C5C149B3E3D00DB3EAA /* catch_result_type.h */,
|
||||||
4A6D0C5D149B3E3D00DB3EAA /* catch_assertionresult.h */,
|
4A6D0C5D149B3E3D00DB3EAA /* catch_assertionresult.h */,
|
||||||
261488FE184DC32F0041FBEB /* catch_section.h */,
|
261488FE184DC32F0041FBEB /* catch_section.h */,
|
||||||
@ -443,7 +438,6 @@
|
|||||||
4A6D0C56149B3E3D00DB3EAA /* catch_interfaces_runner.h */,
|
4A6D0C56149B3E3D00DB3EAA /* catch_interfaces_runner.h */,
|
||||||
4A6D0C57149B3E3D00DB3EAA /* catch_interfaces_testcase.h */,
|
4A6D0C57149B3E3D00DB3EAA /* catch_interfaces_testcase.h */,
|
||||||
4AFC661D157E96A7009D58CF /* catch_interfaces_config.h */,
|
4AFC661D157E96A7009D58CF /* catch_interfaces_config.h */,
|
||||||
4A90B59B15D0F61A00EF71BC /* catch_interfaces_generators.h */,
|
|
||||||
26711C90195D46CD0033EDA2 /* catch_interfaces_tag_alias_registry.h */,
|
26711C90195D46CD0033EDA2 /* catch_interfaces_tag_alias_registry.h */,
|
||||||
);
|
);
|
||||||
name = Interfaces;
|
name = Interfaces;
|
||||||
|
Loading…
Reference in New Issue
Block a user