mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-11 07:55:39 +02:00
Compare commits
20 Commits
v1.3.5
...
v2.0.0-dev
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f4ba8aaf19 | ||
![]() |
25899ea20e | ||
![]() |
36cee598cf | ||
![]() |
506b915f7f | ||
![]() |
5cab3cc1b8 | ||
![]() |
d2642325ae | ||
![]() |
8fa41d96c7 | ||
![]() |
693355cc75 | ||
![]() |
5e0db60443 | ||
![]() |
ce547c1799 | ||
![]() |
28aece6a7a | ||
![]() |
bd8688cded | ||
![]() |
c70170e904 | ||
![]() |
6789dfa2ba | ||
![]() |
fdc8a2b2df | ||
![]() |
eea9357284 | ||
![]() |
73968f29a5 | ||
![]() |
b77b45a390 | ||
![]() |
2ebe11660c | ||
![]() |
e55273db19 |
@@ -1,10 +1,12 @@
|
||||

|
||||
|
||||
*v1.3.5*
|
||||
*v2.0.0-develop.2*
|
||||
|
||||
Build status (on Travis CI) [](https://travis-ci.org/philsquared/Catch)
|
||||
|
||||
<a href="https://raw.githubusercontent.com/philsquared/Catch/master/single_include/catch.hpp">The latest, single header, version can be downloaded directly using this link</a>
|
||||
[Please see this page if you are updating from a version before 1.0](docs/whats-changed.md)
|
||||
|
||||
<a href="https://raw.githubusercontent.com/philsquared/Catch/master/single_include/catch.hpp">[The latest, single header, version can be downloaded directly using this link]</a>
|
||||
|
||||
## What's the Catch?
|
||||
|
||||
@@ -17,6 +19,8 @@ This documentation comprises these three parts:
|
||||
* [Tutorial](docs/tutorial.md) - getting started
|
||||
* [Reference section](docs/Readme.md) - all the details
|
||||
|
||||
The documentation will continue until morale improves
|
||||
|
||||
## More
|
||||
* Issues and bugs can be raised on the [Issue tracker on GitHub](https://github.com/philsquared/Catch/issues)
|
||||
* For discussion or questions please use [the dedicated Google Groups forum](https://groups.google.com/forum/?fromgroups#!forum/catch-forum)
|
||||
|
@@ -16,4 +16,5 @@ Before looking at this material be sure to read the [tutorial](tutorial.md)
|
||||
Other
|
||||
|
||||
* [Why Catch?](why-catch.md)
|
||||
* [What's changed](whats-changed.md)
|
||||
* [Contributing](contributing.md)
|
||||
|
24
docs/whats-changed.md
Normal file
24
docs/whats-changed.md
Normal file
@@ -0,0 +1,24 @@
|
||||
## What's new in Catch for 1.0
|
||||
|
||||
After a long "developer preview" state Catch turned 1.0 in mid-2013. Just prior to this a large number of changes, some of them breaking, where merged from the integration branch and now form part of the 1.0 code-base. If this might affect you please read this summary through so you know what to expect.
|
||||
|
||||
* Calling Catch from your own ```main()``` has changed - please review [the updated docs](own-main.md)
|
||||
* The command line has changed. The biggest change is that test case names and tags should now only be supplied as primary arguments - in fact the ```-t``` option has been repurposed to mean "list tags". There are [updated docs for this too](command-line.md)
|
||||
* There is a new reporter interface. If you have written a custom reporter you can use the ```LegacyReporterAdapter``` to minimise any differences. Ideally you should update to the new interface - especially as it has been designed to be more robust in the face of future changes (which should be minimal).
|
||||
* The docs have moved from the wiki to the repository itself. They consist of a set of markdown files in the docs folder and are referenced directly from the README in the root. You can still read them online from GitHub.
|
||||
* Lots of new goodness - more documentation for which is coming. The existing docs have been updated to account for some of the changes already (e.g. variadic macros). A quick rundown:
|
||||
* Variadic macros are used, where possible, so that, e.g. you can write a ```TEST_CASE``` with just a name - or even no name at all (making it an anonymous test case).
|
||||
* The hierarchical naming convention is deprecated in favour of using tags (see next)
|
||||
* ```TEST_CASE```s (but not ```SECTION```s) can now be tagged by placing keywords in square brackets in the second argument - e.g.: ```TEST_CASE( "A nice name", "[tag1][tag2]")```. The old style is still supported but please consider using this new style.
|
||||
* Tests can still be "hidden" using the ```./``` prefix as before, but the preferred way now is to give it the ```[hide]``` tag (hidden tests are skipped if you run the test process without specifying any test specs).
|
||||
* As well as ```TEST_CASE```s and ```SECTION```s you can now also use BDD-style ```SCENARIO``` (in place of ```TEST_CASE```) and ```GIVEN```, ```WHEN``` and ```THEN``` macros (in place of ```SECTION```s).
|
||||
* New command line parser. Under the hood it is a complete rewrite - now powered by a command line library that will soon be spun out as a separate project: Clara. The options themselves are largely the same but there are some notable differences (as already discussed).
|
||||
* Completely overhauled output from the textual reporter (now the Console reporter). This now features a much clearer, cleaner format, including good use of indentation.
|
||||
|
||||
More information can be found in [this blog post](http://www.levelofindirection.com/journal/2013/6/28/catch-10.html).
|
||||
|
||||
If you find any issues please raise issue tickets on the [issue tracker on GitHub](https://github.com/philsquared/Catch/issues) as before. For general questions, comments and suggestions, though, please use the [new forums on Google Groups](https://groups.google.com/forum/?fromgroups#!forum/catch-forum).
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
@@ -29,11 +29,9 @@
|
||||
#endif
|
||||
|
||||
#include "internal/catch_notimplemented_exception.h"
|
||||
#include "internal/catch_context.h"
|
||||
#include "internal/catch_test_registry.hpp"
|
||||
#include "internal/catch_capture.hpp"
|
||||
#include "internal/catch_section.h"
|
||||
#include "internal/catch_generators.hpp"
|
||||
#include "internal/catch_interfaces_exception.h"
|
||||
#include "internal/catch_approx.hpp"
|
||||
#include "internal/catch_matchers.hpp"
|
||||
@@ -43,7 +41,6 @@
|
||||
// These files are included here so the single_include script doesn't put them
|
||||
// in the conditionally compiled sections
|
||||
#include "internal/catch_test_case_info.h"
|
||||
#include "internal/catch_interfaces_runner.h"
|
||||
|
||||
#ifdef __OBJC__
|
||||
#include "internal/catch_objc.hpp"
|
||||
@@ -99,7 +96,7 @@
|
||||
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
||||
#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
||||
#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
||||
#define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
|
||||
#define CATCH_REGISTER_TEST_CASE( ... ) INTERNAL_CATCH_REGISTER_TESTCASE( __VA_ARGS__ )
|
||||
#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
||||
#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", __VA_ARGS__ )
|
||||
#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", __VA_ARGS__ )
|
||||
@@ -117,8 +114,6 @@
|
||||
#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_GENERATE( expr) INTERNAL_CATCH_GENERATE( expr )
|
||||
|
||||
// "BDD-style" convenience wrappers
|
||||
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
||||
#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ )
|
||||
@@ -168,7 +163,7 @@
|
||||
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
||||
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
||||
#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
||||
#define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
|
||||
#define REGISTER_TEST_CASE( ... ) INTERNAL_CATCH_REGISTER_TESTCASE( __VA_ARGS__ )
|
||||
#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
||||
#define FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", __VA_ARGS__ )
|
||||
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", __VA_ARGS__ )
|
||||
@@ -186,8 +181,6 @@
|
||||
#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 GENERATE( expr) INTERNAL_CATCH_GENERATE( expr )
|
||||
|
||||
#endif
|
||||
|
||||
#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )
|
||||
|
@@ -74,7 +74,7 @@ namespace Catch {
|
||||
for( std::vector<TestCase>::const_iterator it = allTestCases.begin(), itEnd = allTestCases.end();
|
||||
it != itEnd;
|
||||
++it ) {
|
||||
if( !context.aborting() && matchTest( *it, testSpec, *iconfig ) )
|
||||
if( !context.isAborting() && matchTest( *it, testSpec, *iconfig ) )
|
||||
totals += context.runTest( *it );
|
||||
else
|
||||
reporter->skipTest( *it );
|
||||
@@ -131,7 +131,7 @@ namespace Catch {
|
||||
Catch::cout() << "For more detail usage please see the project docs\n" << std::endl;
|
||||
}
|
||||
|
||||
int applyCommandLine( int argc, char const* argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
|
||||
int applyCommandLine( int argc, char const* const argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
|
||||
try {
|
||||
m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail );
|
||||
m_unusedTokens = m_cli.parseInto( argc, argv, m_configData );
|
||||
@@ -158,16 +158,13 @@ namespace Catch {
|
||||
m_config.reset();
|
||||
}
|
||||
|
||||
int run( int argc, char const* argv[] ) {
|
||||
int run( int argc, char const* const argv[] ) {
|
||||
|
||||
int returnCode = applyCommandLine( argc, argv );
|
||||
if( returnCode == 0 )
|
||||
returnCode = run();
|
||||
return returnCode;
|
||||
}
|
||||
int run( int argc, char* argv[] ) {
|
||||
return run( argc, const_cast<char const**>( argv ) );
|
||||
}
|
||||
|
||||
int run() {
|
||||
if( m_configData.showHelp )
|
||||
|
@@ -8,7 +8,8 @@
|
||||
#ifndef TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED
|
||||
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch_runner.hpp"
|
||||
#include "catch.hpp"
|
||||
#include "internal/catch_default_main.hpp"
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED
|
||||
|
201
include/external/clara.h
vendored
201
include/external/clara.h
vendored
@@ -6,8 +6,6 @@
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
// Version 0.0.1.1
|
||||
|
||||
// Only use header guard if we are not using an outer namespace
|
||||
#if !defined(TWOBLUECUBES_CLARA_H_INCLUDED) || defined(STITCH_CLARA_OPEN_NAMESPACE)
|
||||
|
||||
@@ -40,7 +38,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
// Use optional outer namespace
|
||||
#ifdef STITCH_TBC_TEXT_FORMAT_OUTER_NAMESPACE
|
||||
@@ -175,171 +172,13 @@ namespace Tbc {
|
||||
#endif // TBC_TEXT_FORMAT_H_INCLUDED
|
||||
|
||||
// ----------- end of #include from tbc_text_format.h -----------
|
||||
// ........... back in clara.h
|
||||
// ........... back in /Users/philnash/Dev/OSS/Clara/srcs/clara.h
|
||||
|
||||
#undef STITCH_TBC_TEXT_FORMAT_OPEN_NAMESPACE
|
||||
|
||||
|
||||
// ----------- #included from clara_compilers.h -----------
|
||||
|
||||
/*
|
||||
* Created by Phil on 10/02/2016.
|
||||
* Copyright 2016 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_CLARA_COMPILERS_H_INCLUDED
|
||||
#define TWOBLUECUBES_CLARA_COMPILERS_H_INCLUDED
|
||||
|
||||
// Detect a number of compiler features - mostly C++11/14 conformance - by compiler
|
||||
// The following features are defined:
|
||||
//
|
||||
// CLARA_CONFIG_CPP11_NULLPTR : is nullptr supported?
|
||||
// CLARA_CONFIG_CPP11_NOEXCEPT : is noexcept supported?
|
||||
// CLARA_CONFIG_CPP11_GENERATED_METHODS : The delete and default keywords for compiler generated methods
|
||||
// CLARA_CONFIG_CPP11_OVERRIDE : is override supported?
|
||||
// CLARA_CONFIG_CPP11_UNIQUE_PTR : is unique_ptr supported (otherwise use auto_ptr)
|
||||
|
||||
// CLARA_CONFIG_CPP11_OR_GREATER : Is C++11 supported?
|
||||
|
||||
// CLARA_CONFIG_VARIADIC_MACROS : are variadic macros supported?
|
||||
|
||||
// In general each macro has a _NO_<feature name> form
|
||||
// (e.g. CLARA_CONFIG_CPP11_NO_NULLPTR) which disables the feature.
|
||||
// Many features, at point of detection, define an _INTERNAL_ macro, so they
|
||||
// can be combined, en-mass, with the _NO_ forms later.
|
||||
|
||||
// All the C++11 features can be disabled with CLARA_CONFIG_NO_CPP11
|
||||
|
||||
#ifdef __clang__
|
||||
|
||||
#if __has_feature(cxx_nullptr)
|
||||
#define CLARA_INTERNAL_CONFIG_CPP11_NULLPTR
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_noexcept)
|
||||
#define CLARA_INTERNAL_CONFIG_CPP11_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#endif // __clang__
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// GCC
|
||||
#ifdef __GNUC__
|
||||
|
||||
#if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
#define CLARA_INTERNAL_CONFIG_CPP11_NULLPTR
|
||||
#endif
|
||||
|
||||
// - otherwise more recent versions define __cplusplus >= 201103L
|
||||
// and will get picked up below
|
||||
|
||||
#endif // __GNUC__
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Visual C++
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#if (_MSC_VER >= 1600)
|
||||
#define CLARA_INTERNAL_CONFIG_CPP11_NULLPTR
|
||||
#define CLARA_INTERNAL_CONFIG_CPP11_UNIQUE_PTR
|
||||
#endif
|
||||
|
||||
#if (_MSC_VER >= 1900 ) // (VC++ 13 (VS2015))
|
||||
#define CLARA_INTERNAL_CONFIG_CPP11_NOEXCEPT
|
||||
#define CLARA_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
|
||||
#endif
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// C++ language feature support
|
||||
|
||||
// catch all support for C++11
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||
|
||||
#define CLARA_CPP11_OR_GREATER
|
||||
|
||||
#if !defined(CLARA_INTERNAL_CONFIG_CPP11_NULLPTR)
|
||||
#define CLARA_INTERNAL_CONFIG_CPP11_NULLPTR
|
||||
#endif
|
||||
|
||||
#ifndef CLARA_INTERNAL_CONFIG_CPP11_NOEXCEPT
|
||||
#define CLARA_INTERNAL_CONFIG_CPP11_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#ifndef CLARA_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
|
||||
#define CLARA_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
|
||||
#endif
|
||||
|
||||
#if !defined(CLARA_INTERNAL_CONFIG_CPP11_OVERRIDE)
|
||||
#define CLARA_INTERNAL_CONFIG_CPP11_OVERRIDE
|
||||
#endif
|
||||
#if !defined(CLARA_INTERNAL_CONFIG_CPP11_UNIQUE_PTR)
|
||||
#define CLARA_INTERNAL_CONFIG_CPP11_UNIQUE_PTR
|
||||
#endif
|
||||
|
||||
|
||||
#endif // __cplusplus >= 201103L
|
||||
|
||||
// Now set the actual defines based on the above + anything the user has configured
|
||||
#if defined(CLARA_INTERNAL_CONFIG_CPP11_NULLPTR) && !defined(CLARA_CONFIG_CPP11_NO_NULLPTR) && !defined(CLARA_CONFIG_CPP11_NULLPTR) && !defined(CLARA_CONFIG_NO_CPP11)
|
||||
#define CLARA_CONFIG_CPP11_NULLPTR
|
||||
#endif
|
||||
#if defined(CLARA_INTERNAL_CONFIG_CPP11_NOEXCEPT) && !defined(CLARA_CONFIG_CPP11_NO_NOEXCEPT) && !defined(CLARA_CONFIG_CPP11_NOEXCEPT) && !defined(CLARA_CONFIG_NO_CPP11)
|
||||
#define CLARA_CONFIG_CPP11_NOEXCEPT
|
||||
#endif
|
||||
#if defined(CLARA_INTERNAL_CONFIG_CPP11_GENERATED_METHODS) && !defined(CLARA_CONFIG_CPP11_NO_GENERATED_METHODS) && !defined(CLARA_CONFIG_CPP11_GENERATED_METHODS) && !defined(CLARA_CONFIG_NO_CPP11)
|
||||
#define CLARA_CONFIG_CPP11_GENERATED_METHODS
|
||||
#endif
|
||||
#if defined(CLARA_INTERNAL_CONFIG_CPP11_OVERRIDE) && !defined(CLARA_CONFIG_NO_OVERRIDE) && !defined(CLARA_CONFIG_CPP11_OVERRIDE) && !defined(CLARA_CONFIG_NO_CPP11)
|
||||
#define CLARA_CONFIG_CPP11_OVERRIDE
|
||||
#endif
|
||||
#if defined(CLARA_INTERNAL_CONFIG_CPP11_UNIQUE_PTR) && !defined(CLARA_CONFIG_NO_UNIQUE_PTR) && !defined(CLARA_CONFIG_CPP11_UNIQUE_PTR) && !defined(CLARA_CONFIG_NO_CPP11)
|
||||
#define CLARA_CONFIG_CPP11_UNIQUE_PTR
|
||||
#endif
|
||||
|
||||
|
||||
// noexcept support:
|
||||
#if defined(CLARA_CONFIG_CPP11_NOEXCEPT) && !defined(CLARA_NOEXCEPT)
|
||||
#define CLARA_NOEXCEPT noexcept
|
||||
# define CLARA_NOEXCEPT_IS(x) noexcept(x)
|
||||
#else
|
||||
#define CLARA_NOEXCEPT throw()
|
||||
# define CLARA_NOEXCEPT_IS(x)
|
||||
#endif
|
||||
|
||||
// nullptr support
|
||||
#ifdef CLARA_CONFIG_CPP11_NULLPTR
|
||||
#define CLARA_NULL nullptr
|
||||
#else
|
||||
#define CLARA_NULL NULL
|
||||
#endif
|
||||
|
||||
// override support
|
||||
#ifdef CLARA_CONFIG_CPP11_OVERRIDE
|
||||
#define CLARA_OVERRIDE override
|
||||
#else
|
||||
#define CLARA_OVERRIDE
|
||||
#endif
|
||||
|
||||
// unique_ptr support
|
||||
#ifdef CLARA_CONFIG_CPP11_UNIQUE_PTR
|
||||
# define CLARA_AUTO_PTR( T ) std::unique_ptr<T>
|
||||
#else
|
||||
# define CLARA_AUTO_PTR( T ) std::auto_ptr<T>
|
||||
#endif
|
||||
|
||||
#endif // TWOBLUECUBES_CLARA_COMPILERS_H_INCLUDED
|
||||
|
||||
|
||||
// ----------- end of #include from clara_compilers.h -----------
|
||||
// ........... back in clara.h
|
||||
|
||||
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
#include <memory>
|
||||
|
||||
@@ -366,9 +205,6 @@ namespace Clara {
|
||||
const unsigned int consoleWidth = 80;
|
||||
#endif
|
||||
|
||||
// Use this to try and stop compiler from warning about unreachable code
|
||||
inline bool isTrue( bool value ) { return value; }
|
||||
|
||||
using namespace Tbc;
|
||||
|
||||
inline bool startsWith( std::string const& str, std::string const& prefix ) {
|
||||
@@ -409,17 +245,16 @@ namespace Clara {
|
||||
}
|
||||
template<typename T>
|
||||
inline void convertInto( bool, T& ) {
|
||||
if( isTrue( true ) )
|
||||
throw std::runtime_error( "Invalid conversion" );
|
||||
throw std::runtime_error( "Invalid conversion" );
|
||||
}
|
||||
|
||||
template<typename ConfigT>
|
||||
struct IArgFunction {
|
||||
virtual ~IArgFunction() {}
|
||||
#ifdef CLARA_CONFIG_CPP11_GENERATED_METHODS
|
||||
# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
|
||||
IArgFunction() = default;
|
||||
IArgFunction( IArgFunction const& ) = default;
|
||||
#endif
|
||||
# endif
|
||||
virtual void set( ConfigT& config, std::string const& value ) const = 0;
|
||||
virtual void setFlag( ConfigT& config ) const = 0;
|
||||
virtual bool takesArg() const = 0;
|
||||
@@ -429,11 +264,11 @@ namespace Clara {
|
||||
template<typename ConfigT>
|
||||
class BoundArgFunction {
|
||||
public:
|
||||
BoundArgFunction() : functionObj( CLARA_NULL ) {}
|
||||
BoundArgFunction() : functionObj( CATCH_NULL ) {}
|
||||
BoundArgFunction( IArgFunction<ConfigT>* _functionObj ) : functionObj( _functionObj ) {}
|
||||
BoundArgFunction( BoundArgFunction const& other ) : functionObj( other.functionObj ? other.functionObj->clone() : CLARA_NULL ) {}
|
||||
BoundArgFunction( BoundArgFunction const& other ) : functionObj( other.functionObj ? other.functionObj->clone() : CATCH_NULL ) {}
|
||||
BoundArgFunction& operator = ( BoundArgFunction const& other ) {
|
||||
IArgFunction<ConfigT>* newFunctionObj = other.functionObj ? other.functionObj->clone() : CLARA_NULL;
|
||||
IArgFunction<ConfigT>* newFunctionObj = other.functionObj ? other.functionObj->clone() : CATCH_NULL;
|
||||
delete functionObj;
|
||||
functionObj = newFunctionObj;
|
||||
return *this;
|
||||
@@ -449,7 +284,7 @@ namespace Clara {
|
||||
bool takesArg() const { return functionObj->takesArg(); }
|
||||
|
||||
bool isSet() const {
|
||||
return functionObj != CLARA_NULL;
|
||||
return functionObj != CATCH_NULL;
|
||||
}
|
||||
private:
|
||||
IArgFunction<ConfigT>* functionObj;
|
||||
@@ -558,7 +393,7 @@ namespace Clara {
|
||||
std::string data;
|
||||
};
|
||||
|
||||
void parseIntoTokens( int argc, char const* const argv[], std::vector<Parser::Token>& tokens ) const {
|
||||
void parseIntoTokens( int argc, char const * const * argv, std::vector<Parser::Token>& tokens ) const {
|
||||
const std::string doubleDash = "--";
|
||||
for( int i = 1; i < argc && argv[i] != doubleDash; ++i )
|
||||
parseIntoTokens( argv[i] , tokens);
|
||||
@@ -668,7 +503,7 @@ namespace Clara {
|
||||
}
|
||||
};
|
||||
|
||||
typedef CLARA_AUTO_PTR( Arg ) ArgAutoPtr;
|
||||
typedef CATCH_AUTO_PTR( Arg ) ArgAutoPtr;
|
||||
|
||||
friend void addOptName( Arg& arg, std::string const& optName )
|
||||
{
|
||||
@@ -745,8 +580,8 @@ namespace Clara {
|
||||
m_arg->description = description;
|
||||
return *this;
|
||||
}
|
||||
ArgBuilder& detail( std::string const& detail ) {
|
||||
m_arg->detail = detail;
|
||||
ArgBuilder& detail( std::string const& _detail ) {
|
||||
m_arg->detail = _detail;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -830,14 +665,14 @@ namespace Clara {
|
||||
maxWidth = (std::max)( maxWidth, it->commands().size() );
|
||||
|
||||
for( it = itBegin; it != itEnd; ++it ) {
|
||||
Detail::Text usage( it->commands(), Detail::TextAttributes()
|
||||
Detail::Text usageText( it->commands(), Detail::TextAttributes()
|
||||
.setWidth( maxWidth+indent )
|
||||
.setIndent( indent ) );
|
||||
Detail::Text desc( it->description, Detail::TextAttributes()
|
||||
.setWidth( width - maxWidth - 3 ) );
|
||||
|
||||
for( std::size_t i = 0; i < (std::max)( usage.size(), desc.size() ); ++i ) {
|
||||
std::string usageCol = i < usage.size() ? usage[i] : "";
|
||||
for( std::size_t i = 0; i < (std::max)( usageText.size(), desc.size() ); ++i ) {
|
||||
std::string usageCol = i < usageText.size() ? usageText[i] : "";
|
||||
os << usageCol;
|
||||
|
||||
if( i < desc.size() && !desc[i].empty() )
|
||||
@@ -894,13 +729,13 @@ namespace Clara {
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
ConfigT parse( int argc, char const* const argv[] ) const {
|
||||
ConfigT parse( int argc, char const * const * argv ) const {
|
||||
ConfigT config;
|
||||
parseInto( argc, argv, config );
|
||||
return config;
|
||||
}
|
||||
|
||||
std::vector<Parser::Token> parseInto( int argc, char const* argv[], ConfigT& config ) const {
|
||||
std::vector<Parser::Token> parseInto( int argc, char const * const * argv, ConfigT& config ) const {
|
||||
std::string processName = argv[0];
|
||||
std::size_t lastSlash = processName.find_last_of( "/\\" );
|
||||
if( lastSlash != std::string::npos )
|
||||
|
@@ -10,13 +10,14 @@
|
||||
|
||||
#include "catch_result_builder.h"
|
||||
#include "catch_message.h"
|
||||
#include "catch_interfaces_capture.h"
|
||||
#include "catch_debugger.h"
|
||||
#include "catch_common.h"
|
||||
#include "catch_tostring.h"
|
||||
#include "catch_interfaces_runner.h"
|
||||
#include "catch_compiler_capabilities.h"
|
||||
|
||||
namespace Catch {
|
||||
AssertionResult const* getLastResult();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// In the event of a failure works out if the debugger needs to be invoked
|
||||
@@ -33,24 +34,23 @@
|
||||
do { \
|
||||
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
|
||||
try { \
|
||||
CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
|
||||
( __catchResult <= expr ).endExpression(); \
|
||||
} \
|
||||
catch( ... ) { \
|
||||
__catchResult.useActiveException( Catch::ResultDisposition::Normal ); \
|
||||
} \
|
||||
INTERNAL_CATCH_REACT( __catchResult ) \
|
||||
} while( Catch::isTrue( false && static_cast<bool>(expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look
|
||||
} while( Catch::isTrue( false && (expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \
|
||||
INTERNAL_CATCH_TEST( expr, resultDisposition, macroName ); \
|
||||
if( Catch::getResultCapture().getLastResult()->succeeded() )
|
||||
if( Catch::getLastResult()->succeeded() )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_ELSE( expr, resultDisposition, macroName ) \
|
||||
INTERNAL_CATCH_TEST( expr, resultDisposition, macroName ); \
|
||||
if( !Catch::getResultCapture().getLastResult()->succeeded() )
|
||||
if( !Catch::getLastResult()->succeeded() )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_NO_THROW( expr, resultDisposition, macroName ) \
|
||||
|
@@ -62,21 +62,6 @@ namespace Catch {
|
||||
? ShowDurations::Always
|
||||
: ShowDurations::Never;
|
||||
}
|
||||
inline void setUseColour( ConfigData& config, std::string const& value ) {
|
||||
std::string mode = toLower( value );
|
||||
|
||||
if( mode == "yes" )
|
||||
config.useColour = UseColour::Yes;
|
||||
else if( mode == "no" )
|
||||
config.useColour = UseColour::No;
|
||||
else if( mode == "auto" )
|
||||
config.useColour = UseColour::Auto;
|
||||
else
|
||||
throw std::runtime_error( "colour mode must be one of: auto, yes or no" );
|
||||
}
|
||||
inline void forceColour( ConfigData& config ) {
|
||||
config.useColour = UseColour::Yes;
|
||||
}
|
||||
inline void loadTestNamesFromFile( ConfigData& config, std::string const& _filename ) {
|
||||
std::ifstream f( _filename.c_str() );
|
||||
if( !f.is_open() )
|
||||
@@ -163,7 +148,7 @@ namespace Catch {
|
||||
|
||||
cli["-d"]["--durations"]
|
||||
.describe( "show test durations" )
|
||||
.bind( &setShowDurations, "yes|no" );
|
||||
.bind( &setShowDurations, "yes/no" );
|
||||
|
||||
cli["-f"]["--input-file"]
|
||||
.describe( "load test names to run from a file" )
|
||||
@@ -191,12 +176,8 @@ namespace Catch {
|
||||
.bind( &setRngSeed, "'time'|number" );
|
||||
|
||||
cli["--force-colour"]
|
||||
.describe( "force colourised output (deprecated)" )
|
||||
.bind( &forceColour );
|
||||
|
||||
cli["--use-colour"]
|
||||
.describe( "should output be colourised" )
|
||||
.bind( &setUseColour, "yes|no" );
|
||||
.describe( "force colourised output" )
|
||||
.bind( &ConfigData::forceColour );
|
||||
|
||||
return cli;
|
||||
}
|
||||
|
@@ -10,7 +10,11 @@
|
||||
|
||||
#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
|
||||
#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
|
||||
#define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
|
||||
#ifdef CATCH_CONFIG_COUNTER
|
||||
# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
|
||||
#else
|
||||
# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
|
||||
#endif
|
||||
|
||||
#define INTERNAL_CATCH_STRINGIFY2( expr ) #expr
|
||||
#define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr )
|
||||
|
@@ -87,7 +87,9 @@ namespace Catch {
|
||||
std::srand( config.rngSeed() );
|
||||
}
|
||||
unsigned int rngSeed() {
|
||||
return getCurrentContext().getConfig()->rngSeed();
|
||||
return getCurrentConfig()
|
||||
? getCurrentConfig()->rngSeed()
|
||||
: 0;
|
||||
}
|
||||
|
||||
std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
|
||||
|
@@ -23,7 +23,7 @@
|
||||
// CATCH_CONFIG_CPP11_OR_GREATER : Is C++11 supported?
|
||||
|
||||
// CATCH_CONFIG_VARIADIC_MACROS : are variadic macros supported?
|
||||
|
||||
// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported?
|
||||
// ****************
|
||||
// Note to maintainers: if new toggles are added please document them
|
||||
// in configuration.md, too
|
||||
@@ -36,10 +36,6 @@
|
||||
|
||||
// All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||
# define CATCH_CPP11_OR_GREATER
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
|
||||
# if __has_feature(cxx_nullptr)
|
||||
@@ -50,10 +46,6 @@
|
||||
# define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
|
||||
# endif
|
||||
|
||||
# if defined(CATCH_CPP11_OR_GREATER)
|
||||
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS _Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
|
||||
# endif
|
||||
|
||||
#endif // __clang__
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -81,13 +73,9 @@
|
||||
// GCC
|
||||
#ifdef __GNUC__
|
||||
|
||||
# if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
|
||||
# endif
|
||||
|
||||
# if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) && defined(CATCH_CPP11_OR_GREATER)
|
||||
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS _Pragma( "gcc diagnostic ignored \"-Wparentheses\"" )
|
||||
# endif
|
||||
#if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
|
||||
#endif
|
||||
|
||||
// - otherwise more recent versions define __cplusplus >= 201103L
|
||||
// and will get picked up below
|
||||
@@ -123,12 +111,22 @@
|
||||
|
||||
#endif
|
||||
|
||||
// Use __COUNTER__ if the compiler supports it
|
||||
#if ( defined _MSC_VER && _MSC_VER >= 1300 ) || \
|
||||
( defined __GNUC__ && __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 ) || \
|
||||
( defined __clang__ && __clang_major__ >= 3 )
|
||||
|
||||
#define CATCH_INTERNAL_CONFIG_COUNTER
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// C++ language feature support
|
||||
|
||||
// catch all support for C++11
|
||||
#if defined(CATCH_CPP11_OR_GREATER)
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||
|
||||
# define CATCH_CPP11_OR_GREATER
|
||||
|
||||
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR)
|
||||
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
|
||||
@@ -196,11 +194,11 @@
|
||||
#if defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_NO_UNIQUE_PTR) && !defined(CATCH_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_NO_CPP11)
|
||||
# define CATCH_CONFIG_CPP11_UNIQUE_PTR
|
||||
#endif
|
||||
|
||||
#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
|
||||
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
|
||||
#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
|
||||
# define CATCH_CONFIG_COUNTER
|
||||
#endif
|
||||
|
||||
|
||||
// noexcept support:
|
||||
#if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT)
|
||||
# define CATCH_NOEXCEPT noexcept
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#define TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
|
||||
|
||||
#include "catch_test_spec_parser.hpp"
|
||||
#include "catch_context.h"
|
||||
#include "catch_interfaces_config.h"
|
||||
#include "catch_stream.h"
|
||||
|
||||
@@ -37,14 +36,14 @@ namespace Catch {
|
||||
noThrow( false ),
|
||||
showHelp( false ),
|
||||
showInvisibles( false ),
|
||||
forceColour( false ),
|
||||
filenamesAsTags( false ),
|
||||
abortAfter( -1 ),
|
||||
rngSeed( 0 ),
|
||||
verbosity( Verbosity::Normal ),
|
||||
warnings( WarnAbout::Nothing ),
|
||||
showDurations( ShowDurations::DefaultForReporter ),
|
||||
runOrder( RunTests::InDeclarationOrder ),
|
||||
useColour( UseColour::Auto )
|
||||
runOrder( RunTests::InDeclarationOrder )
|
||||
{}
|
||||
|
||||
bool listTests;
|
||||
@@ -57,6 +56,7 @@ namespace Catch {
|
||||
bool noThrow;
|
||||
bool showHelp;
|
||||
bool showInvisibles;
|
||||
bool forceColour;
|
||||
bool filenamesAsTags;
|
||||
|
||||
int abortAfter;
|
||||
@@ -66,7 +66,6 @@ namespace Catch {
|
||||
WarnAbout::What warnings;
|
||||
ShowDurations::OrNot showDurations;
|
||||
RunTests::InWhatOrder runOrder;
|
||||
UseColour::YesOrNo useColour;
|
||||
|
||||
std::string outputFilename;
|
||||
std::string name;
|
||||
@@ -133,7 +132,7 @@ namespace Catch {
|
||||
virtual ShowDurations::OrNot showDurations() const { return m_data.showDurations; }
|
||||
virtual RunTests::InWhatOrder runOrder() const { return m_data.runOrder; }
|
||||
virtual unsigned int rngSeed() const { return m_data.rngSeed; }
|
||||
virtual UseColour::YesOrNo useColour() const { return m_data.useColour; }
|
||||
virtual bool forceColour() const { return m_data.forceColour; }
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -95,18 +95,7 @@ namespace {
|
||||
|
||||
IColourImpl* platformColourInstance() {
|
||||
static Win32ColourImpl s_instance;
|
||||
|
||||
Ptr<IConfig const> config = getCurrentContext().getConfig();
|
||||
UseColour::YesOrNo colourMode = config
|
||||
? config->useColour()
|
||||
: UseColour::Auto;
|
||||
if( colourMode == UseColour::Auto )
|
||||
colourMode = !isDebuggerActive()
|
||||
? UseColour::Yes
|
||||
: UseColour::No;
|
||||
return colourMode == UseColour::Yes
|
||||
? &s_instance
|
||||
: NoColourImpl::instance();
|
||||
return &s_instance;
|
||||
}
|
||||
|
||||
} // end anon namespace
|
||||
@@ -156,15 +145,8 @@ namespace {
|
||||
};
|
||||
|
||||
IColourImpl* platformColourInstance() {
|
||||
Ptr<IConfig const> config = getCurrentContext().getConfig();
|
||||
UseColour::YesOrNo colourMode = config
|
||||
? config->useColour()
|
||||
: UseColour::Auto;
|
||||
if( colourMode == UseColour::Auto )
|
||||
colourMode = (!isDebuggerActive() && isatty(STDOUT_FILENO) )
|
||||
? UseColour::Yes
|
||||
: UseColour::No;
|
||||
return colourMode == UseColour::Yes
|
||||
IConfig const* config = getCurrentConfig();
|
||||
return (config && config->forceColour()) || isatty(STDOUT_FILENO)
|
||||
? PosixColourImpl::instance()
|
||||
: NoColourImpl::instance();
|
||||
}
|
||||
@@ -189,7 +171,9 @@ namespace Catch {
|
||||
Colour::~Colour(){ if( !m_moved ) use( None ); }
|
||||
|
||||
void Colour::use( Code _colourCode ) {
|
||||
static IColourImpl* impl = platformColourInstance();
|
||||
static IColourImpl* impl = isDebuggerActive()
|
||||
? NoColourImpl::instance()
|
||||
: platformColourInstance();
|
||||
impl->use( _colourCode );
|
||||
}
|
||||
|
||||
|
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
*/
|
||||
#ifndef TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
|
||||
|
||||
#include "catch_interfaces_generators.h"
|
||||
#include "catch_ptr.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
class TestCase;
|
||||
class Stream;
|
||||
struct IResultCapture;
|
||||
struct IRunner;
|
||||
struct IGeneratorsForTest;
|
||||
struct IConfig;
|
||||
|
||||
struct IContext
|
||||
{
|
||||
virtual ~IContext();
|
||||
|
||||
virtual IResultCapture* getResultCapture() = 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;
|
||||
};
|
||||
|
||||
struct IMutableContext : IContext
|
||||
{
|
||||
virtual ~IMutableContext();
|
||||
virtual void setResultCapture( IResultCapture* resultCapture ) = 0;
|
||||
virtual void setRunner( IRunner* runner ) = 0;
|
||||
virtual void setConfig( Ptr<IConfig const> const& config ) = 0;
|
||||
};
|
||||
|
||||
IContext& getCurrentContext();
|
||||
IMutableContext& getCurrentMutableContext();
|
||||
void cleanUpContext();
|
||||
Stream createStream( std::string const& streamName );
|
||||
|
||||
}
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
|
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
*/
|
||||
#ifndef TWOBLUECUBES_CATCH_CONTEXT_IMPL_HPP_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_CONTEXT_IMPL_HPP_INCLUDED
|
||||
|
||||
#include "catch_run_context.hpp"
|
||||
|
||||
#include "catch_context.h"
|
||||
#include "catch_stream.hpp"
|
||||
|
||||
namespace Catch {
|
||||
|
||||
class Context : public IMutableContext {
|
||||
|
||||
Context() : m_config( CATCH_NULL ), m_runner( CATCH_NULL ), m_resultCapture( CATCH_NULL ) {}
|
||||
Context( Context const& );
|
||||
void operator=( Context const& );
|
||||
|
||||
public: // IContext
|
||||
virtual IResultCapture* getResultCapture() {
|
||||
return m_resultCapture;
|
||||
}
|
||||
virtual IRunner* getRunner() {
|
||||
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 {
|
||||
return m_config;
|
||||
}
|
||||
|
||||
public: // IMutableContext
|
||||
virtual void setResultCapture( IResultCapture* resultCapture ) {
|
||||
m_resultCapture = resultCapture;
|
||||
}
|
||||
virtual void setRunner( IRunner* runner ) {
|
||||
m_runner = runner;
|
||||
}
|
||||
virtual void setConfig( Ptr<IConfig const> const& config ) {
|
||||
m_config = config;
|
||||
}
|
||||
|
||||
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:
|
||||
Ptr<IConfig const> m_config;
|
||||
IRunner* m_runner;
|
||||
IResultCapture* m_resultCapture;
|
||||
std::map<std::string, IGeneratorsForTest*> m_generatorsByTestName;
|
||||
};
|
||||
|
||||
namespace {
|
||||
Context* currentContext = CATCH_NULL;
|
||||
}
|
||||
IMutableContext& getCurrentMutableContext() {
|
||||
if( !currentContext )
|
||||
currentContext = new Context();
|
||||
return *currentContext;
|
||||
}
|
||||
IContext& getCurrentContext() {
|
||||
return getCurrentMutableContext();
|
||||
}
|
||||
|
||||
void cleanUpContext() {
|
||||
delete currentContext;
|
||||
currentContext = CATCH_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_CONTEXT_IMPL_HPP_INCLUDED
|
@@ -52,37 +52,37 @@ namespace Internal {
|
||||
template<typename T1, typename T2>
|
||||
struct Evaluator<T1, T2, IsEqualTo> {
|
||||
static bool evaluate( T1 const& lhs, T2 const& rhs) {
|
||||
return bool( opCast( lhs ) == opCast( rhs ) );
|
||||
return opCast( lhs ) == opCast( rhs );
|
||||
}
|
||||
};
|
||||
template<typename T1, typename T2>
|
||||
struct Evaluator<T1, T2, IsNotEqualTo> {
|
||||
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
|
||||
return bool( opCast( lhs ) != opCast( rhs ) );
|
||||
return opCast( lhs ) != opCast( rhs );
|
||||
}
|
||||
};
|
||||
template<typename T1, typename T2>
|
||||
struct Evaluator<T1, T2, IsLessThan> {
|
||||
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
|
||||
return bool( opCast( lhs ) < opCast( rhs ) );
|
||||
return opCast( lhs ) < opCast( rhs );
|
||||
}
|
||||
};
|
||||
template<typename T1, typename T2>
|
||||
struct Evaluator<T1, T2, IsGreaterThan> {
|
||||
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
|
||||
return bool( opCast( lhs ) > opCast( rhs ) );
|
||||
return opCast( lhs ) > opCast( rhs );
|
||||
}
|
||||
};
|
||||
template<typename T1, typename T2>
|
||||
struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> {
|
||||
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
|
||||
return bool( opCast( lhs ) >= opCast( rhs ) );
|
||||
return opCast( lhs ) >= opCast( rhs );
|
||||
}
|
||||
};
|
||||
template<typename T1, typename T2>
|
||||
struct Evaluator<T1, T2, IsLessThanOrEqualTo> {
|
||||
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
|
||||
return bool( opCast( lhs ) <= opCast( rhs ) );
|
||||
return opCast( lhs ) <= opCast( rhs );
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -14,9 +14,8 @@ namespace Catch {
|
||||
|
||||
// Report the error condition then exit the process
|
||||
inline void fatal( std::string const& message, int exitCode ) {
|
||||
IContext& context = Catch::getCurrentContext();
|
||||
IResultCapture* resultCapture = context.getResultCapture();
|
||||
resultCapture->handleFatalErrorCondition( message );
|
||||
IRunContext& runContext = getCurrentRunContext();
|
||||
runContext.handleFatalErrorCondition( message );
|
||||
|
||||
if( Catch::alwaysTrue() ) // avoids "no return" warnings
|
||||
exit( exitCode );
|
||||
|
@@ -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
|
@@ -19,9 +19,7 @@
|
||||
#include "../catch_session.hpp"
|
||||
#include "catch_registry_hub.hpp"
|
||||
#include "catch_notimplemented_exception.hpp"
|
||||
#include "catch_context_impl.hpp"
|
||||
#include "catch_console_colour_impl.hpp"
|
||||
#include "catch_generators_impl.hpp"
|
||||
#include "catch_assertionresult.hpp"
|
||||
#include "catch_test_case_info.hpp"
|
||||
#include "catch_test_spec.hpp"
|
||||
@@ -36,6 +34,7 @@
|
||||
#include "catch_result_builder.hpp"
|
||||
#include "catch_tag_alias_registry.hpp"
|
||||
#include "catch_test_case_tracker.hpp"
|
||||
#include "catch_stream.hpp"
|
||||
|
||||
#include "../reporters/catch_reporter_multi.hpp"
|
||||
#include "../reporters/catch_reporter_xml.hpp"
|
||||
@@ -53,8 +52,7 @@ namespace Catch {
|
||||
CoutStream::~CoutStream() CATCH_NOEXCEPT {}
|
||||
DebugOutStream::~DebugOutStream() CATCH_NOEXCEPT {}
|
||||
StreamBufBase::~StreamBufBase() CATCH_NOEXCEPT {}
|
||||
IContext::~IContext() {}
|
||||
IResultCapture::~IResultCapture() {}
|
||||
IRunContext::~IRunContext() {}
|
||||
ITestCase::~ITestCase() {}
|
||||
ITestCaseRegistry::~ITestCaseRegistry() {}
|
||||
IRegistryHub::~IRegistryHub() {}
|
||||
@@ -76,15 +74,11 @@ namespace Catch {
|
||||
StreamingReporterBase::~StreamingReporterBase() {}
|
||||
ConsoleReporter::~ConsoleReporter() {}
|
||||
CompactReporter::~CompactReporter() {}
|
||||
IRunner::~IRunner() {}
|
||||
IMutableContext::~IMutableContext() {}
|
||||
IConfig::~IConfig() {}
|
||||
XmlReporter::~XmlReporter() {}
|
||||
JunitReporter::~JunitReporter() {}
|
||||
TestRegistry::~TestRegistry() {}
|
||||
FreeFunctionTestCase::~FreeFunctionTestCase() {}
|
||||
IGeneratorInfo::~IGeneratorInfo() {}
|
||||
IGeneratorsForTest::~IGeneratorsForTest() {}
|
||||
WildcardPattern::~WildcardPattern() {}
|
||||
TestSpec::Pattern::~Pattern() {}
|
||||
TestSpec::NamePattern::~NamePattern() {}
|
||||
|
@@ -16,32 +16,42 @@ namespace Catch {
|
||||
|
||||
class TestCase;
|
||||
class AssertionResult;
|
||||
class ScopedMessageBuilder;
|
||||
|
||||
struct AssertionInfo;
|
||||
struct SectionInfo;
|
||||
struct SectionEndInfo;
|
||||
struct MessageInfo;
|
||||
class ScopedMessageBuilder;
|
||||
struct Counts;
|
||||
struct IConfig;
|
||||
|
||||
struct IResultCapture {
|
||||
struct IRunContext {
|
||||
|
||||
virtual ~IResultCapture();
|
||||
virtual ~IRunContext();
|
||||
|
||||
virtual void assertionEnded( AssertionResult const& result ) = 0;
|
||||
|
||||
virtual bool sectionStarted( SectionInfo const& sectionInfo,
|
||||
Counts& assertions ) = 0;
|
||||
virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0;
|
||||
virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0;
|
||||
|
||||
virtual void pushScopedMessage( MessageInfo const& message ) = 0;
|
||||
virtual void popScopedMessage( MessageInfo const& message ) = 0;
|
||||
|
||||
virtual std::string getCurrentTestName() const = 0;
|
||||
virtual const AssertionResult* getLastResult() const = 0;
|
||||
|
||||
virtual void handleFatalErrorCondition( std::string const& message ) = 0;
|
||||
|
||||
virtual std::string getCurrentTestName() const = 0;
|
||||
virtual AssertionResult const* getLastResult() const = 0;
|
||||
virtual bool isAborting() const = 0;
|
||||
|
||||
virtual IConfig const& config() const = 0;
|
||||
};
|
||||
|
||||
IResultCapture& getResultCapture();
|
||||
IRunContext* tryGetCurrentRunContext();
|
||||
IRunContext& getCurrentRunContext();
|
||||
|
||||
IConfig const* getCurrentConfig();
|
||||
}
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_INTERFACES_CAPTURE_H_INCLUDED
|
||||
|
@@ -37,11 +37,6 @@ namespace Catch {
|
||||
InLexicographicalOrder,
|
||||
InRandomOrder
|
||||
}; };
|
||||
struct UseColour { enum YesOrNo {
|
||||
Auto,
|
||||
Yes,
|
||||
No
|
||||
}; };
|
||||
|
||||
class TestSpec;
|
||||
|
||||
@@ -61,7 +56,7 @@ namespace Catch {
|
||||
virtual TestSpec const& testSpec() const = 0;
|
||||
virtual RunTests::InWhatOrder runOrder() const = 0;
|
||||
virtual unsigned int rngSeed() const = 0;
|
||||
virtual UseColour::YesOrNo useColour() const = 0;
|
||||
virtual bool forceColour() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@ namespace Catch {
|
||||
|
||||
struct IExceptionTranslator;
|
||||
typedef std::vector<const IExceptionTranslator*> ExceptionTranslators;
|
||||
|
||||
|
||||
struct IExceptionTranslator {
|
||||
virtual ~IExceptionTranslator();
|
||||
virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0;
|
||||
@@ -66,9 +66,11 @@ namespace Catch {
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) \
|
||||
static std::string INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator )( signature ); \
|
||||
namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ) ); }\
|
||||
static std::string INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator )( signature )
|
||||
#define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \
|
||||
static std::string translatorName( signature ); \
|
||||
namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); }\
|
||||
static std::string translatorName( signature )
|
||||
|
||||
#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_INTERFACES_EXCEPTION_H_INCLUDED
|
||||
|
@@ -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
|
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Created by Phil on 07/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_INTERFACES_RUNNER_H_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED
|
||||
|
||||
namespace Catch {
|
||||
class TestCase;
|
||||
|
||||
struct IRunner {
|
||||
virtual ~IRunner();
|
||||
virtual bool aborting() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED
|
@@ -17,7 +17,7 @@ namespace Matchers {
|
||||
template<typename ExpressionT> class AnyOf;
|
||||
template<typename ExpressionT> class Not;
|
||||
}
|
||||
|
||||
|
||||
template<typename ExpressionT>
|
||||
struct Matcher : SharedImpl<IShared>
|
||||
{
|
||||
@@ -27,7 +27,7 @@ namespace Matchers {
|
||||
virtual Ptr<Matcher> clone() const = 0;
|
||||
virtual bool match( ExpressionT const& expr ) const = 0;
|
||||
virtual std::string toString() const = 0;
|
||||
|
||||
|
||||
Generic::AllOf<ExpressionT> operator && ( Matcher<ExpressionT> const& other ) const;
|
||||
Generic::AnyOf<ExpressionT> operator || ( Matcher<ExpressionT> const& other ) const;
|
||||
Generic::Not<ExpressionT> operator ! () const;
|
||||
@@ -134,13 +134,13 @@ namespace Matchers {
|
||||
anyOfExpr.add( other );
|
||||
return anyOfExpr;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
std::vector<Ptr<Matcher<ExpressionT> > > m_matchers;
|
||||
};
|
||||
|
||||
} // namespace Generic
|
||||
|
||||
|
||||
template<typename ExpressionT>
|
||||
Generic::AllOf<ExpressionT> Matcher<ExpressionT>::operator && ( Matcher<ExpressionT> const& other ) const {
|
||||
Generic::AllOf<ExpressionT> allOfExpr;
|
||||
@@ -161,7 +161,7 @@ namespace Matchers {
|
||||
Generic::Not<ExpressionT> Matcher<ExpressionT>::operator ! () const {
|
||||
return Generic::Not<ExpressionT>( *this );
|
||||
}
|
||||
|
||||
|
||||
|
||||
namespace StdString {
|
||||
|
||||
@@ -234,7 +234,7 @@ namespace Matchers {
|
||||
virtual ~StartsWith();
|
||||
|
||||
virtual bool match( std::string const& expr ) const {
|
||||
return startsWith( m_data.adjustString( expr ), m_data.m_str );
|
||||
return m_data.adjustString( expr ).find( m_data.m_str ) == 0;
|
||||
}
|
||||
virtual std::string toString() const {
|
||||
return "starts with: \"" + m_data.m_str + "\"" + m_data.toStringSuffix();
|
||||
@@ -251,7 +251,7 @@ namespace Matchers {
|
||||
virtual ~EndsWith();
|
||||
|
||||
virtual bool match( std::string const& expr ) const {
|
||||
return endsWith( m_data.adjustString( expr ), m_data.m_str );
|
||||
return m_data.adjustString( expr ).find( m_data.m_str ) == expr.size() - m_data.m_str.size();
|
||||
}
|
||||
virtual std::string toString() const {
|
||||
return "ends with: \"" + m_data.m_str + "\"" + m_data.toStringSuffix();
|
||||
|
@@ -13,6 +13,8 @@
|
||||
#include "catch_common.h"
|
||||
|
||||
namespace Catch {
|
||||
|
||||
struct IRunContext;
|
||||
|
||||
struct MessageInfo {
|
||||
MessageInfo( std::string const& _macroName,
|
||||
@@ -58,6 +60,7 @@ namespace Catch {
|
||||
ScopedMessage( ScopedMessage const& other );
|
||||
~ScopedMessage();
|
||||
|
||||
IRunContext& m_runContext;
|
||||
MessageInfo m_info;
|
||||
};
|
||||
|
||||
|
@@ -28,17 +28,19 @@ namespace Catch {
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ScopedMessage::ScopedMessage( MessageBuilder const& builder )
|
||||
: m_info( builder.m_info )
|
||||
: m_info( builder.m_info ),
|
||||
m_runContext( getCurrentRunContext() )
|
||||
{
|
||||
m_info.message = builder.m_stream.str();
|
||||
getResultCapture().pushScopedMessage( m_info );
|
||||
m_runContext.pushScopedMessage( m_info );
|
||||
}
|
||||
ScopedMessage::ScopedMessage( ScopedMessage const& other )
|
||||
: m_info( other.m_info )
|
||||
: m_info( other.m_info ),
|
||||
m_runContext( other.m_runContext )
|
||||
{}
|
||||
|
||||
ScopedMessage::~ScopedMessage() {
|
||||
getResultCapture().popScopedMessage( m_info );
|
||||
m_runContext.popScopedMessage( m_info );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -74,7 +74,6 @@ namespace Catch {
|
||||
void cleanUp() {
|
||||
delete getTheRegistryHub();
|
||||
getTheRegistryHub() = CATCH_NULL;
|
||||
cleanUpContext();
|
||||
}
|
||||
std::string translateActiveException() {
|
||||
return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException();
|
||||
|
@@ -15,6 +15,7 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
struct IRunContext;
|
||||
struct TestFailureException{};
|
||||
|
||||
template<typename T> class ExpressionLhs;
|
||||
@@ -77,6 +78,7 @@ namespace Catch {
|
||||
bool allowThrows() const;
|
||||
|
||||
private:
|
||||
IRunContext& m_runContext;
|
||||
AssertionInfo m_assertionInfo;
|
||||
AssertionResultData m_data;
|
||||
struct ExprComponents {
|
||||
|
@@ -9,9 +9,7 @@
|
||||
#define TWOBLUECUBES_CATCH_RESULT_BUILDER_HPP_INCLUDED
|
||||
|
||||
#include "catch_result_builder.h"
|
||||
#include "catch_context.h"
|
||||
#include "catch_interfaces_config.h"
|
||||
#include "catch_interfaces_runner.h"
|
||||
#include "catch_interfaces_capture.h"
|
||||
#include "catch_interfaces_registry_hub.h"
|
||||
#include "catch_wildcard_pattern.hpp"
|
||||
@@ -28,7 +26,8 @@ namespace Catch {
|
||||
char const* capturedExpression,
|
||||
ResultDisposition::Flags resultDisposition,
|
||||
char const* secondArg )
|
||||
: m_assertionInfo( macroName, lineInfo, capturedExpressionWithSecondArgument( capturedExpression, secondArg ), resultDisposition ),
|
||||
: m_runContext( getCurrentRunContext() ),
|
||||
m_assertionInfo( macroName, lineInfo, capturedExpressionWithSecondArgument( capturedExpression, secondArg ), resultDisposition ),
|
||||
m_shouldDebugBreak( false ),
|
||||
m_shouldThrow( false )
|
||||
{}
|
||||
@@ -98,12 +97,12 @@ namespace Catch {
|
||||
}
|
||||
void ResultBuilder::handleResult( AssertionResult const& result )
|
||||
{
|
||||
getResultCapture().assertionEnded( result );
|
||||
m_runContext.assertionEnded( result );
|
||||
|
||||
if( !result.isOk() ) {
|
||||
if( getCurrentContext().getConfig()->shouldDebugBreak() )
|
||||
if( m_runContext.config().shouldDebugBreak() )
|
||||
m_shouldDebugBreak = true;
|
||||
if( getCurrentContext().getRunner()->aborting() || (m_assertionInfo.resultDisposition & ResultDisposition::Normal) )
|
||||
if( m_runContext.isAborting() || (m_assertionInfo.resultDisposition & ResultDisposition::Normal) )
|
||||
m_shouldThrow = true;
|
||||
}
|
||||
}
|
||||
@@ -113,7 +112,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
bool ResultBuilder::shouldDebugBreak() const { return m_shouldDebugBreak; }
|
||||
bool ResultBuilder::allowThrows() const { return getCurrentContext().getConfig()->allowThrows(); }
|
||||
bool ResultBuilder::allowThrows() const { return m_runContext.config().allowThrows(); }
|
||||
|
||||
AssertionResult ResultBuilder::build() const
|
||||
{
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#ifndef TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED
|
||||
|
||||
#include "catch_interfaces_runner.h"
|
||||
#include "catch_interfaces_capture.h"
|
||||
#include "catch_interfaces_reporter.h"
|
||||
#include "catch_interfaces_exception.h"
|
||||
#include "catch_config.hpp"
|
||||
@@ -52,7 +52,34 @@ namespace Catch {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class RunContext : public IResultCapture, public IRunner {
|
||||
namespace {
|
||||
IRunContext* s_currentRunContext = CATCH_NULL;
|
||||
|
||||
void setCurrentRunContext( IRunContext* context ) {
|
||||
s_currentRunContext = context;
|
||||
}
|
||||
}
|
||||
|
||||
IRunContext* tryGetCurrentRunContext() {
|
||||
return s_currentRunContext;
|
||||
}
|
||||
IRunContext& getCurrentRunContext() {
|
||||
if( IRunContext* capture = tryGetCurrentRunContext() )
|
||||
return *capture;
|
||||
else
|
||||
throw std::logic_error( "No current test runner" );
|
||||
}
|
||||
IConfig const* getCurrentConfig() {
|
||||
if( IRunContext* capture = tryGetCurrentRunContext() )
|
||||
return &capture->config();
|
||||
else
|
||||
return CATCH_NULL;
|
||||
}
|
||||
AssertionResult const* getLastResult() {
|
||||
return getCurrentRunContext().getLastResult();
|
||||
}
|
||||
|
||||
class RunContext : public IRunContext {
|
||||
|
||||
RunContext( RunContext const& );
|
||||
void operator =( RunContext const& );
|
||||
@@ -61,81 +88,66 @@ namespace Catch {
|
||||
|
||||
explicit RunContext( Ptr<IConfig const> const& _config, Ptr<IStreamingReporter> const& reporter )
|
||||
: m_runInfo( _config->name() ),
|
||||
m_context( getCurrentMutableContext() ),
|
||||
m_activeTestCase( CATCH_NULL ),
|
||||
m_config( _config ),
|
||||
m_reporter( reporter )
|
||||
m_reporter( reporter ),
|
||||
m_activeTestCaseInfo( CATCH_NULL )
|
||||
{
|
||||
m_context.setRunner( this );
|
||||
m_context.setConfig( m_config );
|
||||
m_context.setResultCapture( this );
|
||||
setCurrentRunContext( this );
|
||||
m_reporter->testRunStarting( m_runInfo );
|
||||
}
|
||||
|
||||
virtual ~RunContext() {
|
||||
m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, aborting() ) );
|
||||
m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, isAborting() ) );
|
||||
setCurrentRunContext( CATCH_NULL );
|
||||
}
|
||||
|
||||
void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount ) {
|
||||
m_reporter->testGroupStarting( GroupInfo( testSpec, groupIndex, groupsCount ) );
|
||||
}
|
||||
void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount ) {
|
||||
m_reporter->testGroupEnded( TestGroupStats( GroupInfo( testSpec, groupIndex, groupsCount ), totals, aborting() ) );
|
||||
m_reporter->testGroupEnded( TestGroupStats( GroupInfo( testSpec, groupIndex, groupsCount ), totals, isAborting() ) );
|
||||
}
|
||||
|
||||
Totals runTest( TestCase const& testCase ) {
|
||||
m_activeTestCaseInfo = &testCase;
|
||||
|
||||
Totals prevTotals = m_totals;
|
||||
std::string redirectedCout, redirectedCerr;
|
||||
|
||||
std::string redirectedCout;
|
||||
std::string redirectedCerr;
|
||||
|
||||
TestCaseInfo testInfo = testCase.getTestCaseInfo();
|
||||
|
||||
m_reporter->testCaseStarting( testInfo );
|
||||
|
||||
m_activeTestCase = &testCase;
|
||||
m_reporter->testCaseStarting( testCase );
|
||||
|
||||
ITracker* m_testCaseTracker;
|
||||
|
||||
m_trackerContext.startRun();
|
||||
do {
|
||||
m_trackerContext.startRun();
|
||||
do {
|
||||
m_trackerContext.startCycle();
|
||||
m_testCaseTracker = &SectionTracker::acquire( m_trackerContext, testInfo.name );
|
||||
runCurrentTest( redirectedCout, redirectedCerr );
|
||||
}
|
||||
while( !m_testCaseTracker->isSuccessfullyCompleted() && !aborting() );
|
||||
m_trackerContext.startCycle();
|
||||
m_testCaseTracker = &SectionTracker::acquire( m_trackerContext, testCase.name );
|
||||
runTest( testCase, redirectedCout, redirectedCerr );
|
||||
}
|
||||
// !TBD: deprecated - this will be replaced by indexed trackers
|
||||
while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() );
|
||||
while( !m_testCaseTracker->isSuccessfullyCompleted() && !isAborting() );
|
||||
|
||||
|
||||
Totals deltaTotals = m_totals.delta( prevTotals );
|
||||
m_totals.testCases += deltaTotals.testCases;
|
||||
m_reporter->testCaseEnded( TestCaseStats( testInfo,
|
||||
m_reporter->testCaseEnded( TestCaseStats( testCase,
|
||||
deltaTotals,
|
||||
redirectedCout,
|
||||
redirectedCerr,
|
||||
aborting() ) );
|
||||
isAborting() ) );
|
||||
|
||||
m_activeTestCase = CATCH_NULL;
|
||||
m_testCaseTracker = CATCH_NULL;
|
||||
m_activeTestCaseInfo = CATCH_NULL;
|
||||
|
||||
return deltaTotals;
|
||||
}
|
||||
|
||||
Ptr<IConfig const> config() const {
|
||||
return m_config;
|
||||
}
|
||||
|
||||
private: // IResultCapture
|
||||
private: // IRunContext
|
||||
|
||||
|
||||
virtual void assertionEnded( AssertionResult const& result ) {
|
||||
if( result.getResultType() == ResultWas::Ok ) {
|
||||
virtual void assertionEnded( AssertionResult const& result ) CATCH_OVERRIDE {
|
||||
if( result.getResultType() == ResultWas::Ok )
|
||||
m_totals.assertions.passed++;
|
||||
}
|
||||
else if( !result.isOk() ) {
|
||||
else if( !result.isOk() )
|
||||
m_totals.assertions.failed++;
|
||||
}
|
||||
|
||||
if( m_reporter->assertionEnded( AssertionStats( result, m_messages, m_totals ) ) )
|
||||
m_messages.clear();
|
||||
@@ -145,10 +157,9 @@ namespace Catch {
|
||||
m_lastResult = result;
|
||||
}
|
||||
|
||||
virtual bool sectionStarted (
|
||||
SectionInfo const& sectionInfo,
|
||||
Counts& assertions
|
||||
)
|
||||
virtual bool sectionStarted
|
||||
( SectionInfo const& sectionInfo,
|
||||
Counts& assertions ) CATCH_OVERRIDE
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << sectionInfo.name << "@" << sectionInfo.lineInfo;
|
||||
@@ -178,7 +189,7 @@ namespace Catch {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void sectionEnded( SectionEndInfo const& endInfo ) {
|
||||
virtual void sectionEnded( SectionEndInfo const& endInfo ) CATCH_OVERRIDE {
|
||||
Counts assertions = m_totals.assertions - endInfo.prevAssertions;
|
||||
bool missingAssertions = testForMissingAssertions( assertions );
|
||||
|
||||
@@ -191,7 +202,7 @@ namespace Catch {
|
||||
m_messages.clear();
|
||||
}
|
||||
|
||||
virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) {
|
||||
virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) CATCH_OVERRIDE {
|
||||
if( m_unfinishedSections.empty() )
|
||||
m_activeSections.back()->fail();
|
||||
else
|
||||
@@ -201,25 +212,28 @@ namespace Catch {
|
||||
m_unfinishedSections.push_back( endInfo );
|
||||
}
|
||||
|
||||
virtual void pushScopedMessage( MessageInfo const& message ) {
|
||||
virtual void pushScopedMessage( MessageInfo const& message ) CATCH_OVERRIDE {
|
||||
m_messages.push_back( message );
|
||||
}
|
||||
|
||||
virtual void popScopedMessage( MessageInfo const& message ) {
|
||||
virtual void popScopedMessage( MessageInfo const& message ) CATCH_OVERRIDE {
|
||||
m_messages.erase( std::remove( m_messages.begin(), m_messages.end(), message ), m_messages.end() );
|
||||
}
|
||||
|
||||
virtual std::string getCurrentTestName() const {
|
||||
return m_activeTestCase
|
||||
? m_activeTestCase->getTestCaseInfo().name
|
||||
virtual std::string getCurrentTestName() const CATCH_OVERRIDE {
|
||||
return m_activeTestCaseInfo
|
||||
? m_activeTestCaseInfo->name
|
||||
: "";
|
||||
}
|
||||
|
||||
virtual const AssertionResult* getLastResult() const {
|
||||
virtual AssertionResult const* getLastResult() const CATCH_OVERRIDE {
|
||||
return &m_lastResult;
|
||||
}
|
||||
virtual IConfig const& config() const CATCH_OVERRIDE {
|
||||
return *m_config;
|
||||
}
|
||||
|
||||
virtual void handleFatalErrorCondition( std::string const& message ) {
|
||||
virtual void handleFatalErrorCondition( std::string const& message ) CATCH_OVERRIDE {
|
||||
ResultBuilder resultBuilder = makeUnexpectedResultBuilder();
|
||||
resultBuilder.setResultType( ResultWas::FatalErrorCondition );
|
||||
resultBuilder << message;
|
||||
@@ -228,19 +242,19 @@ namespace Catch {
|
||||
handleUnfinishedSections();
|
||||
|
||||
// Recreate section for test case (as we will lose the one that was in scope)
|
||||
TestCaseInfo const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
|
||||
SectionInfo testCaseSection( testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description );
|
||||
SectionInfo testCaseSection
|
||||
( m_activeTestCaseInfo->lineInfo,
|
||||
m_activeTestCaseInfo->name,
|
||||
m_activeTestCaseInfo->description );
|
||||
|
||||
Counts assertions;
|
||||
assertions.failed = 1;
|
||||
SectionStats testCaseSectionStats( testCaseSection, assertions, 0, false );
|
||||
m_reporter->sectionEnded( testCaseSectionStats );
|
||||
|
||||
TestCaseInfo testInfo = m_activeTestCase->getTestCaseInfo();
|
||||
|
||||
Totals deltaTotals;
|
||||
deltaTotals.testCases.failed = 1;
|
||||
m_reporter->testCaseEnded( TestCaseStats( testInfo,
|
||||
m_reporter->testCaseEnded( TestCaseStats( *m_activeTestCaseInfo,
|
||||
deltaTotals,
|
||||
"",
|
||||
"",
|
||||
@@ -252,20 +266,19 @@ namespace Catch {
|
||||
|
||||
public:
|
||||
// !TBD We need to do this another way!
|
||||
bool aborting() const {
|
||||
bool isAborting() const {
|
||||
return m_totals.assertions.failed == static_cast<std::size_t>( m_config->abortAfter() );
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr ) {
|
||||
TestCaseInfo const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
|
||||
SectionInfo testCaseSection( testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description );
|
||||
void runTest( TestCase const& testCase, std::string& redirectedCout, std::string& redirectedCerr ) {
|
||||
SectionInfo testCaseSection( testCase.lineInfo, testCase.name, testCase.description );
|
||||
m_reporter->sectionStarting( testCaseSection );
|
||||
Counts prevAssertions = m_totals.assertions;
|
||||
double duration = 0;
|
||||
try {
|
||||
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal );
|
||||
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCase.lineInfo, "", ResultDisposition::Normal );
|
||||
|
||||
seedRng( *m_config );
|
||||
|
||||
@@ -274,10 +287,10 @@ namespace Catch {
|
||||
if( m_reporter->getPreferences().shouldRedirectStdOut ) {
|
||||
StreamRedirect coutRedir( Catch::cout(), redirectedCout );
|
||||
StreamRedirect cerrRedir( Catch::cerr(), redirectedCerr );
|
||||
invokeActiveTestCase();
|
||||
invokeTestCase( testCase );
|
||||
}
|
||||
else {
|
||||
invokeActiveTestCase();
|
||||
invokeTestCase( testCase );
|
||||
}
|
||||
duration = timer.getElapsedSeconds();
|
||||
}
|
||||
@@ -287,14 +300,15 @@ namespace Catch {
|
||||
catch(...) {
|
||||
makeUnexpectedResultBuilder().useActiveException();
|
||||
}
|
||||
m_testCaseTracker->close();
|
||||
m_trackerContext.currentTracker().close();
|
||||
|
||||
handleUnfinishedSections();
|
||||
m_messages.clear();
|
||||
|
||||
Counts assertions = m_totals.assertions - prevAssertions;
|
||||
bool missingAssertions = testForMissingAssertions( assertions );
|
||||
|
||||
if( testCaseInfo.okToFail() ) {
|
||||
if( testCase.okToFail() ) {
|
||||
std::swap( assertions.failedButOk, assertions.failed );
|
||||
m_totals.assertions.failed -= assertions.failedButOk;
|
||||
m_totals.assertions.failedButOk += assertions.failedButOk;
|
||||
@@ -304,10 +318,9 @@ namespace Catch {
|
||||
m_reporter->sectionEnded( testCaseSectionStats );
|
||||
}
|
||||
|
||||
void invokeActiveTestCase() {
|
||||
static void invokeTestCase( TestCase const& testCase ) {
|
||||
FatalConditionHandler fatalConditionHandler; // Handle signals
|
||||
m_activeTestCase->invoke();
|
||||
fatalConditionHandler.reset();
|
||||
testCase.invoke();
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -331,29 +344,21 @@ namespace Catch {
|
||||
}
|
||||
|
||||
TestRunInfo m_runInfo;
|
||||
IMutableContext& m_context;
|
||||
TestCase const* m_activeTestCase;
|
||||
ITracker* m_testCaseTracker;
|
||||
ITracker* m_currentSectionTracker;
|
||||
AssertionResult m_lastResult;
|
||||
|
||||
Ptr<IConfig const> m_config;
|
||||
Totals m_totals;
|
||||
Ptr<IStreamingReporter> m_reporter;
|
||||
std::vector<MessageInfo> m_messages;
|
||||
TrackerContext m_trackerContext;
|
||||
Totals m_totals;
|
||||
|
||||
// Transient state
|
||||
TestCaseInfo const* m_activeTestCaseInfo;
|
||||
AssertionResult m_lastResult;
|
||||
AssertionInfo m_lastAssertionInfo;
|
||||
std::vector<SectionEndInfo> m_unfinishedSections;
|
||||
std::vector<ITracker*> m_activeSections;
|
||||
TrackerContext m_trackerContext;
|
||||
std::vector<MessageInfo> m_messages;
|
||||
};
|
||||
|
||||
IResultCapture& getResultCapture() {
|
||||
if( IResultCapture* capture = getCurrentContext().getResultCapture() )
|
||||
return *capture;
|
||||
else
|
||||
throw std::logic_error( "No result capture instance" );
|
||||
}
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
struct IRunContext;
|
||||
|
||||
class Section : NonCopyable {
|
||||
public:
|
||||
Section( SectionInfo const& info );
|
||||
@@ -29,6 +31,7 @@ namespace Catch {
|
||||
|
||||
std::string m_name;
|
||||
Counts m_assertions;
|
||||
IRunContext& m_runContext;
|
||||
bool m_sectionIncluded;
|
||||
Timer m_timer;
|
||||
};
|
||||
|
@@ -26,7 +26,8 @@ namespace Catch {
|
||||
|
||||
Section::Section( SectionInfo const& info )
|
||||
: m_info( info ),
|
||||
m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) )
|
||||
m_runContext( getCurrentRunContext() ),
|
||||
m_sectionIncluded( m_runContext.sectionStarted( m_info, m_assertions ) )
|
||||
{
|
||||
m_timer.start();
|
||||
}
|
||||
@@ -35,9 +36,9 @@ namespace Catch {
|
||||
if( m_sectionIncluded ) {
|
||||
SectionEndInfo endInfo( m_info, m_assertions, m_timer.getElapsedSeconds() );
|
||||
if( std::uncaught_exception() )
|
||||
getResultCapture().sectionEndedEarly( endInfo );
|
||||
m_runContext.sectionEndedEarly( endInfo );
|
||||
else
|
||||
getResultCapture().sectionEnded( endInfo );
|
||||
m_runContext.sectionEnded( endInfo );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include <streambuf>
|
||||
#include <ostream>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
@@ -49,7 +50,7 @@ namespace Catch {
|
||||
|
||||
|
||||
class DebugOutStream : public IStream {
|
||||
std::auto_ptr<StreamBufBase> m_streamBuf;
|
||||
CATCH_AUTO_PTR( StreamBufBase ) m_streamBuf;
|
||||
mutable std::ostream m_os;
|
||||
public:
|
||||
DebugOutStream();
|
||||
|
@@ -96,7 +96,8 @@ namespace Catch {
|
||||
return m_os;
|
||||
}
|
||||
|
||||
#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions
|
||||
|
||||
#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement this functions
|
||||
std::ostream& cout() {
|
||||
return std::cout;
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@
|
||||
#include "catch_test_registry.hpp"
|
||||
#include "catch_test_case_info.h"
|
||||
#include "catch_test_spec.hpp"
|
||||
#include "catch_context.h"
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
@@ -89,7 +88,7 @@ namespace Catch {
|
||||
public:
|
||||
TestRegistry()
|
||||
: m_currentSortOrder( RunTests::InDeclarationOrder ),
|
||||
m_unnamedCount( 0 )
|
||||
m_unnamedCount( 0 )
|
||||
{}
|
||||
virtual ~TestRegistry();
|
||||
|
||||
@@ -160,7 +159,7 @@ namespace Catch {
|
||||
char const* classOrQualifiedMethodName,
|
||||
NameAndDesc const& nameAndDesc,
|
||||
SourceLineInfo const& lineInfo ) {
|
||||
|
||||
|
||||
getMutableRegistryHub().registerTest
|
||||
( makeTestCase
|
||||
( testCase,
|
||||
@@ -175,7 +174,7 @@ namespace Catch {
|
||||
NameAndDesc const& nameAndDesc ) {
|
||||
registerTestCase( new FreeFunctionTestCase( function ), "", nameAndDesc, lineInfo );
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AutoReg::AutoReg
|
||||
|
@@ -85,24 +85,28 @@ void registerTestCaseFunction
|
||||
|
||||
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \
|
||||
static void TestName(); \
|
||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); }\
|
||||
static void TestName()
|
||||
#define INTERNAL_CATCH_TESTCASE( ... ) \
|
||||
static void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )(); \
|
||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); }\
|
||||
static void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )()
|
||||
INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \
|
||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... )\
|
||||
#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\
|
||||
namespace{ \
|
||||
struct INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) : ClassName{ \
|
||||
struct TestName : ClassName{ \
|
||||
void test(); \
|
||||
}; \
|
||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test, #ClassName, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); \
|
||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &TestName::test, #ClassName, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); \
|
||||
} \
|
||||
void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test()
|
||||
void TestName::test()
|
||||
#define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \
|
||||
INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
|
||||
@@ -110,24 +114,28 @@ void registerTestCaseFunction
|
||||
|
||||
#else
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_TESTCASE2( TestName, Name, Desc ) \
|
||||
static void TestName(); \
|
||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) ); }\
|
||||
static void TestName()
|
||||
#define INTERNAL_CATCH_TESTCASE( Name, Desc ) \
|
||||
static void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )(); \
|
||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) ); }\
|
||||
static void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )()
|
||||
INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), Name, Desc )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, Name, Desc ) \
|
||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( Name, Desc ), CATCH_INTERNAL_LINEINFO ); }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, TestName, Desc )\
|
||||
#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestCaseName, ClassName, TestName, Desc )\
|
||||
namespace{ \
|
||||
struct INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) : ClassName{ \
|
||||
struct TestCaseName : ClassName{ \
|
||||
void test(); \
|
||||
}; \
|
||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test, #ClassName, Catch::NameAndDesc( TestName, Desc ), CATCH_INTERNAL_LINEINFO ); \
|
||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &TestCaseName::test, #ClassName, Catch::NameAndDesc( TestName, Desc ), CATCH_INTERNAL_LINEINFO ); \
|
||||
} \
|
||||
void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test()
|
||||
void TestCaseName::test()
|
||||
#define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, TestName, Desc )\
|
||||
INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, TestName, Desc )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, Name, Desc ) \
|
||||
|
@@ -55,10 +55,13 @@ namespace Detail {
|
||||
|
||||
std::string toString( std::string const& value ) {
|
||||
std::string s = value;
|
||||
if( getCurrentContext().getConfig()->showInvisibles() ) {
|
||||
IConfig const* config = getCurrentConfig();
|
||||
if( config && config->showInvisibles() ) {
|
||||
for(size_t i = 0; i < s.size(); ++i ) {
|
||||
std::string subs;
|
||||
switch( s[i] ) {
|
||||
case '\r': subs = "\\r"; break;
|
||||
case '\l': subs = "\\l"; break;
|
||||
case '\n': subs = "\\n"; break;
|
||||
case '\t': subs = "\\t"; break;
|
||||
default: break;
|
||||
|
@@ -37,7 +37,7 @@ namespace Catch {
|
||||
return os;
|
||||
}
|
||||
|
||||
Version libraryVersion( 1, 3, 5, "", 0 );
|
||||
Version libraryVersion( 2, 0, 0, "develop", 2 );
|
||||
|
||||
}
|
||||
|
||||
|
@@ -830,6 +830,6 @@ with expansion:
|
||||
"first" == "second"
|
||||
|
||||
===============================================================================
|
||||
test cases: 167 | 124 passed | 42 failed | 1 failed as expected
|
||||
assertions: 919 | 823 passed | 83 failed | 13 failed as expected
|
||||
test cases: 165 | 122 passed | 42 failed | 1 failed as expected
|
||||
assertions: 768 | 672 passed | 83 failed | 13 failed as expected
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
<testsuites>
|
||||
<testsuite name="CatchSelfTest" errors="13" failures="72" tests="921" hostname="tbd" time="{duration}" timestamp="tbd">
|
||||
<testsuite name="CatchSelfTest" errors="13" failures="72" tests="770" hostname="tbd" time="{duration}" timestamp="tbd">
|
||||
<testcase classname="global" name="toString(enum)" time="{duration}"/>
|
||||
<testcase classname="global" name="toString(enum w/operator<<)" time="{duration}"/>
|
||||
<testcase classname="global" name="toString(enum class)" time="{duration}"/>
|
||||
@@ -265,8 +265,6 @@ ExceptionTests.cpp:<line number>
|
||||
ExceptionTests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="global" name="Generators over two ranges" time="{duration}"/>
|
||||
<testcase classname="global" name="Generator over a range of pairs" time="{duration}"/>
|
||||
<testcase classname="global" name="INFO and WARN do not abort tests" time="{duration}"/>
|
||||
<testcase classname="global" name="SUCCEED counts as a test pass" time="{duration}"/>
|
||||
<testcase classname="global" name="INFO gets logged on failure" time="{duration}">
|
||||
@@ -518,11 +516,8 @@ MiscTests.cpp:<line number>
|
||||
<testcase classname="Process can be configured on command line" name="output filename/-o filename" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="output filename/--out" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="combinations/Single character flags can be combined" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="use-colour/without option" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="use-colour/auto" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="use-colour/yes" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="use-colour/no" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="use-colour/error" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="force-colour/--force-colour" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="force-colour/without --force-colour" time="{duration}"/>
|
||||
<testcase classname="Long strings can be wrapped" name="plain string/No wrapping" time="{duration}"/>
|
||||
<testcase classname="Long strings can be wrapped" name="plain string/Wrapped once" time="{duration}"/>
|
||||
<testcase classname="Long strings can be wrapped" name="plain string/Wrapped twice" time="{duration}"/>
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -113,12 +113,12 @@ public:
|
||||
: m_msg( msg )
|
||||
{}
|
||||
~CustomStdException() CATCH_NOEXCEPT {}
|
||||
|
||||
|
||||
std::string getMessage() const
|
||||
{
|
||||
return m_msg;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
std::string m_msg;
|
||||
};
|
||||
|
@@ -1,42 +1,2 @@
|
||||
/*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
// 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 );
|
||||
|
||||
}
|
||||
// The old generators have been removed
|
||||
// A new generator implementation is coming
|
||||
|
@@ -475,6 +475,8 @@ TEST_CASE( "long long" ) {
|
||||
|
||||
//TEST_CASE( "Divide by Zero signal handler", "[.][sig]" ) {
|
||||
// int i = 0;
|
||||
// int x = 10/i; // This should cause the signal to fire
|
||||
// CHECK( x == 0 );
|
||||
// SECTION( "s" ) {
|
||||
// int x = 10/i; // This should cause the signal to fire
|
||||
// CHECK( x == 0 );
|
||||
// }
|
||||
//}
|
||||
|
@@ -1 +0,0 @@
|
||||
#include "catch_interfaces_generators.h"
|
||||
|
@@ -1 +0,0 @@
|
||||
#include "catch_interfaces_runner.h"
|
@@ -195,41 +195,19 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
||||
}
|
||||
}
|
||||
|
||||
SECTION( "use-colour", "") {
|
||||
|
||||
using Catch::UseColour;
|
||||
|
||||
SECTION( "without option", "" ) {
|
||||
SECTION( "force-colour", "") {
|
||||
SECTION( "--force-colour", "" ) {
|
||||
const char* argv[] = { "test", "--force-colour" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
REQUIRE( config.forceColour );
|
||||
}
|
||||
|
||||
SECTION( "without --force-colour", "" ) {
|
||||
const char* argv[] = { "test" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
REQUIRE( config.useColour == UseColour::Auto );
|
||||
}
|
||||
|
||||
SECTION( "auto", "" ) {
|
||||
const char* argv[] = { "test", "--use-colour", "auto" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
REQUIRE( config.useColour == UseColour::Auto );
|
||||
}
|
||||
|
||||
SECTION( "yes", "" ) {
|
||||
const char* argv[] = { "test", "--use-colour", "yes" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
REQUIRE( config.useColour == UseColour::Yes );
|
||||
}
|
||||
|
||||
SECTION( "no", "" ) {
|
||||
const char* argv[] = { "test", "--use-colour", "no" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
REQUIRE( config.useColour == UseColour::No );
|
||||
}
|
||||
|
||||
SECTION( "error", "" ) {
|
||||
const char* argv[] = { "test", "--use-colour", "wrong" };
|
||||
REQUIRE_THROWS_WITH( parseIntoConfig( argv, config ), Contains( "colour mode must be one of" ) );
|
||||
REQUIRE( !config.forceColour );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -93,7 +93,7 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\SelfTest\ApproxTests.cpp" />
|
||||
<ClCompile Include="..\..\..\SelfTest\BDDTests.cpp" />
|
||||
<ClCompile Include="..\..\..\SelfTest\PartTrackerTests.cpp" />
|
||||
<ClCompile Include="..\..\..\SelfTest\SectionTrackerTests.cpp" />
|
||||
<ClCompile Include="..\..\..\SelfTest\TestMain.cpp" />
|
||||
<ClCompile Include="..\..\..\SelfTest\ClassTests.cpp" />
|
||||
<ClCompile Include="..\..\..\SelfTest\ConditionTests.cpp" />
|
||||
|
@@ -27,7 +27,6 @@
|
||||
4A45DA2D16161FA2004F8D6B /* catch_interfaces_capture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2C16161FA2004F8D6B /* catch_interfaces_capture.cpp */; };
|
||||
4A45DA3116161FFC004F8D6B /* catch_interfaces_reporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA3016161FFB004F8D6B /* catch_interfaces_reporter.cpp */; };
|
||||
4A45DA3316162047004F8D6B /* catch_interfaces_exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA3216162047004F8D6B /* catch_interfaces_exception.cpp */; };
|
||||
4A45DA3516162071004F8D6B /* catch_interfaces_runner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA3416162071004F8D6B /* catch_interfaces_runner.cpp */; };
|
||||
4A6D0C27149B3D3B00DB3EAA /* CatchSelfTest.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4A6D0C26149B3D3B00DB3EAA /* CatchSelfTest.1 */; };
|
||||
4A6D0C37149B3D9E00DB3EAA /* ApproxTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6D0C2D149B3D9E00DB3EAA /* ApproxTests.cpp */; };
|
||||
4A6D0C38149B3D9E00DB3EAA /* ClassTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6D0C2F149B3D9E00DB3EAA /* ClassTests.cpp */; };
|
||||
@@ -120,7 +119,6 @@
|
||||
4A45DA2C16161FA2004F8D6B /* catch_interfaces_capture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_interfaces_capture.cpp; path = ../../../SelfTest/SurrogateCpps/catch_interfaces_capture.cpp; sourceTree = "<group>"; };
|
||||
4A45DA3016161FFB004F8D6B /* catch_interfaces_reporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_interfaces_reporter.cpp; path = ../../../SelfTest/SurrogateCpps/catch_interfaces_reporter.cpp; sourceTree = "<group>"; };
|
||||
4A45DA3216162047004F8D6B /* catch_interfaces_exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_interfaces_exception.cpp; path = ../../../SelfTest/SurrogateCpps/catch_interfaces_exception.cpp; sourceTree = "<group>"; };
|
||||
4A45DA3416162071004F8D6B /* catch_interfaces_runner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_interfaces_runner.cpp; path = ../../../SelfTest/SurrogateCpps/catch_interfaces_runner.cpp; sourceTree = "<group>"; };
|
||||
4A4B0F9715CE6CFB00AE2392 /* catch_registry_hub.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_registry_hub.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
||||
4A4B0F9915CE6EC100AE2392 /* catch_interfaces_registry_hub.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = catch_interfaces_registry_hub.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||
4A4B0F9A15CEF84800AE2392 /* catch_notimplemented_exception.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_notimplemented_exception.h; sourceTree = "<group>"; };
|
||||
@@ -149,14 +147,9 @@
|
||||
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; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
4A6D0C54149B3E3D00DB3EAA /* catch_interfaces_exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = catch_interfaces_exception.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||
4A6D0C55149B3E3D00DB3EAA /* catch_interfaces_reporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_reporter.h; sourceTree = "<group>"; };
|
||||
4A6D0C56149B3E3D00DB3EAA /* catch_interfaces_runner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_runner.h; sourceTree = "<group>"; };
|
||||
4A6D0C57149B3E3D00DB3EAA /* catch_interfaces_testcase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_testcase.h; sourceTree = "<group>"; };
|
||||
4A6D0C58149B3E3D00DB3EAA /* catch_list.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_list.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
||||
4A6D0C59149B3E3D00DB3EAA /* catch_objc.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_objc.hpp; sourceTree = "<group>"; };
|
||||
@@ -175,7 +168,6 @@
|
||||
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>"; };
|
||||
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; };
|
||||
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; };
|
||||
@@ -340,7 +332,6 @@
|
||||
4A45DA2C16161FA2004F8D6B /* catch_interfaces_capture.cpp */,
|
||||
4A45DA3216162047004F8D6B /* catch_interfaces_exception.cpp */,
|
||||
4A45DA3016161FFB004F8D6B /* catch_interfaces_reporter.cpp */,
|
||||
4A45DA3416162071004F8D6B /* catch_interfaces_runner.cpp */,
|
||||
4AB3D99C1616216500C9A0F8 /* catch_interfaces_testcase.cpp */,
|
||||
4AB3D99F1616219100C9A0F8 /* catch_interfaces_config.cpp */,
|
||||
4AB3D9A1161621B500C9A0F8 /* catch_interfaces_generators.cpp */,
|
||||
@@ -358,8 +349,6 @@
|
||||
263FD06017AF8DF200988A20 /* catch_timer.hpp */,
|
||||
4A4B0F9C15CEFA8300AE2392 /* catch_impl.hpp */,
|
||||
4A4B0F9715CE6CFB00AE2392 /* catch_registry_hub.hpp */,
|
||||
4A6D0C50149B3E3D00DB3EAA /* catch_generators_impl.hpp */,
|
||||
4A6D0C52149B3E3D00DB3EAA /* catch_context_impl.hpp */,
|
||||
4A6D0C5E149B3E3D00DB3EAA /* catch_run_context.hpp */,
|
||||
4A6D0C62149B3E3D00DB3EAA /* catch_test_case_registry_impl.hpp */,
|
||||
4AB1C73514F97BDA00F31DF7 /* catch_console_colour_impl.hpp */,
|
||||
@@ -379,7 +368,6 @@
|
||||
269831E519078C1600BB0CE0 /* catch_tostring.h */,
|
||||
269831E619078CA200BB0CE0 /* catch_tostring.hpp */,
|
||||
4A6D0C4D149B3E3D00DB3EAA /* catch_evaluate.hpp */,
|
||||
4A6D0C4F149B3E3D00DB3EAA /* catch_generators.hpp */,
|
||||
4A6D0C5C149B3E3D00DB3EAA /* catch_result_type.h */,
|
||||
4A6D0C5D149B3E3D00DB3EAA /* catch_assertionresult.h */,
|
||||
261488FE184DC32F0041FBEB /* catch_section.h */,
|
||||
@@ -412,7 +400,6 @@
|
||||
261488FA184C81130041FBEB /* catch_test_spec.hpp */,
|
||||
2656C21F1925E5100040DB02 /* catch_test_spec_parser.hpp */,
|
||||
4A6D0C4A149B3E3D00DB3EAA /* catch_config.hpp */,
|
||||
4A6D0C51149B3E3D00DB3EAA /* catch_context.h */,
|
||||
4A6D0C61149B3E3D00DB3EAA /* catch_test_case_info.h */,
|
||||
4A7ADB4314F631E10094FE10 /* catch_totals.hpp */,
|
||||
4AB77CB71553B72B00857BF0 /* catch_section_info.hpp */,
|
||||
@@ -440,10 +427,8 @@
|
||||
4A6D0C53149B3E3D00DB3EAA /* catch_interfaces_capture.h */,
|
||||
4A6D0C54149B3E3D00DB3EAA /* catch_interfaces_exception.h */,
|
||||
4A6D0C55149B3E3D00DB3EAA /* catch_interfaces_reporter.h */,
|
||||
4A6D0C56149B3E3D00DB3EAA /* catch_interfaces_runner.h */,
|
||||
4A6D0C57149B3E3D00DB3EAA /* catch_interfaces_testcase.h */,
|
||||
4AFC661D157E96A7009D58CF /* catch_interfaces_config.h */,
|
||||
4A90B59B15D0F61A00EF71BC /* catch_interfaces_generators.h */,
|
||||
26711C90195D46CD0033EDA2 /* catch_interfaces_tag_alias_registry.h */,
|
||||
);
|
||||
name = Interfaces;
|
||||
@@ -513,7 +498,7 @@
|
||||
4A6D0C17149B3D3B00DB3EAA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0710;
|
||||
LastUpgradeCheck = 0630;
|
||||
};
|
||||
buildConfigurationList = 4A6D0C1A149B3D3B00DB3EAA /* Build configuration list for PBXProject "CatchSelfTest" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
@@ -566,7 +551,6 @@
|
||||
4A45DA3316162047004F8D6B /* catch_interfaces_exception.cpp in Sources */,
|
||||
2691574C1A532A280054F1ED /* ToStringTuple.cpp in Sources */,
|
||||
26711C8F195D465C0033EDA2 /* TagAliasTests.cpp in Sources */,
|
||||
4A45DA3516162071004F8D6B /* catch_interfaces_runner.cpp in Sources */,
|
||||
4AB3D99D1616216500C9A0F8 /* catch_interfaces_testcase.cpp in Sources */,
|
||||
4AB3D9A01616219100C9A0F8 /* catch_interfaces_config.cpp in Sources */,
|
||||
4AB3D9A2161621B500C9A0F8 /* catch_interfaces_generators.cpp in Sources */,
|
||||
@@ -595,7 +579,6 @@
|
||||
CLANG_WARN__EXIT_TIME_DESTRUCTORS = NO;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user