mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-10 23:45:39 +02:00
Compare commits
16 Commits
v2.0.0-dev
...
v2.0.0-dev
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5d6c1f4dd0 | ||
![]() |
3bc03cd617 | ||
![]() |
28f11a7149 | ||
![]() |
24af32f378 | ||
![]() |
0545de0a31 | ||
![]() |
ee75b324e7 | ||
![]() |
597fca3c89 | ||
![]() |
f99f511155 | ||
![]() |
9a18ba042f | ||
![]() |
8e6641c19b | ||
![]() |
185573e701 | ||
![]() |
632e023ff4 | ||
![]() |
b8f482b9aa | ||
![]() |
aaedae60b4 | ||
![]() |
ff9aaf3afe | ||
![]() |
e6ffbb732a |
@@ -138,6 +138,7 @@ set(INTERNAL_HEADERS
|
||||
${HEADER_DIR}/internal/catch_enforce.h
|
||||
${HEADER_DIR}/internal/catch_errno_guard.h
|
||||
${HEADER_DIR}/internal/catch_exception_translator_registry.h
|
||||
${HEADER_DIR}/internal/catch_external_interfaces.h
|
||||
${HEADER_DIR}/internal/catch_fatal_condition.h
|
||||
${HEADER_DIR}/internal/catch_impl.hpp
|
||||
${HEADER_DIR}/internal/catch_interfaces_capture.h
|
||||
|
@@ -4,7 +4,7 @@ from conans import ConanFile
|
||||
|
||||
class CatchConan(ConanFile):
|
||||
name = "Catch"
|
||||
version = "1.9.6"
|
||||
version = "2.0.0-develop.2"
|
||||
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
|
||||
author = "philsquared"
|
||||
generators = "cmake"
|
||||
|
@@ -25,6 +25,9 @@ The core part of the Chakra Javascript engine that powers Microsoft Edge
|
||||
### [ChaiScript](https://github.com/ChaiScript/ChaiScript)
|
||||
A, header-only, embedded scripting language designed from the ground up to directly target C++ and take advantage of modern C++ development techniques
|
||||
|
||||
### [Clara](https://github.com/philsquared/Clara)
|
||||
A, single-header-only, type-safe, command line parser - which also prints formatted usage strings.
|
||||
|
||||
### [Couchbase-lite-core](https://github.com/couchbase/couchbase-lite-core)
|
||||
The next-generation core storage and query engine for Couchbase Lite/
|
||||
|
||||
@@ -52,6 +55,9 @@ A C++ client library for Consul. Consul is a distributed tool for discovering an
|
||||
### [Reactive-Extensions/ RxCpp](https://github.com/Reactive-Extensions/RxCpp)
|
||||
A library of algorithms for values-distributed-in-time
|
||||
|
||||
### [TextFlowCpp](https://github.com/philsquared/textflowcpp)
|
||||
A small, single-header-only, library for wrapping and composing columns of text
|
||||
|
||||
### [Trompeloeil](https://github.com/rollbear/trompeloeil)
|
||||
A thread safe header only mocking framework for C++14
|
||||
|
||||
|
@@ -19,6 +19,7 @@
|
||||
|
||||
#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)
|
||||
# define CATCH_IMPL
|
||||
# define CATCH_CONFIG_EXTERNAL_INTERFACES
|
||||
#endif
|
||||
|
||||
#ifdef CATCH_IMPL
|
||||
@@ -52,6 +53,10 @@
|
||||
#include "internal/catch_objc.hpp"
|
||||
#endif
|
||||
|
||||
#ifdef CATCH_CONFIG_EXTERNAL_INTERFACES
|
||||
#include "internal/catch_external_interfaces.h"
|
||||
#endif
|
||||
|
||||
#ifdef CATCH_IMPL
|
||||
#include "internal/catch_impl.hpp"
|
||||
#endif
|
||||
@@ -115,8 +120,6 @@
|
||||
|
||||
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
|
||||
|
||||
#define CATCH_REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
|
||||
|
||||
// "BDD-style" convenience wrappers
|
||||
#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ )
|
||||
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
|
||||
@@ -175,8 +178,6 @@
|
||||
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
|
||||
|
||||
#define REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
|
||||
|
||||
#endif
|
||||
|
||||
#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )
|
||||
|
@@ -13,6 +13,13 @@
|
||||
namespace Catch {
|
||||
namespace Detail {
|
||||
|
||||
double max(double lhs, double rhs) {
|
||||
if (lhs < rhs) {
|
||||
return rhs;
|
||||
}
|
||||
return lhs;
|
||||
}
|
||||
|
||||
Approx::Approx ( double value )
|
||||
: m_epsilon( std::numeric_limits<float>::epsilon()*100 ),
|
||||
m_margin( 0.0 ),
|
||||
|
@@ -10,7 +10,6 @@
|
||||
|
||||
#include "catch_tostring.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include <type_traits>
|
||||
@@ -18,6 +17,8 @@
|
||||
namespace Catch {
|
||||
namespace Detail {
|
||||
|
||||
double max(double lhs, double rhs);
|
||||
|
||||
class Approx {
|
||||
public:
|
||||
explicit Approx ( double value );
|
||||
@@ -42,7 +43,7 @@ namespace Detail {
|
||||
friend bool operator == ( const T& lhs, Approx const& rhs ) {
|
||||
// Thanks to Richard Harris for his help refining this formula
|
||||
auto lhs_v = static_cast<double>(lhs);
|
||||
bool relativeOK = std::fabs(lhs_v - rhs.m_value) < rhs.m_epsilon * (rhs.m_scale + (std::max)(std::fabs(lhs_v), std::fabs(rhs.m_value)));
|
||||
bool relativeOK = std::fabs(lhs_v - rhs.m_value) < rhs.m_epsilon * (rhs.m_scale + (max)(std::fabs(lhs_v), std::fabs(rhs.m_value)));
|
||||
if (relativeOK) {
|
||||
return true;
|
||||
}
|
||||
|
@@ -16,7 +16,8 @@ namespace Catch {
|
||||
// There is another overload, in catch_assertinhandler.h/.cpp, that only takes a string and infers
|
||||
// the Equals matcher (so the header does not mention matchers)
|
||||
void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) {
|
||||
MatchExpr<std::string, StringMatcher const&> expr( Catch::translateActiveException(), matcher, matcherString );
|
||||
std::string exceptionMessage = Catch::translateActiveException();
|
||||
MatchExpr<std::string, StringMatcher const&> expr( exceptionMessage, matcher, matcherString );
|
||||
handler.handle( expr );
|
||||
}
|
||||
|
||||
|
@@ -135,7 +135,7 @@ namespace Catch {
|
||||
+ Opt( setWarning, "warning name" )
|
||||
["-w"]["--warn"]
|
||||
( "enable warnings" )
|
||||
+ Opt( [&]( bool ) { config.showDurations = ShowDurations::Always; } )
|
||||
+ Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
|
||||
["-d"]["--durations"]
|
||||
( "show test durations" )
|
||||
+ Opt( loadTestNamesFromFile, "filename" )
|
||||
|
@@ -76,14 +76,14 @@ namespace Catch {
|
||||
|
||||
// Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)
|
||||
template<typename LhsT, typename RhsT>
|
||||
auto compareEqual( LhsT lhs, RhsT&& rhs ) -> bool { return lhs == rhs; };
|
||||
auto compareEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast<LhsT&>( lhs ) == rhs; };
|
||||
template<typename T>
|
||||
auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); };
|
||||
template<typename T>
|
||||
auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; };
|
||||
|
||||
template<typename LhsT, typename RhsT>
|
||||
auto compareNotEqual( LhsT lhs, RhsT&& rhs ) -> bool { return lhs != rhs; };
|
||||
auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast<LhsT&>( lhs ) != rhs; };
|
||||
template<typename T>
|
||||
auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); };
|
||||
template<typename T>
|
||||
|
13
include/internal/catch_external_interfaces.h
Normal file
13
include/internal/catch_external_interfaces.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Created by Martin on 17/08/2017.
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H
|
||||
#define TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H
|
||||
|
||||
#include "../reporters/catch_reporter_bases.hpp"
|
||||
#include "catch_reporter_registrars.hpp"
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H
|
@@ -1,3 +1,4 @@
|
||||
|
||||
/*
|
||||
* Created by Phil on 31/12/2010.
|
||||
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
||||
@@ -39,7 +40,7 @@ namespace Catch {
|
||||
class ListenerFactory : public IReporterFactory {
|
||||
|
||||
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override {
|
||||
return std::make_shared<T>( config );
|
||||
return std::unique_ptr<T>( new T( config ) );
|
||||
}
|
||||
virtual std::string getDescription() const override {
|
||||
return std::string();
|
||||
@@ -54,13 +55,9 @@ namespace Catch {
|
||||
};
|
||||
}
|
||||
|
||||
#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
|
||||
#define CATCH_REGISTER_REPORTER( name, reporterType ) \
|
||||
namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); }
|
||||
|
||||
// Deprecated - use the form without INTERNAL_
|
||||
#define INTERNAL_CATCH_REGISTER_LISTENER( listenerType ) \
|
||||
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; }
|
||||
|
||||
#define CATCH_REGISTER_LISTENER( listenerType ) \
|
||||
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; }
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#ifndef TWOBLUECUBES_CATCH_TIMER_H_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_TIMER_H_INCLUDED
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
|
@@ -37,7 +37,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
Version const& libraryVersion() {
|
||||
static Version version( 2, 0, 0, "develop", 1 );
|
||||
static Version version( 2, 0, 0, "develop", 2 );
|
||||
return version;
|
||||
}
|
||||
|
||||
|
@@ -55,7 +55,7 @@ namespace Catch {
|
||||
AutomakeReporter::~AutomakeReporter() {}
|
||||
#endif
|
||||
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "automake", AutomakeReporter)
|
||||
CATCH_REGISTER_REPORTER( "automake", AutomakeReporter)
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
|
@@ -299,6 +299,6 @@ namespace Catch {
|
||||
|
||||
CompactReporter::~CompactReporter() {}
|
||||
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "compact", CompactReporter )
|
||||
CATCH_REGISTER_REPORTER( "compact", CompactReporter )
|
||||
|
||||
} // end namespace Catch
|
||||
|
@@ -634,7 +634,7 @@ namespace Catch {
|
||||
bool m_headerPrinted = false;
|
||||
};
|
||||
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "console", ConsoleReporter )
|
||||
CATCH_REGISTER_REPORTER( "console", ConsoleReporter )
|
||||
|
||||
ConsoleReporter::~ConsoleReporter() {}
|
||||
|
||||
|
@@ -251,6 +251,6 @@ namespace Catch {
|
||||
};
|
||||
|
||||
JunitReporter::~JunitReporter() {}
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )
|
||||
CATCH_REGISTER_REPORTER( "junit", JunitReporter )
|
||||
|
||||
} // end namespace Catch
|
||||
|
@@ -248,7 +248,7 @@ namespace Catch {
|
||||
TAPReporter::~TAPReporter() {}
|
||||
#endif
|
||||
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "tap", TAPReporter )
|
||||
CATCH_REGISTER_REPORTER( "tap", TAPReporter )
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
|
@@ -206,7 +206,7 @@ namespace Catch {
|
||||
TeamCityReporter::~TeamCityReporter() {}
|
||||
#endif
|
||||
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "teamcity", TeamCityReporter )
|
||||
CATCH_REGISTER_REPORTER( "teamcity", TeamCityReporter )
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
|
@@ -220,6 +220,6 @@ namespace Catch {
|
||||
};
|
||||
|
||||
XmlReporter::~XmlReporter() {}
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter )
|
||||
CATCH_REGISTER_REPORTER( "xml", XmlReporter )
|
||||
|
||||
} // end namespace Catch
|
||||
|
@@ -1020,6 +1020,6 @@ with expansion:
|
||||
"{?}" == "1"
|
||||
|
||||
===============================================================================
|
||||
test cases: 182 | 131 passed | 47 failed | 4 failed as expected
|
||||
assertions: 881 | 764 passed | 96 failed | 21 failed as expected
|
||||
test cases: 183 | 132 passed | 47 failed | 4 failed as expected
|
||||
assertions: 882 | 765 passed | 96 failed | 21 failed as expected
|
||||
|
||||
|
@@ -6672,6 +6672,18 @@ PASSED:
|
||||
with expansion:
|
||||
"7" == "7"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
non-copyable objects
|
||||
-------------------------------------------------------------------------------
|
||||
TrickyTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
TrickyTests.cpp:<line number>:
|
||||
PASSED:
|
||||
CHECK( ti == typeid(int) )
|
||||
with expansion:
|
||||
{?} == {?}
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
not allowed
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -7523,6 +7535,6 @@ MiscTests.cpp:<line number>:
|
||||
PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 182 | 128 passed | 50 failed | 4 failed as expected
|
||||
assertions: 883 | 760 passed | 102 failed | 21 failed as expected
|
||||
test cases: 183 | 129 passed | 50 failed | 4 failed as expected
|
||||
assertions: 884 | 761 passed | 102 failed | 21 failed as expected
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuitesloose text artifact
|
||||
>
|
||||
<testsuite name="<exe-name>" errors="15" failures="88" tests="884" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testsuite name="<exe-name>" errors="15" failures="88" tests="885" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}">
|
||||
<error type="TEST_CASE">
|
||||
@@ -725,6 +725,7 @@ MiscTests.cpp:<line number>
|
||||
<testcase classname="<exe-name>.global" name="nested SECTION tests/s1" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="nested SECTION tests/s1/s2" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="non streamable - with conv. op" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="non-copyable objects" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="not allowed" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="null strings" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="null_ptr" time="{duration}"/>
|
||||
|
@@ -7433,6 +7433,17 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="non-copyable objects" tags="[.][failing][hide]" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<Original>
|
||||
ti == typeid(int)
|
||||
</Original>
|
||||
<Expanded>
|
||||
{?} == {?}
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="not allowed" tags="[!throws]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
@@ -8276,7 +8287,7 @@ loose text artifact
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="760" failures="103" expectedFailures="21"/>
|
||||
<OverallResults successes="761" failures="103" expectedFailures="21"/>
|
||||
</Group>
|
||||
<OverallResults successes="760" failures="102" expectedFailures="21"/>
|
||||
<OverallResults successes="761" failures="102" expectedFailures="21"/>
|
||||
</Catch>
|
||||
|
@@ -24,25 +24,11 @@ CATCH_REGISTER_TAG_ALIAS( "[@tricky]", "[tricky]~[.]" )
|
||||
# pragma clang diagnostic ignored "-Wc++98-compat"
|
||||
#endif
|
||||
|
||||
struct TestListener : Catch::TestEventListenerBase {
|
||||
using TestEventListenerBase::TestEventListenerBase; // inherit constructor
|
||||
};
|
||||
CATCH_REGISTER_LISTENER( TestListener );
|
||||
|
||||
//template<size_t size>
|
||||
//void parseIntoConfig( const char * (&argv)[size], Catch::ConfigData& config ) {
|
||||
// auto parser = Catch::makeCommandLineParser();
|
||||
// parser.parseInto( Catch::Clara::argsToVector( size, argv ), config );
|
||||
//}
|
||||
//
|
||||
//template<size_t size>
|
||||
//std::string parseIntoConfigAndReturnError( const char * (&argv)[size], Catch::ConfigData& config ) {
|
||||
// try {
|
||||
// parseIntoConfig( argv, config );
|
||||
// FAIL( "expected exception" );
|
||||
// }
|
||||
// catch( std::exception& ex ) {
|
||||
// return ex.what();
|
||||
// }
|
||||
// return "";
|
||||
//}
|
||||
//
|
||||
inline Catch::TestCase fakeTestCase( const char* name, const char* desc = "" ){ return Catch::makeTestCase( nullptr, "", name, desc, CATCH_INTERNAL_LINEINFO ); }
|
||||
|
||||
TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) {
|
||||
|
@@ -435,3 +435,9 @@ TEST_CASE( "null deref", "[.][failing][!nonportable]" ) {
|
||||
int *x = NULL;
|
||||
*x = 1;
|
||||
}
|
||||
|
||||
TEST_CASE( "non-copyable objects", "[.][failing]" ) {
|
||||
// Thanks to Agustin Bergé (@k-ballo on the cpplang Slack) for raising this
|
||||
std::type_info const& ti = typeid(int);
|
||||
CHECK( ti == typeid(int) );
|
||||
}
|
||||
|
@@ -71,6 +71,7 @@ def parseFile( path, filename ):
|
||||
for line in f:
|
||||
if '// ~*~* CATCH_CPP_STITCH_PLACE *~*~' in line:
|
||||
insertCpps()
|
||||
continue
|
||||
elif ifParser.match( line ):
|
||||
ifdefs = ifdefs + 1
|
||||
elif endIfParser.match( line ):
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Catch v2.0.0-develop.1
|
||||
* Generated: 2017-08-17 08:29:20.059622
|
||||
* Catch v2.0.0-develop.2
|
||||
* Generated: 2017-08-18 15:57:31.231591
|
||||
* ----------------------------------------------------------
|
||||
* This file has been merged from multiple headers. Please don't edit it directly
|
||||
* Copyright (c) 2017 Two Blue Cubes Ltd. All rights reserved.
|
||||
@@ -46,6 +46,7 @@
|
||||
// end catch_suppress_warnings.h
|
||||
#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)
|
||||
# define CATCH_IMPL
|
||||
# define CATCH_CONFIG_EXTERNAL_INTERFACES
|
||||
#endif
|
||||
|
||||
#ifdef CATCH_IMPL
|
||||
@@ -914,14 +915,14 @@ namespace Catch {
|
||||
|
||||
// Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)
|
||||
template<typename LhsT, typename RhsT>
|
||||
auto compareEqual( LhsT lhs, RhsT&& rhs ) -> bool { return lhs == rhs; };
|
||||
auto compareEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast<LhsT&>( lhs ) == rhs; };
|
||||
template<typename T>
|
||||
auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); };
|
||||
template<typename T>
|
||||
auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; };
|
||||
|
||||
template<typename LhsT, typename RhsT>
|
||||
auto compareNotEqual( LhsT lhs, RhsT&& rhs ) -> bool { return lhs != rhs; };
|
||||
auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast<LhsT&>( lhs ) != rhs; };
|
||||
template<typename T>
|
||||
auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); };
|
||||
template<typename T>
|
||||
@@ -1493,7 +1494,7 @@ namespace Catch {
|
||||
// end catch_section_info.h
|
||||
// start catch_timer.h
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
@@ -1701,7 +1702,6 @@ namespace Catch {
|
||||
// end catch_interfaces_exception.h
|
||||
// start catch_approx.hpp
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include <type_traits>
|
||||
@@ -1709,6 +1709,8 @@ namespace Catch {
|
||||
namespace Catch {
|
||||
namespace Detail {
|
||||
|
||||
double max(double lhs, double rhs);
|
||||
|
||||
class Approx {
|
||||
public:
|
||||
explicit Approx ( double value );
|
||||
@@ -1732,7 +1734,7 @@ namespace Detail {
|
||||
friend bool operator == ( const T& lhs, Approx const& rhs ) {
|
||||
// Thanks to Richard Harris for his help refining this formula
|
||||
auto lhs_v = static_cast<double>(lhs);
|
||||
bool relativeOK = std::fabs(lhs_v - rhs.m_value) < rhs.m_epsilon * (rhs.m_scale + (std::max)(std::fabs(lhs_v), std::fabs(rhs.m_value)));
|
||||
bool relativeOK = std::fabs(lhs_v - rhs.m_value) < rhs.m_epsilon * (rhs.m_scale + (max)(std::fabs(lhs_v), std::fabs(rhs.m_value)));
|
||||
if (relativeOK) {
|
||||
return true;
|
||||
}
|
||||
@@ -2536,43 +2538,11 @@ return @ desc; \
|
||||
// end catch_objc.hpp
|
||||
#endif
|
||||
|
||||
#ifdef CATCH_IMPL
|
||||
// start catch_impl.hpp
|
||||
#ifdef CATCH_CONFIG_EXTERNAL_INTERFACES
|
||||
// start catch_external_interfaces.h
|
||||
#ifndef TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H
|
||||
#define TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H
|
||||
|
||||
// Collect all the implementation files together here
|
||||
// These are the equivalent of what would usually be cpp files
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wweak-vtables"
|
||||
#endif
|
||||
|
||||
// start catch_notimplemented_exception.h
|
||||
|
||||
#include <exception>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
class NotImplementedException : public std::exception
|
||||
{
|
||||
public:
|
||||
NotImplementedException( SourceLineInfo const& lineInfo );
|
||||
|
||||
virtual ~NotImplementedException() noexcept = default;
|
||||
|
||||
virtual const char* what() const noexcept override;
|
||||
|
||||
private:
|
||||
std::string m_what;
|
||||
};
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define CATCH_NOT_IMPLEMENTED throw Catch::NotImplementedException( CATCH_INTERNAL_LINEINFO )
|
||||
|
||||
// end catch_notimplemented_exception.h
|
||||
// Temporary hack to fix separately provided reporters
|
||||
// start catch_reporter_bases.hpp
|
||||
|
||||
// start catch_enforce.h
|
||||
@@ -3596,6 +3566,7 @@ namespace Catch {
|
||||
// end catch_reporter_bases.hpp
|
||||
// start catch_reporter_registrars.hpp
|
||||
|
||||
|
||||
namespace Catch {
|
||||
|
||||
template<typename T>
|
||||
@@ -3625,7 +3596,7 @@ namespace Catch {
|
||||
class ListenerFactory : public IReporterFactory {
|
||||
|
||||
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override {
|
||||
return std::make_shared<T>( config );
|
||||
return std::unique_ptr<T>( new T( config ) );
|
||||
}
|
||||
virtual std::string getDescription() const override {
|
||||
return std::string();
|
||||
@@ -3640,17 +3611,54 @@ namespace Catch {
|
||||
};
|
||||
}
|
||||
|
||||
#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
|
||||
#define CATCH_REGISTER_REPORTER( name, reporterType ) \
|
||||
namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); }
|
||||
|
||||
// Deprecated - use the form without INTERNAL_
|
||||
#define INTERNAL_CATCH_REGISTER_LISTENER( listenerType ) \
|
||||
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; }
|
||||
|
||||
#define CATCH_REGISTER_LISTENER( listenerType ) \
|
||||
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; }
|
||||
|
||||
// end catch_reporter_registrars.hpp
|
||||
#endif // TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H
|
||||
// end catch_external_interfaces.h
|
||||
#endif
|
||||
|
||||
#ifdef CATCH_IMPL
|
||||
// start catch_impl.hpp
|
||||
|
||||
// Collect all the implementation files together here
|
||||
// These are the equivalent of what would usually be cpp files
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wweak-vtables"
|
||||
#endif
|
||||
|
||||
// start catch_notimplemented_exception.h
|
||||
|
||||
#include <exception>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
class NotImplementedException : public std::exception
|
||||
{
|
||||
public:
|
||||
NotImplementedException( SourceLineInfo const& lineInfo );
|
||||
|
||||
virtual ~NotImplementedException() noexcept = default;
|
||||
|
||||
virtual const char* what() const noexcept override;
|
||||
|
||||
private:
|
||||
std::string m_what;
|
||||
};
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define CATCH_NOT_IMPLEMENTED throw Catch::NotImplementedException( CATCH_INTERNAL_LINEINFO )
|
||||
|
||||
// end catch_notimplemented_exception.h
|
||||
// Temporary hack to fix separately provided reporters
|
||||
//
|
||||
|
||||
// start catch_leak_detector.h
|
||||
@@ -5696,6 +5704,13 @@ namespace Catch {
|
||||
namespace Catch {
|
||||
namespace Detail {
|
||||
|
||||
double max(double lhs, double rhs) {
|
||||
if (lhs < rhs) {
|
||||
return rhs;
|
||||
}
|
||||
return lhs;
|
||||
}
|
||||
|
||||
Approx::Approx ( double value )
|
||||
: m_epsilon( std::numeric_limits<float>::epsilon()*100 ),
|
||||
m_margin( 0.0 ),
|
||||
@@ -5978,7 +5993,8 @@ namespace Catch {
|
||||
// There is another overload, in catch_assertinhandler.h/.cpp, that only takes a string and infers
|
||||
// the Equals matcher (so the header does not mention matchers)
|
||||
void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) {
|
||||
MatchExpr<std::string, StringMatcher const&> expr( Catch::translateActiveException(), matcher, matcherString );
|
||||
std::string exceptionMessage = Catch::translateActiveException();
|
||||
MatchExpr<std::string, StringMatcher const&> expr( exceptionMessage, matcher, matcherString );
|
||||
handler.handle( expr );
|
||||
}
|
||||
|
||||
@@ -6111,7 +6127,7 @@ namespace Catch {
|
||||
+ Opt( setWarning, "warning name" )
|
||||
["-w"]["--warn"]
|
||||
( "enable warnings" )
|
||||
+ Opt( [&]( bool ) { config.showDurations = ShowDurations::Always; } )
|
||||
+ Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
|
||||
["-d"]["--durations"]
|
||||
( "show test durations" )
|
||||
+ Opt( loadTestNamesFromFile, "filename" )
|
||||
@@ -9484,7 +9500,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
Version const& libraryVersion() {
|
||||
static Version version( 2, 0, 0, "develop", 1 );
|
||||
static Version version( 2, 0, 0, "develop", 2 );
|
||||
return version;
|
||||
}
|
||||
|
||||
@@ -10143,7 +10159,7 @@ namespace Catch {
|
||||
|
||||
CompactReporter::~CompactReporter() {}
|
||||
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "compact", CompactReporter )
|
||||
CATCH_REGISTER_REPORTER( "compact", CompactReporter )
|
||||
|
||||
} // end namespace Catch
|
||||
// end catch_reporter_compact.cpp
|
||||
@@ -10768,7 +10784,7 @@ namespace Catch {
|
||||
bool m_headerPrinted = false;
|
||||
};
|
||||
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "console", ConsoleReporter )
|
||||
CATCH_REGISTER_REPORTER( "console", ConsoleReporter )
|
||||
|
||||
ConsoleReporter::~ConsoleReporter() {}
|
||||
|
||||
@@ -11014,7 +11030,7 @@ namespace Catch {
|
||||
};
|
||||
|
||||
JunitReporter::~JunitReporter() {}
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )
|
||||
CATCH_REGISTER_REPORTER( "junit", JunitReporter )
|
||||
|
||||
} // end namespace Catch
|
||||
// end catch_reporter_junit.cpp
|
||||
@@ -11311,11 +11327,10 @@ namespace Catch {
|
||||
};
|
||||
|
||||
XmlReporter::~XmlReporter() {}
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter )
|
||||
CATCH_REGISTER_REPORTER( "xml", XmlReporter )
|
||||
|
||||
} // end namespace Catch
|
||||
// end catch_reporter_xml.cpp
|
||||
// ~*~* CATCH_CPP_STITCH_PLACE *~*~
|
||||
|
||||
namespace Catch {
|
||||
LeakDetector leakDetector;
|
||||
@@ -11443,8 +11458,6 @@ int main (int argc, char * const argv[]) {
|
||||
|
||||
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
|
||||
|
||||
#define CATCH_REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
|
||||
|
||||
// "BDD-style" convenience wrappers
|
||||
#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ )
|
||||
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
|
||||
@@ -11502,8 +11515,6 @@ int main (int argc, char * const argv[]) {
|
||||
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
|
||||
|
||||
#define REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
|
||||
|
||||
#endif
|
||||
|
||||
#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )
|
||||
|
@@ -10,7 +10,7 @@ class CatchConanTest(ConanFile):
|
||||
settings = "os", "compiler", "arch", "build_type"
|
||||
username = getenv("CONAN_USERNAME", "philsquared")
|
||||
channel = getenv("CONAN_CHANNEL", "testing")
|
||||
requires = "Catch/1.9.5@%s/%s" % (username, channel)
|
||||
requires = "Catch/2.0.0-develop.2@%s/%s" % (username, channel)
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
|
Reference in New Issue
Block a user