Compare commits

...

32 Commits

Author SHA1 Message Date
Phil Nash
c984fc3ecd v1.4.0
- use __COUNTER__ for unique IDS instead of __LINE__ (where possible)
+ bug fixes
2016-03-15 07:24:26 +00:00
Phil Nash
447f53e9e3 Fixed !shouldfail 2016-03-14 19:13:34 +00:00
Phil Nash
13a887ad24 Use __COUNTER__ when generating unique names instead of __LINE__, if available.
Based on PR #351
2016-03-14 07:55:00 +00:00
Phil Nash
02af70ed0b build v1.3.6 (include's David Grayson's fix for the gcc pragma) 2016-03-11 18:31:52 +00:00
Phil Nash
c362894565 Merge branch 'DavidEGrayson-pr_gcc_pragma_typo' 2016-03-11 07:59:20 +00:00
David Grayson
97e335437e Fix CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS: GCC needs to be capitalized.
Fixes issue #600.
2016-03-04 19:24:10 -08:00
Phil Nash
ae5ee2cf63 v1.3.5 2016-02-29 08:17:18 +00:00
Phil Nash
f895e0d95f Rebased approvals following colour changes 2016-02-29 08:13:27 +00:00
Phil Nash
458f37ed57 Merge branch 'explicit-bool-conversion' of git://github.com/seanmiddleditch/Catch into seanmiddleditch-explicit-bool-conversion 2016-02-29 08:05:46 +00:00
Phil Nash
91bfe68a75 Suppress parentheses warnings on clang and gcc
- should address #593, #528, #521, #496 (and possibly others)
2016-02-29 08:03:48 +00:00
Phil Nash
8ccb18daa9 Added --use-colour option to give finer control over colourisation.
--force-colour is still present but deprecated (will remove in v2)
2016-02-29 08:03:48 +00:00
Phil Nash
dce2154474 Merge pull request #598 from luxe/patch-1
removes link to missing readme file
2016-02-27 17:06:57 +00:00
Trevor Hickey
e52ad48fb7 removes link to missing readme file 2016-02-26 10:29:23 -05:00
Sean Middleditch
776247af81 Support explicit operator bool
Fix for issue 596
2016-02-25 00:34:09 -08:00
Phil Nash
3b4edd7a48 Build for v1.3.4 2016-02-10 19:24:48 +00:00
Phil Nash
880a2046d9 Use Clara v0.0.1.1 2016-02-10 19:21:09 +00:00
Phil Nash
ffad3a0a39 Fix as suggested in #574
Cast expression to bool to prevent custom && from defeating short-circuiting
2016-02-10 05:49:56 +00:00
Phil Nash
3bd20bf2cd Removed reference to pre 1.0 release from README 2016-01-22 07:59:06 +00:00
Phil Nash
c7243562b0 v1.3.3 2016-01-22 07:59:06 +00:00
Phil Nash
b84e08ad6f Fix EndsWith Matcher (and refactored EndsWith and StartsWith in terms of endsWith and startsWith) (see Issue #573) 2016-01-22 07:59:06 +00:00
Phil Nash
aca16a0f99 Fixed CATCH_REGISTER_TEST_CASE too 2016-01-22 07:50:10 +00:00
Phil Nash
f294c98472 Fixed REGISTER_TEST_CASE for VS2013 (hopefully)
- see #549
2016-01-05 08:19:16 +00:00
Phil Nash
7424b23bfb v1.3.1 2015-12-28 15:07:32 +00:00
Phil Nash
dbd3a84d92 Fixed catch_with_main.hpp (no longer references deleted catch_runner.hpp) 2015-12-28 15:06:04 +00:00
Phil Nash
5262e61e9d Approvals for Matcher change (added comma) 2015-12-10 18:43:29 +00:00
Simon Warta
a5fba672e1 Add missing comma when in captured expression for matchers
Such that
CHECK_THAT( hex_encode(outbuf) Equals("B5D4045C") )
becomes
CHECK_THAT( hex_encode(outbuf), Equals("B5D4045C") )
2015-12-10 08:09:10 +00:00
Phil Nash
2106d82881 Fixed non-variadic version of REGISTER_TEST_CASE 2015-12-09 18:24:29 +00:00
Phil Nash
981347b6e4 patch build to include last two fixes 2015-12-09 18:11:48 +00:00
Phil Nash
9e341231ba main takes args by non-const char*
- see #548
2015-12-09 06:22:15 +00:00
Phil Nash
2b688e1cef Initialise m_currentSortOrder
- as reported in #545
2015-12-09 06:15:52 +00:00
Phil Nash
84d1c080d6 Keep Xcode 7.1 happy 2015-12-04 10:21:07 +00:00
Phil Nash
722315a1f5 Removed some trailing whitespace 2015-12-04 10:20:33 +00:00
35 changed files with 1046 additions and 299 deletions

View File

@@ -1,12 +1,10 @@
![catch logo](catch-logo-small.png) ![catch logo](catch-logo-small.png)
*v1.3.0* *v1.4.0*
Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch)
[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>
<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? ## What's the Catch?
@@ -19,8 +17,6 @@ This documentation comprises these three parts:
* [Tutorial](docs/tutorial.md) - getting started * [Tutorial](docs/tutorial.md) - getting started
* [Reference section](docs/Readme.md) - all the details * [Reference section](docs/Readme.md) - all the details
The documentation will continue until morale improves
## More ## More
* Issues and bugs can be raised on the [Issue tracker on GitHub](https://github.com/philsquared/Catch/issues) * 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) * For discussion or questions please use [the dedicated Google Groups forum](https://groups.google.com/forum/?fromgroups#!forum/catch-forum)

View File

@@ -16,5 +16,4 @@ Before looking at this material be sure to read the [tutorial](tutorial.md)
Other Other
* [Why Catch?](why-catch.md) * [Why Catch?](why-catch.md)
* [What's changed](whats-changed.md)
* [Contributing](contributing.md) * [Contributing](contributing.md)

View File

@@ -1,24 +0,0 @@
## 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)

View File

@@ -99,7 +99,7 @@
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) #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_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_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
#define CATCH_REGISTER_TEST_CASE( ... ) INTERNAL_CATCH_REGISTER_TESTCASE( __VA_ARGS__ ) #define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __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_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__ ) #define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", __VA_ARGS__ )
@@ -168,7 +168,7 @@
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __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 METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
#define REGISTER_TEST_CASE( ... ) INTERNAL_CATCH_REGISTER_TESTCASE( __VA_ARGS__ ) #define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) #define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
#define FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", __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__ ) #define SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", __VA_ARGS__ )
@@ -176,7 +176,7 @@
#define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description ) #define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
#define TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description ) #define TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
#define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description ) #define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
#define REGISTER_TEST_CASE( ... ) INTERNAL_CATCH_REGISTER_TESTCASE( __VA_ARGS__ ) #define REGISTER_TEST_CASE( method, name, description ) INTERNAL_CATCH_REGISTER_TESTCASE( method, name, description )
#define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description ) #define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
#define FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", msg ) #define FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", msg )
#define SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", msg ) #define SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", msg )

View File

@@ -131,7 +131,7 @@ namespace Catch {
Catch::cout() << "For more detail usage please see the project docs\n" << std::endl; Catch::cout() << "For more detail usage please see the project docs\n" << std::endl;
} }
int applyCommandLine( int argc, char const* const argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) { int applyCommandLine( int argc, char const* argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
try { try {
m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail ); m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail );
m_unusedTokens = m_cli.parseInto( argc, argv, m_configData ); m_unusedTokens = m_cli.parseInto( argc, argv, m_configData );
@@ -158,13 +158,16 @@ namespace Catch {
m_config.reset(); m_config.reset();
} }
int run( int argc, char const* const argv[] ) { int run( int argc, char const* argv[] ) {
int returnCode = applyCommandLine( argc, argv ); int returnCode = applyCommandLine( argc, argv );
if( returnCode == 0 ) if( returnCode == 0 )
returnCode = run(); returnCode = run();
return returnCode; return returnCode;
} }
int run( int argc, char* argv[] ) {
return run( argc, const_cast<char const**>( argv ) );
}
int run() { int run() {
if( m_configData.showHelp ) if( m_configData.showHelp )

View File

@@ -8,8 +8,7 @@
#ifndef TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED #define TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED
#include "catch_runner.hpp" #define CATCH_CONFIG_MAIN
#include "catch.hpp" #include "catch.hpp"
#include "internal/catch_default_main.hpp"
#endif // TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED

View File

@@ -6,6 +6,8 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * 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 // Only use header guard if we are not using an outer namespace
#if !defined(TWOBLUECUBES_CLARA_H_INCLUDED) || defined(STITCH_CLARA_OPEN_NAMESPACE) #if !defined(TWOBLUECUBES_CLARA_H_INCLUDED) || defined(STITCH_CLARA_OPEN_NAMESPACE)
@@ -38,6 +40,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <sstream> #include <sstream>
#include <algorithm>
// Use optional outer namespace // Use optional outer namespace
#ifdef STITCH_TBC_TEXT_FORMAT_OUTER_NAMESPACE #ifdef STITCH_TBC_TEXT_FORMAT_OUTER_NAMESPACE
@@ -172,13 +175,171 @@ namespace Tbc {
#endif // TBC_TEXT_FORMAT_H_INCLUDED #endif // TBC_TEXT_FORMAT_H_INCLUDED
// ----------- end of #include from tbc_text_format.h ----------- // ----------- end of #include from tbc_text_format.h -----------
// ........... back in /Users/philnash/Dev/OSS/Clara/srcs/clara.h // ........... back in clara.h
#undef STITCH_TBC_TEXT_FORMAT_OPEN_NAMESPACE #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 <map>
#include <algorithm>
#include <stdexcept> #include <stdexcept>
#include <memory> #include <memory>
@@ -205,6 +366,9 @@ namespace Clara {
const unsigned int consoleWidth = 80; const unsigned int consoleWidth = 80;
#endif #endif
// Use this to try and stop compiler from warning about unreachable code
inline bool isTrue( bool value ) { return value; }
using namespace Tbc; using namespace Tbc;
inline bool startsWith( std::string const& str, std::string const& prefix ) { inline bool startsWith( std::string const& str, std::string const& prefix ) {
@@ -245,13 +409,14 @@ namespace Clara {
} }
template<typename T> template<typename T>
inline void convertInto( bool, T& ) { inline void convertInto( bool, T& ) {
if( isTrue( true ) )
throw std::runtime_error( "Invalid conversion" ); throw std::runtime_error( "Invalid conversion" );
} }
template<typename ConfigT> template<typename ConfigT>
struct IArgFunction { struct IArgFunction {
virtual ~IArgFunction() {} virtual ~IArgFunction() {}
# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS #ifdef CLARA_CONFIG_CPP11_GENERATED_METHODS
IArgFunction() = default; IArgFunction() = default;
IArgFunction( IArgFunction const& ) = default; IArgFunction( IArgFunction const& ) = default;
#endif #endif
@@ -264,11 +429,11 @@ namespace Clara {
template<typename ConfigT> template<typename ConfigT>
class BoundArgFunction { class BoundArgFunction {
public: public:
BoundArgFunction() : functionObj( CATCH_NULL ) {} BoundArgFunction() : functionObj( CLARA_NULL ) {}
BoundArgFunction( IArgFunction<ConfigT>* _functionObj ) : functionObj( _functionObj ) {} BoundArgFunction( IArgFunction<ConfigT>* _functionObj ) : functionObj( _functionObj ) {}
BoundArgFunction( BoundArgFunction const& other ) : functionObj( other.functionObj ? other.functionObj->clone() : CATCH_NULL ) {} BoundArgFunction( BoundArgFunction const& other ) : functionObj( other.functionObj ? other.functionObj->clone() : CLARA_NULL ) {}
BoundArgFunction& operator = ( BoundArgFunction const& other ) { BoundArgFunction& operator = ( BoundArgFunction const& other ) {
IArgFunction<ConfigT>* newFunctionObj = other.functionObj ? other.functionObj->clone() : CATCH_NULL; IArgFunction<ConfigT>* newFunctionObj = other.functionObj ? other.functionObj->clone() : CLARA_NULL;
delete functionObj; delete functionObj;
functionObj = newFunctionObj; functionObj = newFunctionObj;
return *this; return *this;
@@ -284,7 +449,7 @@ namespace Clara {
bool takesArg() const { return functionObj->takesArg(); } bool takesArg() const { return functionObj->takesArg(); }
bool isSet() const { bool isSet() const {
return functionObj != CATCH_NULL; return functionObj != CLARA_NULL;
} }
private: private:
IArgFunction<ConfigT>* functionObj; IArgFunction<ConfigT>* functionObj;
@@ -393,7 +558,7 @@ namespace Clara {
std::string data; 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 = "--"; const std::string doubleDash = "--";
for( int i = 1; i < argc && argv[i] != doubleDash; ++i ) for( int i = 1; i < argc && argv[i] != doubleDash; ++i )
parseIntoTokens( argv[i] , tokens); parseIntoTokens( argv[i] , tokens);
@@ -503,7 +668,7 @@ namespace Clara {
} }
}; };
typedef CATCH_AUTO_PTR( Arg ) ArgAutoPtr; typedef CLARA_AUTO_PTR( Arg ) ArgAutoPtr;
friend void addOptName( Arg& arg, std::string const& optName ) friend void addOptName( Arg& arg, std::string const& optName )
{ {
@@ -580,8 +745,8 @@ namespace Clara {
m_arg->description = description; m_arg->description = description;
return *this; return *this;
} }
ArgBuilder& detail( std::string const& _detail ) { ArgBuilder& detail( std::string const& detail ) {
m_arg->detail = _detail; m_arg->detail = detail;
return *this; return *this;
} }
@@ -665,14 +830,14 @@ namespace Clara {
maxWidth = (std::max)( maxWidth, it->commands().size() ); maxWidth = (std::max)( maxWidth, it->commands().size() );
for( it = itBegin; it != itEnd; ++it ) { for( it = itBegin; it != itEnd; ++it ) {
Detail::Text usageText( it->commands(), Detail::TextAttributes() Detail::Text usage( it->commands(), Detail::TextAttributes()
.setWidth( maxWidth+indent ) .setWidth( maxWidth+indent )
.setIndent( indent ) ); .setIndent( indent ) );
Detail::Text desc( it->description, Detail::TextAttributes() Detail::Text desc( it->description, Detail::TextAttributes()
.setWidth( width - maxWidth - 3 ) ); .setWidth( width - maxWidth - 3 ) );
for( std::size_t i = 0; i < (std::max)( usageText.size(), desc.size() ); ++i ) { for( std::size_t i = 0; i < (std::max)( usage.size(), desc.size() ); ++i ) {
std::string usageCol = i < usageText.size() ? usageText[i] : ""; std::string usageCol = i < usage.size() ? usage[i] : "";
os << usageCol; os << usageCol;
if( i < desc.size() && !desc[i].empty() ) if( i < desc.size() && !desc[i].empty() )
@@ -729,13 +894,13 @@ namespace Clara {
return oss.str(); return oss.str();
} }
ConfigT parse( int argc, char const * const * argv ) const { ConfigT parse( int argc, char const* const argv[] ) const {
ConfigT config; ConfigT config;
parseInto( argc, argv, config ); parseInto( argc, argv, config );
return config; return config;
} }
std::vector<Parser::Token> parseInto( int argc, char const * const * argv, ConfigT& config ) const { std::vector<Parser::Token> parseInto( int argc, char const* argv[], ConfigT& config ) const {
std::string processName = argv[0]; std::string processName = argv[0];
std::size_t lastSlash = processName.find_last_of( "/\\" ); std::size_t lastSlash = processName.find_last_of( "/\\" );
if( lastSlash != std::string::npos ) if( lastSlash != std::string::npos )

View File

@@ -33,13 +33,14 @@
do { \ do { \
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
try { \ try { \
CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
( __catchResult <= expr ).endExpression(); \ ( __catchResult <= expr ).endExpression(); \
} \ } \
catch( ... ) { \ catch( ... ) { \
__catchResult.useActiveException( Catch::ResultDisposition::Normal ); \ __catchResult.useActiveException( Catch::ResultDisposition::Normal ); \
} \ } \
INTERNAL_CATCH_REACT( __catchResult ) \ INTERNAL_CATCH_REACT( __catchResult ) \
} while( Catch::isTrue( false && (expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look } 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
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \ #define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \
@@ -129,7 +130,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CHECK_THAT( arg, matcher, resultDisposition, macroName ) \ #define INTERNAL_CHECK_THAT( arg, matcher, resultDisposition, macroName ) \
do { \ do { \
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #arg " " #matcher, resultDisposition ); \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #arg ", " #matcher, resultDisposition ); \
try { \ try { \
std::string matcherAsString = (matcher).toString(); \ std::string matcherAsString = (matcher).toString(); \
__catchResult \ __catchResult \

View File

@@ -62,6 +62,21 @@ namespace Catch {
? ShowDurations::Always ? ShowDurations::Always
: ShowDurations::Never; : 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 ) { inline void loadTestNamesFromFile( ConfigData& config, std::string const& _filename ) {
std::ifstream f( _filename.c_str() ); std::ifstream f( _filename.c_str() );
if( !f.is_open() ) if( !f.is_open() )
@@ -148,7 +163,7 @@ namespace Catch {
cli["-d"]["--durations"] cli["-d"]["--durations"]
.describe( "show test durations" ) .describe( "show test durations" )
.bind( &setShowDurations, "yes/no" ); .bind( &setShowDurations, "yes|no" );
cli["-f"]["--input-file"] cli["-f"]["--input-file"]
.describe( "load test names to run from a file" ) .describe( "load test names to run from a file" )
@@ -176,8 +191,12 @@ namespace Catch {
.bind( &setRngSeed, "'time'|number" ); .bind( &setRngSeed, "'time'|number" );
cli["--force-colour"] cli["--force-colour"]
.describe( "force colourised output" ) .describe( "force colourised output (deprecated)" )
.bind( &ConfigData::forceColour ); .bind( &forceColour );
cli["--use-colour"]
.describe( "should output be colourised" )
.bind( &setUseColour, "yes|no" );
return cli; return cli;
} }

View File

@@ -10,7 +10,11 @@
#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line #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_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( 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__ ) # define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
#endif
#define INTERNAL_CATCH_STRINGIFY2( expr ) #expr #define INTERNAL_CATCH_STRINGIFY2( expr ) #expr
#define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr ) #define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr )

View File

@@ -23,7 +23,7 @@
// CATCH_CONFIG_CPP11_OR_GREATER : Is C++11 supported? // CATCH_CONFIG_CPP11_OR_GREATER : Is C++11 supported?
// CATCH_CONFIG_VARIADIC_MACROS : are variadic macros 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 // Note to maintainers: if new toggles are added please document them
// in configuration.md, too // in configuration.md, too
@@ -36,6 +36,10 @@
// All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11 // 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__ #ifdef __clang__
# if __has_feature(cxx_nullptr) # if __has_feature(cxx_nullptr)
@@ -46,6 +50,10 @@
# define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT # define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
# endif # endif
# if defined(CATCH_CPP11_OR_GREATER)
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS _Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
# endif
#endif // __clang__ #endif // __clang__
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -77,6 +85,10 @@
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR # define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
# endif # 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
// - otherwise more recent versions define __cplusplus >= 201103L // - otherwise more recent versions define __cplusplus >= 201103L
// and will get picked up below // and will get picked up below
@@ -111,13 +123,20 @@
#endif #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 // C++ language feature support
// catch all support for C++11 // catch all support for C++11
#if defined(__cplusplus) && __cplusplus >= 201103L #if defined(CATCH_CPP11_OR_GREATER)
# define CATCH_CPP11_OR_GREATER
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR) # if !defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR)
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR # define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
@@ -185,7 +204,13 @@
#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) #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 # define CATCH_CONFIG_CPP11_UNIQUE_PTR
#endif #endif
#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
# define CATCH_CONFIG_COUNTER
#endif
#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
#endif
// noexcept support: // noexcept support:
#if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT) #if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT)

View File

@@ -37,14 +37,14 @@ namespace Catch {
noThrow( false ), noThrow( false ),
showHelp( false ), showHelp( false ),
showInvisibles( false ), showInvisibles( false ),
forceColour( false ),
filenamesAsTags( false ), filenamesAsTags( false ),
abortAfter( -1 ), abortAfter( -1 ),
rngSeed( 0 ), rngSeed( 0 ),
verbosity( Verbosity::Normal ), verbosity( Verbosity::Normal ),
warnings( WarnAbout::Nothing ), warnings( WarnAbout::Nothing ),
showDurations( ShowDurations::DefaultForReporter ), showDurations( ShowDurations::DefaultForReporter ),
runOrder( RunTests::InDeclarationOrder ) runOrder( RunTests::InDeclarationOrder ),
useColour( UseColour::Auto )
{} {}
bool listTests; bool listTests;
@@ -57,7 +57,6 @@ namespace Catch {
bool noThrow; bool noThrow;
bool showHelp; bool showHelp;
bool showInvisibles; bool showInvisibles;
bool forceColour;
bool filenamesAsTags; bool filenamesAsTags;
int abortAfter; int abortAfter;
@@ -67,6 +66,7 @@ namespace Catch {
WarnAbout::What warnings; WarnAbout::What warnings;
ShowDurations::OrNot showDurations; ShowDurations::OrNot showDurations;
RunTests::InWhatOrder runOrder; RunTests::InWhatOrder runOrder;
UseColour::YesOrNo useColour;
std::string outputFilename; std::string outputFilename;
std::string name; std::string name;
@@ -133,7 +133,7 @@ namespace Catch {
virtual ShowDurations::OrNot showDurations() const { return m_data.showDurations; } virtual ShowDurations::OrNot showDurations() const { return m_data.showDurations; }
virtual RunTests::InWhatOrder runOrder() const { return m_data.runOrder; } virtual RunTests::InWhatOrder runOrder() const { return m_data.runOrder; }
virtual unsigned int rngSeed() const { return m_data.rngSeed; } virtual unsigned int rngSeed() const { return m_data.rngSeed; }
virtual bool forceColour() const { return m_data.forceColour; } virtual UseColour::YesOrNo useColour() const { return m_data.useColour; }
private: private:

View File

@@ -95,7 +95,18 @@ namespace {
IColourImpl* platformColourInstance() { IColourImpl* platformColourInstance() {
static Win32ColourImpl s_instance; static Win32ColourImpl s_instance;
return &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();
} }
} // end anon namespace } // end anon namespace
@@ -146,7 +157,14 @@ namespace {
IColourImpl* platformColourInstance() { IColourImpl* platformColourInstance() {
Ptr<IConfig const> config = getCurrentContext().getConfig(); Ptr<IConfig const> config = getCurrentContext().getConfig();
return (config && config->forceColour()) || isatty(STDOUT_FILENO) 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
? PosixColourImpl::instance() ? PosixColourImpl::instance()
: NoColourImpl::instance(); : NoColourImpl::instance();
} }
@@ -171,9 +189,7 @@ namespace Catch {
Colour::~Colour(){ if( !m_moved ) use( None ); } Colour::~Colour(){ if( !m_moved ) use( None ); }
void Colour::use( Code _colourCode ) { void Colour::use( Code _colourCode ) {
static IColourImpl* impl = isDebuggerActive() static IColourImpl* impl = platformColourInstance();
? NoColourImpl::instance()
: platformColourInstance();
impl->use( _colourCode ); impl->use( _colourCode );
} }

View File

@@ -11,7 +11,7 @@
#ifndef __OBJC__ #ifndef __OBJC__
// Standard C/C++ main entry point // Standard C/C++ main entry point
int main (int argc, char * const argv[]) { int main (int argc, char * argv[]) {
return Catch::Session().run( argc, argv ); return Catch::Session().run( argc, argv );
} }

View File

@@ -52,37 +52,37 @@ namespace Internal {
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsEqualTo> { struct Evaluator<T1, T2, IsEqualTo> {
static bool evaluate( T1 const& lhs, T2 const& rhs) { static bool evaluate( T1 const& lhs, T2 const& rhs) {
return opCast( lhs ) == opCast( rhs ); return bool( opCast( lhs ) == opCast( rhs ) );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsNotEqualTo> { struct Evaluator<T1, T2, IsNotEqualTo> {
static bool evaluate( T1 const& lhs, T2 const& rhs ) { static bool evaluate( T1 const& lhs, T2 const& rhs ) {
return opCast( lhs ) != opCast( rhs ); return bool( opCast( lhs ) != opCast( rhs ) );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsLessThan> { struct Evaluator<T1, T2, IsLessThan> {
static bool evaluate( T1 const& lhs, T2 const& rhs ) { static bool evaluate( T1 const& lhs, T2 const& rhs ) {
return opCast( lhs ) < opCast( rhs ); return bool( opCast( lhs ) < opCast( rhs ) );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsGreaterThan> { struct Evaluator<T1, T2, IsGreaterThan> {
static bool evaluate( T1 const& lhs, T2 const& rhs ) { static bool evaluate( T1 const& lhs, T2 const& rhs ) {
return opCast( lhs ) > opCast( rhs ); return bool( opCast( lhs ) > opCast( rhs ) );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> { struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> {
static bool evaluate( T1 const& lhs, T2 const& rhs ) { static bool evaluate( T1 const& lhs, T2 const& rhs ) {
return opCast( lhs ) >= opCast( rhs ); return bool( opCast( lhs ) >= opCast( rhs ) );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsLessThanOrEqualTo> { struct Evaluator<T1, T2, IsLessThanOrEqualTo> {
static bool evaluate( T1 const& lhs, T2 const& rhs ) { static bool evaluate( T1 const& lhs, T2 const& rhs ) {
return opCast( lhs ) <= opCast( rhs ); return bool( opCast( lhs ) <= opCast( rhs ) );
} }
}; };

View File

@@ -37,6 +37,11 @@ namespace Catch {
InLexicographicalOrder, InLexicographicalOrder,
InRandomOrder InRandomOrder
}; }; }; };
struct UseColour { enum YesOrNo {
Auto,
Yes,
No
}; };
class TestSpec; class TestSpec;
@@ -56,7 +61,7 @@ namespace Catch {
virtual TestSpec const& testSpec() const = 0; virtual TestSpec const& testSpec() const = 0;
virtual RunTests::InWhatOrder runOrder() const = 0; virtual RunTests::InWhatOrder runOrder() const = 0;
virtual unsigned int rngSeed() const = 0; virtual unsigned int rngSeed() const = 0;
virtual bool forceColour() const = 0; virtual UseColour::YesOrNo useColour() const = 0;
}; };
} }

View File

@@ -66,9 +66,11 @@ namespace Catch {
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) \ #define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \
static std::string INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator )( signature ); \ static std::string translatorName( signature ); \
namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ) ); }\ namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); }\
static std::string INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator )( signature ) 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 #endif // TWOBLUECUBES_CATCH_INTERFACES_EXCEPTION_H_INCLUDED

View File

@@ -234,7 +234,7 @@ namespace Matchers {
virtual ~StartsWith(); virtual ~StartsWith();
virtual bool match( std::string const& expr ) const { virtual bool match( std::string const& expr ) const {
return m_data.adjustString( expr ).find( m_data.m_str ) == 0; return startsWith( m_data.adjustString( expr ), m_data.m_str );
} }
virtual std::string toString() const { virtual std::string toString() const {
return "starts with: \"" + m_data.m_str + "\"" + m_data.toStringSuffix(); return "starts with: \"" + m_data.m_str + "\"" + m_data.toStringSuffix();
@@ -251,7 +251,7 @@ namespace Matchers {
virtual ~EndsWith(); virtual ~EndsWith();
virtual bool match( std::string const& expr ) const { virtual bool match( std::string const& expr ) const {
return m_data.adjustString( expr ).find( m_data.m_str ) == expr.size() - m_data.m_str.size(); return endsWith( m_data.adjustString( expr ), m_data.m_str );
} }
virtual std::string toString() const { virtual std::string toString() const {
return "ends with: \"" + m_data.m_str + "\"" + m_data.toStringSuffix(); return "ends with: \"" + m_data.m_str + "\"" + m_data.toStringSuffix();

View File

@@ -109,6 +109,11 @@ namespace Catch {
while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() ); while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() );
Totals deltaTotals = m_totals.delta( prevTotals ); Totals deltaTotals = m_totals.delta( prevTotals );
if( testInfo.expectedToFail() && deltaTotals.testCases.passed > 0 ) {
deltaTotals.assertions.failed++;
deltaTotals.testCases.passed--;
deltaTotals.testCases.failed++;
}
m_totals.testCases += deltaTotals.testCases; m_totals.testCases += deltaTotals.testCases;
m_reporter->testCaseEnded( TestCaseStats( testInfo, m_reporter->testCaseEnded( TestCaseStats( testInfo,
deltaTotals, deltaTotals,

View File

@@ -87,7 +87,10 @@ namespace Catch {
class TestRegistry : public ITestCaseRegistry { class TestRegistry : public ITestCaseRegistry {
public: public:
TestRegistry() : m_unnamedCount( 0 ) {} TestRegistry()
: m_currentSortOrder( RunTests::InDeclarationOrder ),
m_unnamedCount( 0 )
{}
virtual ~TestRegistry(); virtual ~TestRegistry();
virtual void registerTest( TestCase const& testCase ) { virtual void registerTest( TestCase const& testCase ) {

View File

@@ -85,24 +85,28 @@ void registerTestCaseFunction
#ifdef CATCH_CONFIG_VARIADIC_MACROS #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( ... ) \ #define INTERNAL_CATCH_TESTCASE( ... ) \
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__ )
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____ )()
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ #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 ); } 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{ \ namespace{ \
struct INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) : ClassName{ \ struct TestName : ClassName{ \
void test(); \ 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, ... ) \ #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
@@ -110,24 +114,28 @@ void registerTestCaseFunction
#else #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 ) \ #define INTERNAL_CATCH_TESTCASE( 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 )
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____ )()
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, 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 ); } 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{ \ namespace{ \
struct INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) : ClassName{ \ struct TestCaseName : ClassName{ \
void test(); \ 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 ) \ #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, Name, Desc ) \

View File

@@ -37,7 +37,7 @@ namespace Catch {
return os; return os;
} }
Version libraryVersion( 1, 3, 0, "", 0 ); Version libraryVersion( 1, 4, 0, "", 0 );
} }

View File

@@ -349,7 +349,7 @@ namespace Catch {
if( totals.testCases.total() == 0 ) { if( totals.testCases.total() == 0 ) {
stream << Colour( Colour::Warning ) << "No tests ran\n"; stream << Colour( Colour::Warning ) << "No tests ran\n";
} }
else if( totals.assertions.total() > 0 && totals.assertions.allPassed() ) { else if( totals.assertions.total() > 0 && totals.testCases.allPassed() ) {
stream << Colour( Colour::ResultSuccess ) << "All tests passed"; stream << Colour( Colour::ResultSuccess ) << "All tests passed";
stream << " (" stream << " ("
<< pluralise( totals.assertions.passed, "assertion" ) << " in " << pluralise( totals.assertions.passed, "assertion" ) << " in "

View File

@@ -680,7 +680,7 @@ MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>: FAILED: MiscTests.cpp:<line number>: FAILED:
CHECK_THAT( testStringForMatching() Contains( "not there" ) ) CHECK_THAT( testStringForMatching(), Contains( "not there" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" contains: "not there" "this string contains 'abc' as a substring" contains: "not there"
@@ -691,7 +691,7 @@ MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>: FAILED: MiscTests.cpp:<line number>: FAILED:
CHECK_THAT( testStringForMatching() StartsWith( "string" ) ) CHECK_THAT( testStringForMatching(), StartsWith( "string" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" starts with: "string" "this string contains 'abc' as a substring" starts with: "string"
@@ -702,7 +702,7 @@ MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>: FAILED: MiscTests.cpp:<line number>: FAILED:
CHECK_THAT( testStringForMatching() EndsWith( "this" ) ) CHECK_THAT( testStringForMatching(), EndsWith( "this" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" ends with: "this" "this string contains 'abc' as a substring" ends with: "this"
@@ -713,7 +713,7 @@ MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>: FAILED: MiscTests.cpp:<line number>: FAILED:
CHECK_THAT( testStringForMatching() Equals( "something else" ) ) CHECK_THAT( testStringForMatching(), Equals( "something else" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" equals: "something else" "this string contains 'abc' as a substring" equals: "something else"
@@ -724,7 +724,7 @@ MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>: FAILED: MiscTests.cpp:<line number>: FAILED:
CHECK_THAT( testStringForMatching() ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) ) CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" ( ( contains: "string" or "this string contains 'abc' as a substring" ( ( contains: "string" or
contains: "different" ) and contains: "random" ) contains: "different" ) and contains: "random" )
@@ -736,7 +736,7 @@ MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>: FAILED: MiscTests.cpp:<line number>: FAILED:
CHECK_THAT( testStringForMatching() !Contains( "substring" ) ) CHECK_THAT( testStringForMatching(), !Contains( "substring" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" not contains: "substring" "this string contains 'abc' as a substring" not contains: "substring"
@@ -830,6 +830,6 @@ with expansion:
"first" == "second" "first" == "second"
=============================================================================== ===============================================================================
test cases: 167 | 124 passed | 42 failed | 1 failed as expected test cases: 168 | 124 passed | 42 failed | 2 failed as expected
assertions: 914 | 818 passed | 83 failed | 13 failed as expected assertions: 920 | 824 passed | 78 failed | 18 failed as expected

View File

@@ -3304,25 +3304,25 @@ MiscTests.cpp:<line number>
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
REQUIRE_THAT( testStringForMatching() Contains( "string" ) ) REQUIRE_THAT( testStringForMatching(), Contains( "string" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" contains: "string" "this string contains 'abc' as a substring" contains: "string"
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( testStringForMatching() Contains( "abc" ) ) CHECK_THAT( testStringForMatching(), Contains( "abc" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" contains: "abc" "this string contains 'abc' as a substring" contains: "abc"
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( testStringForMatching() StartsWith( "this" ) ) CHECK_THAT( testStringForMatching(), StartsWith( "this" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" starts with: "this" "this string contains 'abc' as a substring" starts with: "this"
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( testStringForMatching() EndsWith( "substring" ) ) CHECK_THAT( testStringForMatching(), EndsWith( "substring" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" ends with: "substring" "this string contains 'abc' as a substring" ends with: "substring"
@@ -3333,7 +3333,7 @@ MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>: FAILED: MiscTests.cpp:<line number>: FAILED:
CHECK_THAT( testStringForMatching() Contains( "not there" ) ) CHECK_THAT( testStringForMatching(), Contains( "not there" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" contains: "not there" "this string contains 'abc' as a substring" contains: "not there"
@@ -3344,7 +3344,7 @@ MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>: FAILED: MiscTests.cpp:<line number>: FAILED:
CHECK_THAT( testStringForMatching() StartsWith( "string" ) ) CHECK_THAT( testStringForMatching(), StartsWith( "string" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" starts with: "string" "this string contains 'abc' as a substring" starts with: "string"
@@ -3355,7 +3355,7 @@ MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>: FAILED: MiscTests.cpp:<line number>: FAILED:
CHECK_THAT( testStringForMatching() EndsWith( "this" ) ) CHECK_THAT( testStringForMatching(), EndsWith( "this" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" ends with: "this" "this string contains 'abc' as a substring" ends with: "this"
@@ -3366,7 +3366,7 @@ MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>: FAILED: MiscTests.cpp:<line number>: FAILED:
CHECK_THAT( testStringForMatching() Equals( "something else" ) ) CHECK_THAT( testStringForMatching(), Equals( "something else" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" equals: "something else" "this string contains 'abc' as a substring" equals: "something else"
@@ -3378,7 +3378,7 @@ MiscTests.cpp:<line number>
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
REQUIRE_THAT( "" Equals(nullptr) ) REQUIRE_THAT( "", Equals(nullptr) )
with expansion: with expansion:
"" equals: "" "" equals: ""
@@ -3390,7 +3390,7 @@ MiscTests.cpp:<line number>
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( testStringForMatching() AllOf( Catch::Contains( "string" ), Catch::Contains( "abc" ) ) ) CHECK_THAT( testStringForMatching(), AllOf( Catch::Contains( "string" ), Catch::Contains( "abc" ) ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" ( contains: "string" and "this string contains 'abc' as a substring" ( contains: "string" and
contains: "abc" ) contains: "abc" )
@@ -3403,14 +3403,14 @@ MiscTests.cpp:<line number>
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( testStringForMatching() AnyOf( Catch::Contains( "string" ), Catch::Contains( "not there" ) ) ) CHECK_THAT( testStringForMatching(), AnyOf( Catch::Contains( "string" ), Catch::Contains( "not there" ) ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" ( contains: "string" or contains: "this string contains 'abc' as a substring" ( contains: "string" or contains:
"not there" ) "not there" )
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( testStringForMatching() AnyOf( Catch::Contains( "not there" ), Catch::Contains( "string" ) ) ) CHECK_THAT( testStringForMatching(), AnyOf( Catch::Contains( "not there" ), Catch::Contains( "string" ) ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" ( contains: "not there" or "this string contains 'abc' as a substring" ( contains: "not there" or
contains: "string" ) contains: "string" )
@@ -3423,7 +3423,7 @@ MiscTests.cpp:<line number>
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( testStringForMatching() Equals( "this string contains 'abc' as a substring" ) ) CHECK_THAT( testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" equals: "this string contains "this string contains 'abc' as a substring" equals: "this string contains
'abc' as a substring" 'abc' as a substring"
@@ -3436,7 +3436,7 @@ MiscTests.cpp:<line number>
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( testStringForMatching() Contains( "string" ) && Contains( "abc" ) && Contains( "substring" ) && Contains( "contains" ) ) CHECK_THAT( testStringForMatching(), Contains( "string" ) && Contains( "abc" ) && Contains( "substring" ) && Contains( "contains" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" ( contains: "string" and "this string contains 'abc' as a substring" ( contains: "string" and
contains: "abc" and contains: "substring" and contains: "contains" ) contains: "abc" and contains: "substring" and contains: "contains" )
@@ -3449,14 +3449,14 @@ MiscTests.cpp:<line number>
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( testStringForMatching() Contains( "string" ) || Contains( "different" ) || Contains( "random" ) ) CHECK_THAT( testStringForMatching(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" ( contains: "string" or contains: "this string contains 'abc' as a substring" ( contains: "string" or contains:
"different" or contains: "random" ) "different" or contains: "random" )
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( testStringForMatching2() Contains( "string" ) || Contains( "different" ) || Contains( "random" ) ) CHECK_THAT( testStringForMatching2(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) )
with expansion: with expansion:
"some completely different text that contains one common word" ( contains: "some completely different text that contains one common word" ( contains:
"string" or contains: "different" or contains: "random" ) "string" or contains: "different" or contains: "random" )
@@ -3469,7 +3469,7 @@ MiscTests.cpp:<line number>
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( testStringForMatching() ( Contains( "string" ) || Contains( "different" ) ) && Contains( "substring" ) ) CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "substring" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" ( ( contains: "string" or "this string contains 'abc' as a substring" ( ( contains: "string" or
contains: "different" ) and contains: "substring" ) contains: "different" ) and contains: "substring" )
@@ -3481,7 +3481,7 @@ MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>: FAILED: MiscTests.cpp:<line number>: FAILED:
CHECK_THAT( testStringForMatching() ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) ) CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" ( ( contains: "string" or "this string contains 'abc' as a substring" ( ( contains: "string" or
contains: "different" ) and contains: "random" ) contains: "different" ) and contains: "random" )
@@ -3494,7 +3494,7 @@ MiscTests.cpp:<line number>
MiscTests.cpp:<line number>: MiscTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( testStringForMatching() !Contains( "different" ) ) CHECK_THAT( testStringForMatching(), !Contains( "different" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" not contains: "different" "this string contains 'abc' as a substring" not contains: "different"
@@ -3505,7 +3505,7 @@ MiscTests.cpp:<line number>
............................................................................... ...............................................................................
MiscTests.cpp:<line number>: FAILED: MiscTests.cpp:<line number>: FAILED:
CHECK_THAT( testStringForMatching() !Contains( "substring" ) ) CHECK_THAT( testStringForMatching(), !Contains( "substring" ) )
with expansion: with expansion:
"this string contains 'abc' as a substring" not contains: "substring" "this string contains 'abc' as a substring" not contains: "substring"
@@ -3951,6 +3951,17 @@ with expansion:
== ==
9223372036854775807 (0x<hex digits>) 9223372036854775807 (0x<hex digits>)
-------------------------------------------------------------------------------
This test 'should' fail but doesn't
-------------------------------------------------------------------------------
MiscTests.cpp:<line number>
...............................................................................
MiscTests.cpp:<line number>:
PASSED:
with message:
oops!
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Process can be configured on command line Process can be configured on command line
default - no arguments default - no arguments
@@ -4224,7 +4235,7 @@ TestMain.cpp:<line number>
TestMain.cpp:<line number>: TestMain.cpp:<line number>:
PASSED: PASSED:
REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ) Contains( "greater than zero" ) ) REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ), Contains( "greater than zero" ) )
with expansion: with expansion:
"Value after -x or --abortAfter must be greater than zero "Value after -x or --abortAfter must be greater than zero
- while parsing: (-x, --abortx <no. failures>)" contains: "greater than zero" - while parsing: (-x, --abortx <no. failures>)" contains: "greater than zero"
@@ -4239,7 +4250,7 @@ TestMain.cpp:<line number>
TestMain.cpp:<line number>: TestMain.cpp:<line number>:
PASSED: PASSED:
REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ) Contains( "-x" ) ) REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ), Contains( "-x" ) )
with expansion: with expansion:
"Unable to convert oops to destination type "Unable to convert oops to destination type
- while parsing: (-x, --abortx <no. failures>)" contains: "-x" - while parsing: (-x, --abortx <no. failures>)" contains: "-x"
@@ -4348,8 +4359,8 @@ with expansion:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Process can be configured on command line Process can be configured on command line
force-colour use-colour
--force-colour without option
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
TestMain.cpp:<line number> TestMain.cpp:<line number>
............................................................................... ...............................................................................
@@ -4360,14 +4371,14 @@ PASSED:
TestMain.cpp:<line number>: TestMain.cpp:<line number>:
PASSED: PASSED:
REQUIRE( config.forceColour ) REQUIRE( config.useColour == UseColour::Auto )
with expansion: with expansion:
true 0 == 0
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Process can be configured on command line Process can be configured on command line
force-colour use-colour
without --force-colour auto
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
TestMain.cpp:<line number> TestMain.cpp:<line number>
............................................................................... ...............................................................................
@@ -4378,9 +4389,57 @@ PASSED:
TestMain.cpp:<line number>: TestMain.cpp:<line number>:
PASSED: PASSED:
REQUIRE( !config.forceColour ) REQUIRE( config.useColour == UseColour::Auto )
with expansion: with expansion:
true 0 == 0
-------------------------------------------------------------------------------
Process can be configured on command line
use-colour
yes
-------------------------------------------------------------------------------
TestMain.cpp:<line number>
...............................................................................
TestMain.cpp:<line number>:
PASSED:
CHECK_NOTHROW( parseIntoConfig( argv, config ) )
TestMain.cpp:<line number>:
PASSED:
REQUIRE( config.useColour == UseColour::Yes )
with expansion:
1 == 1
-------------------------------------------------------------------------------
Process can be configured on command line
use-colour
no
-------------------------------------------------------------------------------
TestMain.cpp:<line number>
...............................................................................
TestMain.cpp:<line number>:
PASSED:
CHECK_NOTHROW( parseIntoConfig( argv, config ) )
TestMain.cpp:<line number>:
PASSED:
REQUIRE( config.useColour == UseColour::No )
with expansion:
2 == 2
-------------------------------------------------------------------------------
Process can be configured on command line
use-colour
error
-------------------------------------------------------------------------------
TestMain.cpp:<line number>
...............................................................................
TestMain.cpp:<line number>:
PASSED:
REQUIRE_THROWS_WITH( parseIntoConfig( argv, config ), Contains( "colour mode must be one of" ) )
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Long strings can be wrapped Long strings can be wrapped
@@ -5000,7 +5059,7 @@ TestMain.cpp:<line number>
TestMain.cpp:<line number>: TestMain.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( t.toString() EndsWith( "... message truncated due to excessive size" ) ) CHECK_THAT( t.toString(), EndsWith( "... message truncated due to excessive size" ) )
with expansion: with expansion:
"***************************************************************************- "***************************************************************************-
***- ***-
@@ -8783,7 +8842,7 @@ TagAliasTests.cpp:<line number>
TagAliasTests.cpp:<line number>: TagAliasTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( what Contains( "[@zzz]" ) ) CHECK_THAT( what, Contains( "[@zzz]" ) )
with expansion: with expansion:
"error: tag alias, "[@zzz]" already registered. "error: tag alias, "[@zzz]" already registered.
First seen at file:2 First seen at file:2
@@ -8792,7 +8851,7 @@ with expansion:
TagAliasTests.cpp:<line number>: TagAliasTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( what Contains( "file" ) ) CHECK_THAT( what, Contains( "file" ) )
with expansion: with expansion:
"error: tag alias, "[@zzz]" already registered. "error: tag alias, "[@zzz]" already registered.
First seen at file:2 First seen at file:2
@@ -8801,7 +8860,7 @@ with expansion:
TagAliasTests.cpp:<line number>: TagAliasTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( what Contains( "2" ) ) CHECK_THAT( what, Contains( "2" ) )
with expansion: with expansion:
"error: tag alias, "[@zzz]" already registered. "error: tag alias, "[@zzz]" already registered.
First seen at file:2 First seen at file:2
@@ -8810,7 +8869,7 @@ with expansion:
TagAliasTests.cpp:<line number>: TagAliasTests.cpp:<line number>:
PASSED: PASSED:
CHECK_THAT( what Contains( "10" ) ) CHECK_THAT( what, Contains( "10" ) )
with expansion: with expansion:
"error: tag alias, "[@zzz]" already registered. "error: tag alias, "[@zzz]" already registered.
First seen at file:2 First seen at file:2
@@ -9045,6 +9104,6 @@ with expansion:
1 > 0 1 > 0
=============================================================================== ===============================================================================
test cases: 167 | 123 passed | 43 failed | 1 failed as expected test cases: 168 | 123 passed | 43 failed | 2 failed as expected
assertions: 916 | 818 passed | 85 failed | 13 failed as expected assertions: 922 | 824 passed | 80 failed | 18 failed as expected

View File

@@ -485,7 +485,131 @@ ConditionTests.cpp:<line number>: FAILED:
with expansion: with expansion:
9.1f != Approx( 9.1000003815 ) 9.1f != Approx( 9.1000003815 )
=============================================================================== -------------------------------------------------------------------------------
test cases: 19 | 15 passed | 3 failed | 1 failed as expected Ordering comparison checks that should succeed
assertions: 62 | 56 passed | 4 failed | 2 failed as expected -------------------------------------------------------------------------------
ConditionTests.cpp:<line number>
...............................................................................
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.int_seven < 8 )
with expansion:
7 < 8
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.int_seven > 6 )
with expansion:
7 > 6
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.int_seven > 0 )
with expansion:
7 > 0
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.int_seven > -1 )
with expansion:
7 > -1
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.int_seven >= 7 )
with expansion:
7 >= 7
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.int_seven >= 6 )
with expansion:
7 >= 6
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.int_seven <= 7 )
with expansion:
7 <= 7
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.int_seven <= 8 )
with expansion:
7 <= 8
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.float_nine_point_one > 9 )
with expansion:
9.1f > 9
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.float_nine_point_one < 10 )
with expansion:
9.1f < 10
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.float_nine_point_one < 9.2 )
with expansion:
9.1f < 9.2
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.str_hello <= "hello" )
with expansion:
"hello" <= "hello"
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.str_hello >= "hello" )
with expansion:
"hello" >= "hello"
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.str_hello < "hellp" )
with expansion:
"hello" < "hellp"
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.str_hello < "zebra" )
with expansion:
"hello" < "zebra"
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.str_hello > "hellm" )
with expansion:
"hello" > "hellm"
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.str_hello > "a" )
with expansion:
"hello" > "a"
-------------------------------------------------------------------------------
Ordering comparison checks that should fail
-------------------------------------------------------------------------------
ConditionTests.cpp:<line number>
...............................................................................
ConditionTests.cpp:<line number>: FAILED:
CHECK( data.int_seven > 7 )
with expansion:
7 > 7
ConditionTests.cpp:<line number>: FAILED:
CHECK( data.int_seven < 7 )
with expansion:
7 < 7
===============================================================================
test cases: 21 | 16 passed | 3 failed | 2 failed as expected
assertions: 81 | 73 passed | 4 failed | 4 failed as expected

View File

@@ -1,5 +1,5 @@
<testsuites> <testsuites>
<testsuite name="CatchSelfTest" errors="13" failures="72" tests="916" hostname="tbd" time="{duration}" timestamp="tbd"> <testsuite name="CatchSelfTest" errors="13" failures="68" tests="923" hostname="tbd" time="{duration}" timestamp="tbd">
<testcase classname="global" name="toString(enum)" time="{duration}"/> <testcase classname="global" name="toString(enum)" time="{duration}"/>
<testcase classname="global" name="toString(enum w/operator&lt;&lt;)" time="{duration}"/> <testcase classname="global" name="toString(enum w/operator&lt;&lt;)" time="{duration}"/>
<testcase classname="global" name="toString(enum class)" time="{duration}"/> <testcase classname="global" name="toString(enum class)" time="{duration}"/>
@@ -499,6 +499,7 @@ MiscTests.cpp:<line number>
<testcase classname="XmlEncode" name="string with control char (1)" time="{duration}"/> <testcase classname="XmlEncode" name="string with control char (1)" time="{duration}"/>
<testcase classname="XmlEncode" name="string with control char (x7F)" time="{duration}"/> <testcase classname="XmlEncode" name="string with control char (x7F)" time="{duration}"/>
<testcase classname="global" name="long long" time="{duration}"/> <testcase classname="global" name="long long" time="{duration}"/>
<testcase classname="global" name="This test 'should' fail but doesn't" time="{duration}"/>
<testcase classname="Process can be configured on command line" name="default - no arguments" time="{duration}"/> <testcase classname="Process can be configured on command line" name="default - no arguments" time="{duration}"/>
<testcase classname="Process can be configured on command line" name="test lists/1 test" time="{duration}"/> <testcase classname="Process can be configured on command line" name="test lists/1 test" time="{duration}"/>
<testcase classname="Process can be configured on command line" name="test lists/Specify one test case exclusion using exclude:" time="{duration}"/> <testcase classname="Process can be configured on command line" name="test lists/Specify one test case exclusion using exclude:" time="{duration}"/>
@@ -518,8 +519,11 @@ 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/-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="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="combinations/Single character flags can be combined" 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="use-colour/without option" time="{duration}"/>
<testcase classname="Process can be configured on command line" name="force-colour/without --force-colour" 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="Long strings can be wrapped" name="plain string/No wrapping" 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 once" time="{duration}"/>
<testcase classname="Long strings can be wrapped" name="plain string/Wrapped twice" time="{duration}"/> <testcase classname="Long strings can be wrapped" name="plain string/Wrapped twice" time="{duration}"/>

View File

@@ -665,7 +665,7 @@
5 != 5 5 != 5
</Expanded> </Expanded>
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="Ordering comparison checks that should succeed"> <TestCase name="Ordering comparison checks that should succeed">
<Expression success="true" type="REQUIRE" filename="projects/SelfTest/ConditionTests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/SelfTest/ConditionTests.cpp" >
@@ -3468,7 +3468,7 @@
<TestCase name="String matchers"> <TestCase name="String matchers">
<Expression success="true" type="REQUIRE_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() Contains( "string" ) testStringForMatching(), Contains( "string" )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" contains: "string" "this string contains 'abc' as a substring" contains: "string"
@@ -3476,7 +3476,7 @@
</Expression> </Expression>
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() Contains( "abc" ) testStringForMatching(), Contains( "abc" )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" contains: "abc" "this string contains 'abc' as a substring" contains: "abc"
@@ -3484,7 +3484,7 @@
</Expression> </Expression>
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() StartsWith( "this" ) testStringForMatching(), StartsWith( "this" )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" starts with: "this" "this string contains 'abc' as a substring" starts with: "this"
@@ -3492,7 +3492,7 @@
</Expression> </Expression>
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() EndsWith( "substring" ) testStringForMatching(), EndsWith( "substring" )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" ends with: "substring" "this string contains 'abc' as a substring" ends with: "substring"
@@ -3503,7 +3503,7 @@
<TestCase name="Contains string matcher"> <TestCase name="Contains string matcher">
<Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() Contains( "not there" ) testStringForMatching(), Contains( "not there" )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" contains: "not there" "this string contains 'abc' as a substring" contains: "not there"
@@ -3514,7 +3514,7 @@
<TestCase name="StartsWith string matcher"> <TestCase name="StartsWith string matcher">
<Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() StartsWith( "string" ) testStringForMatching(), StartsWith( "string" )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" starts with: "string" "this string contains 'abc' as a substring" starts with: "string"
@@ -3525,7 +3525,7 @@
<TestCase name="EndsWith string matcher"> <TestCase name="EndsWith string matcher">
<Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() EndsWith( "this" ) testStringForMatching(), EndsWith( "this" )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" ends with: "this" "this string contains 'abc' as a substring" ends with: "this"
@@ -3536,7 +3536,7 @@
<TestCase name="Equals string matcher"> <TestCase name="Equals string matcher">
<Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() Equals( "something else" ) testStringForMatching(), Equals( "something else" )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" equals: "something else" "this string contains 'abc' as a substring" equals: "something else"
@@ -3547,7 +3547,7 @@
<TestCase name="Equals string matcher, with NULL"> <TestCase name="Equals string matcher, with NULL">
<Expression success="true" type="REQUIRE_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
"" Equals(nullptr) "", Equals(nullptr)
</Original> </Original>
<Expanded> <Expanded>
"" equals: "" "" equals: ""
@@ -3558,7 +3558,7 @@
<TestCase name="AllOf matcher"> <TestCase name="AllOf matcher">
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() AllOf( Catch::Contains( "string" ), Catch::Contains( "abc" ) ) testStringForMatching(), AllOf( Catch::Contains( "string" ), Catch::Contains( "abc" ) )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" ) "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" )
@@ -3569,7 +3569,7 @@
<TestCase name="AnyOf matcher"> <TestCase name="AnyOf matcher">
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() AnyOf( Catch::Contains( "string" ), Catch::Contains( "not there" ) ) testStringForMatching(), AnyOf( Catch::Contains( "string" ), Catch::Contains( "not there" ) )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" ( contains: "string" or contains: "not there" ) "this string contains 'abc' as a substring" ( contains: "string" or contains: "not there" )
@@ -3577,7 +3577,7 @@
</Expression> </Expression>
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() AnyOf( Catch::Contains( "not there" ), Catch::Contains( "string" ) ) testStringForMatching(), AnyOf( Catch::Contains( "not there" ), Catch::Contains( "string" ) )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" ( contains: "not there" or contains: "string" ) "this string contains 'abc' as a substring" ( contains: "not there" or contains: "string" )
@@ -3588,7 +3588,7 @@
<TestCase name="Equals"> <TestCase name="Equals">
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() Equals( "this string contains 'abc' as a substring" ) testStringForMatching(), Equals( "this string contains 'abc' as a substring" )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring"
@@ -3599,7 +3599,7 @@
<TestCase name="Matchers can be (AllOf) composed with the &amp;&amp; operator"> <TestCase name="Matchers can be (AllOf) composed with the &amp;&amp; operator">
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() Contains( "string" ) &amp;&amp; Contains( "abc" ) &amp;&amp; Contains( "substring" ) &amp;&amp; Contains( "contains" ) testStringForMatching(), Contains( "string" ) &amp;&amp; Contains( "abc" ) &amp;&amp; Contains( "substring" ) &amp;&amp; Contains( "contains" )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" )
@@ -3610,7 +3610,7 @@
<TestCase name="Matchers can be (AnyOf) composed with the || operator"> <TestCase name="Matchers can be (AnyOf) composed with the || operator">
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() Contains( "string" ) || Contains( "different" ) || Contains( "random" ) testStringForMatching(), Contains( "string" ) || Contains( "different" ) || Contains( "random" )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" )
@@ -3618,7 +3618,7 @@
</Expression> </Expression>
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching2() Contains( "string" ) || Contains( "different" ) || Contains( "random" ) testStringForMatching2(), Contains( "string" ) || Contains( "different" ) || Contains( "random" )
</Original> </Original>
<Expanded> <Expanded>
"some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" ) "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" )
@@ -3629,7 +3629,7 @@
<TestCase name="Matchers can be composed with both &amp;&amp; and ||"> <TestCase name="Matchers can be composed with both &amp;&amp; and ||">
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() ( Contains( "string" ) || Contains( "different" ) ) &amp;&amp; Contains( "substring" ) testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) &amp;&amp; Contains( "substring" )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" )
@@ -3640,7 +3640,7 @@
<TestCase name="Matchers can be composed with both &amp;&amp; and || - failing"> <TestCase name="Matchers can be composed with both &amp;&amp; and || - failing">
<Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() ( Contains( "string" ) || Contains( "different" ) ) &amp;&amp; Contains( "random" ) testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) &amp;&amp; Contains( "random" )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" )
@@ -3651,7 +3651,7 @@
<TestCase name="Matchers can be negated (Not) with the ! operator"> <TestCase name="Matchers can be negated (Not) with the ! operator">
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() !Contains( "different" ) testStringForMatching(), !Contains( "different" )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" not contains: "different" "this string contains 'abc' as a substring" not contains: "different"
@@ -3662,7 +3662,7 @@
<TestCase name="Matchers can be negated (Not) with the ! operator - failing"> <TestCase name="Matchers can be negated (Not) with the ! operator - failing">
<Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() !Contains( "substring" ) testStringForMatching(), !Contains( "substring" )
</Original> </Original>
<Expanded> <Expanded>
"this string contains 'abc' as a substring" not contains: "substring" "this string contains 'abc' as a substring" not contains: "substring"
@@ -4085,6 +4085,9 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="This test 'should' fail but doesn't">
<OverallResult success="false"/>
</TestCase>
<TestCase name="Process can be configured on command line"> <TestCase name="Process can be configured on command line">
<Section name="default - no arguments"> <Section name="default - no arguments">
<Expression success="true" type="CHECK_NOTHROW" filename="projects/SelfTest/TestMain.cpp" > <Expression success="true" type="CHECK_NOTHROW" filename="projects/SelfTest/TestMain.cpp" >
@@ -4415,7 +4418,7 @@
<Section name="-x must be greater than zero"> <Section name="-x must be greater than zero">
<Expression success="true" type="REQUIRE_THAT" filename="projects/SelfTest/TestMain.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="projects/SelfTest/TestMain.cpp" >
<Original> <Original>
parseIntoConfigAndReturnError( argv, config ) Contains( "greater than zero" ) parseIntoConfigAndReturnError( argv, config ), Contains( "greater than zero" )
</Original> </Original>
<Expanded> <Expanded>
"Value after -x or --abortAfter must be greater than zero "Value after -x or --abortAfter must be greater than zero
@@ -4430,7 +4433,7 @@
<Section name="-x must be numeric"> <Section name="-x must be numeric">
<Expression success="true" type="REQUIRE_THAT" filename="projects/SelfTest/TestMain.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="projects/SelfTest/TestMain.cpp" >
<Original> <Original>
parseIntoConfigAndReturnError( argv, config ) Contains( "-x" ) parseIntoConfigAndReturnError( argv, config ), Contains( "-x" )
</Original> </Original>
<Expanded> <Expanded>
"Unable to convert oops to destination type "Unable to convert oops to destination type
@@ -4567,8 +4570,8 @@
</Section> </Section>
<OverallResults successes="4" failures="0" expectedFailures="0"/> <OverallResults successes="4" failures="0" expectedFailures="0"/>
</Section> </Section>
<Section name="force-colour"> <Section name="use-colour">
<Section name="--force-colour"> <Section name="without option">
<Expression success="true" type="CHECK_NOTHROW" filename="projects/SelfTest/TestMain.cpp" > <Expression success="true" type="CHECK_NOTHROW" filename="projects/SelfTest/TestMain.cpp" >
<Original> <Original>
parseIntoConfig( argv, config ) parseIntoConfig( argv, config )
@@ -4579,18 +4582,18 @@
</Expression> </Expression>
<Expression success="true" type="REQUIRE" filename="projects/SelfTest/TestMain.cpp" > <Expression success="true" type="REQUIRE" filename="projects/SelfTest/TestMain.cpp" >
<Original> <Original>
config.forceColour config.useColour == UseColour::Auto
</Original> </Original>
<Expanded> <Expanded>
true 0 == 0
</Expanded> </Expanded>
</Expression> </Expression>
<OverallResults successes="2" failures="0" expectedFailures="0"/> <OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section> </Section>
<OverallResults successes="2" failures="0" expectedFailures="0"/> <OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section> </Section>
<Section name="force-colour"> <Section name="use-colour">
<Section name="without --force-colour"> <Section name="auto">
<Expression success="true" type="CHECK_NOTHROW" filename="projects/SelfTest/TestMain.cpp" > <Expression success="true" type="CHECK_NOTHROW" filename="projects/SelfTest/TestMain.cpp" >
<Original> <Original>
parseIntoConfig( argv, config ) parseIntoConfig( argv, config )
@@ -4601,16 +4604,74 @@
</Expression> </Expression>
<Expression success="true" type="REQUIRE" filename="projects/SelfTest/TestMain.cpp" > <Expression success="true" type="REQUIRE" filename="projects/SelfTest/TestMain.cpp" >
<Original> <Original>
!config.forceColour config.useColour == UseColour::Auto
</Original> </Original>
<Expanded> <Expanded>
true 0 == 0
</Expanded> </Expanded>
</Expression> </Expression>
<OverallResults successes="2" failures="0" expectedFailures="0"/> <OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section> </Section>
<OverallResults successes="2" failures="0" expectedFailures="0"/> <OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section> </Section>
<Section name="use-colour">
<Section name="yes">
<Expression success="true" type="CHECK_NOTHROW" filename="projects/SelfTest/TestMain.cpp" >
<Original>
parseIntoConfig( argv, config )
</Original>
<Expanded>
parseIntoConfig( argv, config )
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/SelfTest/TestMain.cpp" >
<Original>
config.useColour == UseColour::Yes
</Original>
<Expanded>
1 == 1
</Expanded>
</Expression>
<OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section>
<OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section>
<Section name="use-colour">
<Section name="no">
<Expression success="true" type="CHECK_NOTHROW" filename="projects/SelfTest/TestMain.cpp" >
<Original>
parseIntoConfig( argv, config )
</Original>
<Expanded>
parseIntoConfig( argv, config )
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/SelfTest/TestMain.cpp" >
<Original>
config.useColour == UseColour::No
</Original>
<Expanded>
2 == 2
</Expanded>
</Expression>
<OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section>
<OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section>
<Section name="use-colour">
<Section name="error">
<Expression success="true" type="REQUIRE_THROWS_WITH" filename="projects/SelfTest/TestMain.cpp" >
<Original>
parseIntoConfig( argv, config ), Contains( "colour mode must be one of" )
</Original>
<Expanded>
parseIntoConfig( argv, config ), Contains( "colour mode must be one of" )
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="Long strings can be wrapped"> <TestCase name="Long strings can be wrapped">
@@ -5276,7 +5337,7 @@ there"
<TestCase name="Long text is truncted"> <TestCase name="Long text is truncted">
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/TestMain.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/TestMain.cpp" >
<Original> <Original>
t.toString() EndsWith( "... message truncated due to excessive size" ) t.toString(), EndsWith( "... message truncated due to excessive size" )
</Original> </Original>
<Expanded> <Expanded>
"******************************************************************************- "******************************************************************************-
@@ -9254,7 +9315,7 @@ there"
<Section name="The same tag alias can only be registered once"> <Section name="The same tag alias can only be registered once">
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/TagAliasTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/TagAliasTests.cpp" >
<Original> <Original>
what Contains( "[@zzz]" ) what, Contains( "[@zzz]" )
</Original> </Original>
<Expanded> <Expanded>
"error: tag alias, "[@zzz]" already registered. "error: tag alias, "[@zzz]" already registered.
@@ -9264,7 +9325,7 @@ there"
</Expression> </Expression>
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/TagAliasTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/TagAliasTests.cpp" >
<Original> <Original>
what Contains( "file" ) what, Contains( "file" )
</Original> </Original>
<Expanded> <Expanded>
"error: tag alias, "[@zzz]" already registered. "error: tag alias, "[@zzz]" already registered.
@@ -9274,7 +9335,7 @@ there"
</Expression> </Expression>
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/TagAliasTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/TagAliasTests.cpp" >
<Original> <Original>
what Contains( "2" ) what, Contains( "2" )
</Original> </Original>
<Expanded> <Expanded>
"error: tag alias, "[@zzz]" already registered. "error: tag alias, "[@zzz]" already registered.
@@ -9284,7 +9345,7 @@ there"
</Expression> </Expression>
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/TagAliasTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/TagAliasTests.cpp" >
<Original> <Original>
what Contains( "10" ) what, Contains( "10" )
</Original> </Original>
<Expanded> <Expanded>
"error: tag alias, "[@zzz]" already registered. "error: tag alias, "[@zzz]" already registered.
@@ -9505,7 +9566,7 @@ there"
</Section> </Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<OverallResults successes="818" failures="85" expectedFailures="13"/> <OverallResults successes="824" failures="81" expectedFailures="18"/>
</Group> </Group>
<OverallResults successes="818" failures="85" expectedFailures="13"/> <OverallResults successes="824" failures="80" expectedFailures="18"/>
</Catch> </Catch>

View File

@@ -101,7 +101,7 @@ TEST_CASE( "Inequality checks that should succeed", "" )
REQUIRE( data.str_hello.size() != 6 ); REQUIRE( data.str_hello.size() != 6 );
} }
TEST_CASE( "Inequality checks that should fail", "[.][failing]" ) TEST_CASE( "Inequality checks that should fail", "[.][failing][!shouldfail]" )
{ {
TestData data; TestData data;

View File

@@ -478,3 +478,8 @@ TEST_CASE( "long long" ) {
// int x = 10/i; // This should cause the signal to fire // int x = 10/i; // This should cause the signal to fire
// CHECK( x == 0 ); // CHECK( x == 0 );
//} //}
TEST_CASE( "This test 'should' fail but doesn't", "[.][failing][!shouldfail]" )
{
SUCCEED( "oops!" );
}

View File

@@ -195,19 +195,41 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
} }
} }
SECTION( "force-colour", "") { SECTION( "use-colour", "") {
SECTION( "--force-colour", "" ) {
const char* argv[] = { "test", "--force-colour" };
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
REQUIRE( config.forceColour ); using Catch::UseColour;
}
SECTION( "without --force-colour", "" ) { SECTION( "without option", "" ) {
const char* argv[] = { "test" }; const char* argv[] = { "test" };
CHECK_NOTHROW( parseIntoConfig( argv, config ) ); CHECK_NOTHROW( parseIntoConfig( argv, config ) );
REQUIRE( !config.forceColour ); 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" ) );
} }
} }
} }

View File

@@ -93,7 +93,7 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\..\SelfTest\ApproxTests.cpp" /> <ClCompile Include="..\..\..\SelfTest\ApproxTests.cpp" />
<ClCompile Include="..\..\..\SelfTest\BDDTests.cpp" /> <ClCompile Include="..\..\..\SelfTest\BDDTests.cpp" />
<ClCompile Include="..\..\..\SelfTest\SectionTrackerTests.cpp" /> <ClCompile Include="..\..\..\SelfTest\PartTrackerTests.cpp" />
<ClCompile Include="..\..\..\SelfTest\TestMain.cpp" /> <ClCompile Include="..\..\..\SelfTest\TestMain.cpp" />
<ClCompile Include="..\..\..\SelfTest\ClassTests.cpp" /> <ClCompile Include="..\..\..\SelfTest\ClassTests.cpp" />
<ClCompile Include="..\..\..\SelfTest\ConditionTests.cpp" /> <ClCompile Include="..\..\..\SelfTest\ConditionTests.cpp" />

View File

@@ -513,7 +513,7 @@
4A6D0C17149B3D3B00DB3EAA /* Project object */ = { 4A6D0C17149B3D3B00DB3EAA /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 0630; LastUpgradeCheck = 0710;
}; };
buildConfigurationList = 4A6D0C1A149B3D3B00DB3EAA /* Build configuration list for PBXProject "CatchSelfTest" */; buildConfigurationList = 4A6D0C1A149B3D3B00DB3EAA /* Build configuration list for PBXProject "CatchSelfTest" */;
compatibilityVersion = "Xcode 3.2"; compatibilityVersion = "Xcode 3.2";
@@ -595,6 +595,7 @@
CLANG_WARN__EXIT_TIME_DESTRUCTORS = NO; CLANG_WARN__EXIT_TIME_DESTRUCTORS = NO;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99; GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO; GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_ENABLE_OBJC_EXCEPTIONS = YES;

View File

@@ -1,6 +1,6 @@
/* /*
* Catch v1.3.0 * Catch v1.4.0
* Generated: 2015-12-04 10:18:17.055188 * Generated: 2016-03-15 07:23:12.623111
* ---------------------------------------------------------- * ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly * This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@@ -62,7 +62,11 @@
#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line #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_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( 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__ ) # define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
#endif
#define INTERNAL_CATCH_STRINGIFY2( expr ) #expr #define INTERNAL_CATCH_STRINGIFY2( expr ) #expr
#define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr ) #define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr )
@@ -89,7 +93,7 @@
// CATCH_CONFIG_CPP11_OR_GREATER : Is C++11 supported? // CATCH_CONFIG_CPP11_OR_GREATER : Is C++11 supported?
// CATCH_CONFIG_VARIADIC_MACROS : are variadic macros 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 // Note to maintainers: if new toggles are added please document them
// in configuration.md, too // in configuration.md, too
@@ -102,6 +106,10 @@
// All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11 // 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__ #ifdef __clang__
# if __has_feature(cxx_nullptr) # if __has_feature(cxx_nullptr)
@@ -112,6 +120,10 @@
# define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT # define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
# endif # endif
# if defined(CATCH_CPP11_OR_GREATER)
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS _Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
# endif
#endif // __clang__ #endif // __clang__
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -140,6 +152,10 @@
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR # define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
# endif # 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
// - otherwise more recent versions define __cplusplus >= 201103L // - otherwise more recent versions define __cplusplus >= 201103L
// and will get picked up below // and will get picked up below
@@ -173,13 +189,20 @@
#endif #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 // C++ language feature support
// catch all support for C++11 // catch all support for C++11
#if defined(__cplusplus) && __cplusplus >= 201103L #if defined(CATCH_CPP11_OR_GREATER)
# define CATCH_CPP11_OR_GREATER
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR) # if !defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR)
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR # define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
@@ -246,6 +269,13 @@
#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) #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 # define CATCH_CONFIG_CPP11_UNIQUE_PTR
#endif #endif
#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
# define CATCH_CONFIG_COUNTER
#endif
#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
#endif
// noexcept support: // noexcept support:
#if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT) #if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT)
@@ -672,24 +702,28 @@ void registerTestCaseFunction
#ifdef CATCH_CONFIG_VARIADIC_MACROS #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( ... ) \ #define INTERNAL_CATCH_TESTCASE( ... ) \
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__ )
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____ )()
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ #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 ); } 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{ \ namespace{ \
struct INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) : ClassName{ \ struct TestName : ClassName{ \
void test(); \ 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, ... ) \ #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
@@ -697,24 +731,28 @@ void registerTestCaseFunction
#else #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 ) \ #define INTERNAL_CATCH_TESTCASE( 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 )
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____ )()
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, 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 ); } 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{ \ namespace{ \
struct INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) : ClassName{ \ struct TestCaseName : ClassName{ \
void test(); \ 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 ) \ #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, Name, Desc ) \
@@ -1069,7 +1107,7 @@ namespace Matchers {
virtual ~StartsWith(); virtual ~StartsWith();
virtual bool match( std::string const& expr ) const { virtual bool match( std::string const& expr ) const {
return m_data.adjustString( expr ).find( m_data.m_str ) == 0; return startsWith( m_data.adjustString( expr ), m_data.m_str );
} }
virtual std::string toString() const { virtual std::string toString() const {
return "starts with: \"" + m_data.m_str + "\"" + m_data.toStringSuffix(); return "starts with: \"" + m_data.m_str + "\"" + m_data.toStringSuffix();
@@ -1086,7 +1124,7 @@ namespace Matchers {
virtual ~EndsWith(); virtual ~EndsWith();
virtual bool match( std::string const& expr ) const { virtual bool match( std::string const& expr ) const {
return m_data.adjustString( expr ).find( m_data.m_str ) == expr.size() - m_data.m_str.size(); return endsWith( m_data.adjustString( expr ), m_data.m_str );
} }
virtual std::string toString() const { virtual std::string toString() const {
return "ends with: \"" + m_data.m_str + "\"" + m_data.toStringSuffix(); return "ends with: \"" + m_data.m_str + "\"" + m_data.toStringSuffix();
@@ -1287,37 +1325,37 @@ namespace Internal {
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsEqualTo> { struct Evaluator<T1, T2, IsEqualTo> {
static bool evaluate( T1 const& lhs, T2 const& rhs) { static bool evaluate( T1 const& lhs, T2 const& rhs) {
return opCast( lhs ) == opCast( rhs ); return bool( opCast( lhs ) == opCast( rhs ) );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsNotEqualTo> { struct Evaluator<T1, T2, IsNotEqualTo> {
static bool evaluate( T1 const& lhs, T2 const& rhs ) { static bool evaluate( T1 const& lhs, T2 const& rhs ) {
return opCast( lhs ) != opCast( rhs ); return bool( opCast( lhs ) != opCast( rhs ) );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsLessThan> { struct Evaluator<T1, T2, IsLessThan> {
static bool evaluate( T1 const& lhs, T2 const& rhs ) { static bool evaluate( T1 const& lhs, T2 const& rhs ) {
return opCast( lhs ) < opCast( rhs ); return bool( opCast( lhs ) < opCast( rhs ) );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsGreaterThan> { struct Evaluator<T1, T2, IsGreaterThan> {
static bool evaluate( T1 const& lhs, T2 const& rhs ) { static bool evaluate( T1 const& lhs, T2 const& rhs ) {
return opCast( lhs ) > opCast( rhs ); return bool( opCast( lhs ) > opCast( rhs ) );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> { struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> {
static bool evaluate( T1 const& lhs, T2 const& rhs ) { static bool evaluate( T1 const& lhs, T2 const& rhs ) {
return opCast( lhs ) >= opCast( rhs ); return bool( opCast( lhs ) >= opCast( rhs ) );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsLessThanOrEqualTo> { struct Evaluator<T1, T2, IsLessThanOrEqualTo> {
static bool evaluate( T1 const& lhs, T2 const& rhs ) { static bool evaluate( T1 const& lhs, T2 const& rhs ) {
return opCast( lhs ) <= opCast( rhs ); return bool( opCast( lhs ) <= opCast( rhs ) );
} }
}; };
@@ -2020,13 +2058,14 @@ namespace Catch {
do { \ do { \
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
try { \ try { \
CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
( __catchResult <= expr ).endExpression(); \ ( __catchResult <= expr ).endExpression(); \
} \ } \
catch( ... ) { \ catch( ... ) { \
__catchResult.useActiveException( Catch::ResultDisposition::Normal ); \ __catchResult.useActiveException( Catch::ResultDisposition::Normal ); \
} \ } \
INTERNAL_CATCH_REACT( __catchResult ) \ INTERNAL_CATCH_REACT( __catchResult ) \
} while( Catch::isTrue( false && (expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look } 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
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \ #define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \
@@ -2115,7 +2154,7 @@ namespace Catch {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CHECK_THAT( arg, matcher, resultDisposition, macroName ) \ #define INTERNAL_CHECK_THAT( arg, matcher, resultDisposition, macroName ) \
do { \ do { \
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #arg " " #matcher, resultDisposition ); \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #arg ", " #matcher, resultDisposition ); \
try { \ try { \
std::string matcherAsString = (matcher).toString(); \ std::string matcherAsString = (matcher).toString(); \
__catchResult \ __catchResult \
@@ -2563,10 +2602,12 @@ namespace Catch {
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) \ #define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \
static std::string INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator )( signature ); \ static std::string translatorName( signature ); \
namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ) ); }\ namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); }\
static std::string INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator )( signature ) static std::string translatorName( signature )
#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )
// #included from: internal/catch_approx.hpp // #included from: internal/catch_approx.hpp
#define TWOBLUECUBES_CATCH_APPROX_HPP_INCLUDED #define TWOBLUECUBES_CATCH_APPROX_HPP_INCLUDED
@@ -3331,6 +3372,11 @@ namespace Catch {
InLexicographicalOrder, InLexicographicalOrder,
InRandomOrder InRandomOrder
}; }; }; };
struct UseColour { enum YesOrNo {
Auto,
Yes,
No
}; };
class TestSpec; class TestSpec;
@@ -3350,7 +3396,7 @@ namespace Catch {
virtual TestSpec const& testSpec() const = 0; virtual TestSpec const& testSpec() const = 0;
virtual RunTests::InWhatOrder runOrder() const = 0; virtual RunTests::InWhatOrder runOrder() const = 0;
virtual unsigned int rngSeed() const = 0; virtual unsigned int rngSeed() const = 0;
virtual bool forceColour() const = 0; virtual UseColour::YesOrNo useColour() const = 0;
}; };
} }
@@ -3439,14 +3485,14 @@ namespace Catch {
noThrow( false ), noThrow( false ),
showHelp( false ), showHelp( false ),
showInvisibles( false ), showInvisibles( false ),
forceColour( false ),
filenamesAsTags( false ), filenamesAsTags( false ),
abortAfter( -1 ), abortAfter( -1 ),
rngSeed( 0 ), rngSeed( 0 ),
verbosity( Verbosity::Normal ), verbosity( Verbosity::Normal ),
warnings( WarnAbout::Nothing ), warnings( WarnAbout::Nothing ),
showDurations( ShowDurations::DefaultForReporter ), showDurations( ShowDurations::DefaultForReporter ),
runOrder( RunTests::InDeclarationOrder ) runOrder( RunTests::InDeclarationOrder ),
useColour( UseColour::Auto )
{} {}
bool listTests; bool listTests;
@@ -3459,7 +3505,6 @@ namespace Catch {
bool noThrow; bool noThrow;
bool showHelp; bool showHelp;
bool showInvisibles; bool showInvisibles;
bool forceColour;
bool filenamesAsTags; bool filenamesAsTags;
int abortAfter; int abortAfter;
@@ -3469,6 +3514,7 @@ namespace Catch {
WarnAbout::What warnings; WarnAbout::What warnings;
ShowDurations::OrNot showDurations; ShowDurations::OrNot showDurations;
RunTests::InWhatOrder runOrder; RunTests::InWhatOrder runOrder;
UseColour::YesOrNo useColour;
std::string outputFilename; std::string outputFilename;
std::string name; std::string name;
@@ -3534,7 +3580,7 @@ namespace Catch {
virtual ShowDurations::OrNot showDurations() const { return m_data.showDurations; } virtual ShowDurations::OrNot showDurations() const { return m_data.showDurations; }
virtual RunTests::InWhatOrder runOrder() const { return m_data.runOrder; } virtual RunTests::InWhatOrder runOrder() const { return m_data.runOrder; }
virtual unsigned int rngSeed() const { return m_data.rngSeed; } virtual unsigned int rngSeed() const { return m_data.rngSeed; }
virtual bool forceColour() const { return m_data.forceColour; } virtual UseColour::YesOrNo useColour() const { return m_data.useColour; }
private: private:
@@ -3572,6 +3618,8 @@ namespace Catch {
#define STITCH_CLARA_OPEN_NAMESPACE namespace Catch { #define STITCH_CLARA_OPEN_NAMESPACE namespace Catch {
// #included from: ../external/clara.h // #included from: ../external/clara.h
// Version 0.0.1.1
// Only use header guard if we are not using an outer namespace // Only use header guard if we are not using an outer namespace
#if !defined(TWOBLUECUBES_CLARA_H_INCLUDED) || defined(STITCH_CLARA_OPEN_NAMESPACE) #if !defined(TWOBLUECUBES_CLARA_H_INCLUDED) || defined(STITCH_CLARA_OPEN_NAMESPACE)
@@ -3596,6 +3644,7 @@ namespace Catch {
#include <string> #include <string>
#include <vector> #include <vector>
#include <sstream> #include <sstream>
#include <algorithm>
// Use optional outer namespace // Use optional outer namespace
#ifdef STITCH_TBC_TEXT_FORMAT_OUTER_NAMESPACE #ifdef STITCH_TBC_TEXT_FORMAT_OUTER_NAMESPACE
@@ -3730,12 +3779,158 @@ namespace Tbc {
#endif // TBC_TEXT_FORMAT_H_INCLUDED #endif // TBC_TEXT_FORMAT_H_INCLUDED
// ----------- end of #include from tbc_text_format.h ----------- // ----------- end of #include from tbc_text_format.h -----------
// ........... back in /Users/philnash/Dev/OSS/Clara/srcs/clara.h // ........... back in clara.h
#undef STITCH_TBC_TEXT_FORMAT_OPEN_NAMESPACE #undef STITCH_TBC_TEXT_FORMAT_OPEN_NAMESPACE
// ----------- #included from clara_compilers.h -----------
#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 <map>
#include <algorithm>
#include <stdexcept> #include <stdexcept>
#include <memory> #include <memory>
@@ -3762,6 +3957,9 @@ namespace Clara {
const unsigned int consoleWidth = 80; const unsigned int consoleWidth = 80;
#endif #endif
// Use this to try and stop compiler from warning about unreachable code
inline bool isTrue( bool value ) { return value; }
using namespace Tbc; using namespace Tbc;
inline bool startsWith( std::string const& str, std::string const& prefix ) { inline bool startsWith( std::string const& str, std::string const& prefix ) {
@@ -3802,13 +4000,14 @@ namespace Clara {
} }
template<typename T> template<typename T>
inline void convertInto( bool, T& ) { inline void convertInto( bool, T& ) {
if( isTrue( true ) )
throw std::runtime_error( "Invalid conversion" ); throw std::runtime_error( "Invalid conversion" );
} }
template<typename ConfigT> template<typename ConfigT>
struct IArgFunction { struct IArgFunction {
virtual ~IArgFunction() {} virtual ~IArgFunction() {}
# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS #ifdef CLARA_CONFIG_CPP11_GENERATED_METHODS
IArgFunction() = default; IArgFunction() = default;
IArgFunction( IArgFunction const& ) = default; IArgFunction( IArgFunction const& ) = default;
#endif #endif
@@ -3821,11 +4020,11 @@ namespace Clara {
template<typename ConfigT> template<typename ConfigT>
class BoundArgFunction { class BoundArgFunction {
public: public:
BoundArgFunction() : functionObj( CATCH_NULL ) {} BoundArgFunction() : functionObj( CLARA_NULL ) {}
BoundArgFunction( IArgFunction<ConfigT>* _functionObj ) : functionObj( _functionObj ) {} BoundArgFunction( IArgFunction<ConfigT>* _functionObj ) : functionObj( _functionObj ) {}
BoundArgFunction( BoundArgFunction const& other ) : functionObj( other.functionObj ? other.functionObj->clone() : CATCH_NULL ) {} BoundArgFunction( BoundArgFunction const& other ) : functionObj( other.functionObj ? other.functionObj->clone() : CLARA_NULL ) {}
BoundArgFunction& operator = ( BoundArgFunction const& other ) { BoundArgFunction& operator = ( BoundArgFunction const& other ) {
IArgFunction<ConfigT>* newFunctionObj = other.functionObj ? other.functionObj->clone() : CATCH_NULL; IArgFunction<ConfigT>* newFunctionObj = other.functionObj ? other.functionObj->clone() : CLARA_NULL;
delete functionObj; delete functionObj;
functionObj = newFunctionObj; functionObj = newFunctionObj;
return *this; return *this;
@@ -3841,7 +4040,7 @@ namespace Clara {
bool takesArg() const { return functionObj->takesArg(); } bool takesArg() const { return functionObj->takesArg(); }
bool isSet() const { bool isSet() const {
return functionObj != CATCH_NULL; return functionObj != CLARA_NULL;
} }
private: private:
IArgFunction<ConfigT>* functionObj; IArgFunction<ConfigT>* functionObj;
@@ -3949,7 +4148,7 @@ namespace Clara {
std::string data; 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 = "--"; const std::string doubleDash = "--";
for( int i = 1; i < argc && argv[i] != doubleDash; ++i ) for( int i = 1; i < argc && argv[i] != doubleDash; ++i )
parseIntoTokens( argv[i] , tokens); parseIntoTokens( argv[i] , tokens);
@@ -4059,7 +4258,7 @@ namespace Clara {
} }
}; };
typedef CATCH_AUTO_PTR( Arg ) ArgAutoPtr; typedef CLARA_AUTO_PTR( Arg ) ArgAutoPtr;
friend void addOptName( Arg& arg, std::string const& optName ) friend void addOptName( Arg& arg, std::string const& optName )
{ {
@@ -4135,8 +4334,8 @@ namespace Clara {
m_arg->description = description; m_arg->description = description;
return *this; return *this;
} }
ArgBuilder& detail( std::string const& _detail ) { ArgBuilder& detail( std::string const& detail ) {
m_arg->detail = _detail; m_arg->detail = detail;
return *this; return *this;
} }
@@ -4219,14 +4418,14 @@ namespace Clara {
maxWidth = (std::max)( maxWidth, it->commands().size() ); maxWidth = (std::max)( maxWidth, it->commands().size() );
for( it = itBegin; it != itEnd; ++it ) { for( it = itBegin; it != itEnd; ++it ) {
Detail::Text usageText( it->commands(), Detail::TextAttributes() Detail::Text usage( it->commands(), Detail::TextAttributes()
.setWidth( maxWidth+indent ) .setWidth( maxWidth+indent )
.setIndent( indent ) ); .setIndent( indent ) );
Detail::Text desc( it->description, Detail::TextAttributes() Detail::Text desc( it->description, Detail::TextAttributes()
.setWidth( width - maxWidth - 3 ) ); .setWidth( width - maxWidth - 3 ) );
for( std::size_t i = 0; i < (std::max)( usageText.size(), desc.size() ); ++i ) { for( std::size_t i = 0; i < (std::max)( usage.size(), desc.size() ); ++i ) {
std::string usageCol = i < usageText.size() ? usageText[i] : ""; std::string usageCol = i < usage.size() ? usage[i] : "";
os << usageCol; os << usageCol;
if( i < desc.size() && !desc[i].empty() ) if( i < desc.size() && !desc[i].empty() )
@@ -4283,13 +4482,13 @@ namespace Clara {
return oss.str(); return oss.str();
} }
ConfigT parse( int argc, char const * const * argv ) const { ConfigT parse( int argc, char const* const argv[] ) const {
ConfigT config; ConfigT config;
parseInto( argc, argv, config ); parseInto( argc, argv, config );
return config; return config;
} }
std::vector<Parser::Token> parseInto( int argc, char const * const * argv, ConfigT& config ) const { std::vector<Parser::Token> parseInto( int argc, char const* argv[], ConfigT& config ) const {
std::string processName = argv[0]; std::string processName = argv[0];
std::size_t lastSlash = processName.find_last_of( "/\\" ); std::size_t lastSlash = processName.find_last_of( "/\\" );
if( lastSlash != std::string::npos ) if( lastSlash != std::string::npos )
@@ -4471,6 +4670,21 @@ namespace Catch {
? ShowDurations::Always ? ShowDurations::Always
: ShowDurations::Never; : 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 ) { inline void loadTestNamesFromFile( ConfigData& config, std::string const& _filename ) {
std::ifstream f( _filename.c_str() ); std::ifstream f( _filename.c_str() );
if( !f.is_open() ) if( !f.is_open() )
@@ -4557,7 +4771,7 @@ namespace Catch {
cli["-d"]["--durations"] cli["-d"]["--durations"]
.describe( "show test durations" ) .describe( "show test durations" )
.bind( &setShowDurations, "yes/no" ); .bind( &setShowDurations, "yes|no" );
cli["-f"]["--input-file"] cli["-f"]["--input-file"]
.describe( "load test names to run from a file" ) .describe( "load test names to run from a file" )
@@ -4585,8 +4799,12 @@ namespace Catch {
.bind( &setRngSeed, "'time'|number" ); .bind( &setRngSeed, "'time'|number" );
cli["--force-colour"] cli["--force-colour"]
.describe( "force colourised output" ) .describe( "force colourised output (deprecated)" )
.bind( &ConfigData::forceColour ); .bind( &forceColour );
cli["--use-colour"]
.describe( "should output be colourised" )
.bind( &setUseColour, "yes|no" );
return cli; return cli;
} }
@@ -5692,6 +5910,11 @@ namespace Catch {
while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() ); while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() );
Totals deltaTotals = m_totals.delta( prevTotals ); Totals deltaTotals = m_totals.delta( prevTotals );
if( testInfo.expectedToFail() && deltaTotals.testCases.passed > 0 ) {
deltaTotals.assertions.failed++;
deltaTotals.testCases.passed--;
deltaTotals.testCases.failed++;
}
m_totals.testCases += deltaTotals.testCases; m_totals.testCases += deltaTotals.testCases;
m_reporter->testCaseEnded( TestCaseStats( testInfo, m_reporter->testCaseEnded( TestCaseStats( testInfo,
deltaTotals, deltaTotals,
@@ -6083,7 +6306,7 @@ namespace Catch {
Catch::cout() << "For more detail usage please see the project docs\n" << std::endl; Catch::cout() << "For more detail usage please see the project docs\n" << std::endl;
} }
int applyCommandLine( int argc, char const* const argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) { int applyCommandLine( int argc, char const* argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
try { try {
m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail ); m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail );
m_unusedTokens = m_cli.parseInto( argc, argv, m_configData ); m_unusedTokens = m_cli.parseInto( argc, argv, m_configData );
@@ -6110,13 +6333,16 @@ namespace Catch {
m_config.reset(); m_config.reset();
} }
int run( int argc, char const* const argv[] ) { int run( int argc, char const* argv[] ) {
int returnCode = applyCommandLine( argc, argv ); int returnCode = applyCommandLine( argc, argv );
if( returnCode == 0 ) if( returnCode == 0 )
returnCode = run(); returnCode = run();
return returnCode; return returnCode;
} }
int run( int argc, char* argv[] ) {
return run( argc, const_cast<char const**>( argv ) );
}
int run() { int run() {
if( m_configData.showHelp ) if( m_configData.showHelp )
@@ -6248,7 +6474,10 @@ namespace Catch {
class TestRegistry : public ITestCaseRegistry { class TestRegistry : public ITestCaseRegistry {
public: public:
TestRegistry() : m_unnamedCount( 0 ) {} TestRegistry()
: m_currentSortOrder( RunTests::InDeclarationOrder ),
m_unnamedCount( 0 )
{}
virtual ~TestRegistry(); virtual ~TestRegistry();
virtual void registerTest( TestCase const& testCase ) { virtual void registerTest( TestCase const& testCase ) {
@@ -6812,7 +7041,18 @@ namespace {
IColourImpl* platformColourInstance() { IColourImpl* platformColourInstance() {
static Win32ColourImpl s_instance; static Win32ColourImpl s_instance;
return &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();
} }
} // end anon namespace } // end anon namespace
@@ -6863,7 +7103,14 @@ namespace {
IColourImpl* platformColourInstance() { IColourImpl* platformColourInstance() {
Ptr<IConfig const> config = getCurrentContext().getConfig(); Ptr<IConfig const> config = getCurrentContext().getConfig();
return (config && config->forceColour()) || isatty(STDOUT_FILENO) 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
? PosixColourImpl::instance() ? PosixColourImpl::instance()
: NoColourImpl::instance(); : NoColourImpl::instance();
} }
@@ -6888,9 +7135,7 @@ namespace Catch {
Colour::~Colour(){ if( !m_moved ) use( None ); } Colour::~Colour(){ if( !m_moved ) use( None ); }
void Colour::use( Code _colourCode ) { void Colour::use( Code _colourCode ) {
static IColourImpl* impl = isDebuggerActive() static IColourImpl* impl = platformColourInstance();
? NoColourImpl::instance()
: platformColourInstance();
impl->use( _colourCode ); impl->use( _colourCode );
} }
@@ -7267,7 +7512,7 @@ namespace Catch {
return os; return os;
} }
Version libraryVersion( 1, 3, 0, "", 0 ); Version libraryVersion( 1, 4, 0, "", 0 );
} }
@@ -9563,7 +9808,7 @@ namespace Catch {
if( totals.testCases.total() == 0 ) { if( totals.testCases.total() == 0 ) {
stream << Colour( Colour::Warning ) << "No tests ran\n"; stream << Colour( Colour::Warning ) << "No tests ran\n";
} }
else if( totals.assertions.total() > 0 && totals.assertions.allPassed() ) { else if( totals.assertions.total() > 0 && totals.testCases.allPassed() ) {
stream << Colour( Colour::ResultSuccess ) << "All tests passed"; stream << Colour( Colour::ResultSuccess ) << "All tests passed";
stream << " (" stream << " ("
<< pluralise( totals.assertions.passed, "assertion" ) << " in " << pluralise( totals.assertions.passed, "assertion" ) << " in "
@@ -10020,7 +10265,7 @@ namespace Catch {
#ifndef __OBJC__ #ifndef __OBJC__
// Standard C/C++ main entry point // Standard C/C++ main entry point
int main (int argc, char * const argv[]) { int main (int argc, char * argv[]) {
return Catch::Session().run( argc, argv ); return Catch::Session().run( argc, argv );
} }
@@ -10087,7 +10332,7 @@ int main (int argc, char * const argv[]) {
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) #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_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_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
#define CATCH_REGISTER_TEST_CASE( ... ) INTERNAL_CATCH_REGISTER_TESTCASE( __VA_ARGS__ ) #define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __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_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__ ) #define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", __VA_ARGS__ )
@@ -10156,7 +10401,7 @@ int main (int argc, char * const argv[]) {
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __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 METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
#define REGISTER_TEST_CASE( ... ) INTERNAL_CATCH_REGISTER_TESTCASE( __VA_ARGS__ ) #define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) #define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
#define FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", __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__ ) #define SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", __VA_ARGS__ )
@@ -10164,7 +10409,7 @@ int main (int argc, char * const argv[]) {
#define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description ) #define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
#define TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description ) #define TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
#define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description ) #define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
#define REGISTER_TEST_CASE( ... ) INTERNAL_CATCH_REGISTER_TESTCASE( __VA_ARGS__ ) #define REGISTER_TEST_CASE( method, name, description ) INTERNAL_CATCH_REGISTER_TESTCASE( method, name, description )
#define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description ) #define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
#define FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", msg ) #define FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", msg )
#define SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", msg ) #define SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", msg )