From 5d6c1f4dd04a9794c16850261b57a56101e2bfae Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 18 Aug 2017 15:58:00 +0100 Subject: [PATCH] Dev build 2 --- conanfile.py | 2 +- include/internal/catch_version.cpp | 2 +- single_include/catch.hpp | 133 ++++++++++++++++------------- test_package/conanfile.py | 2 +- 4 files changed, 75 insertions(+), 64 deletions(-) diff --git a/conanfile.py b/conanfile.py index 3565eb6d..4b7990a6 100644 --- a/conanfile.py +++ b/conanfile.py @@ -4,7 +4,7 @@ from conans import ConanFile class CatchConan(ConanFile): name = "Catch" - version = "2.0.0-develop.1" + version = "2.0.0-develop.2" description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD" author = "philsquared" generators = "cmake" diff --git a/include/internal/catch_version.cpp b/include/internal/catch_version.cpp index 6f13d8a5..96e66d5a 100644 --- a/include/internal/catch_version.cpp +++ b/include/internal/catch_version.cpp @@ -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; } diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 77035aa9..2b440890 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -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 - auto compareEqual( LhsT lhs, RhsT&& rhs ) -> bool { return lhs == rhs; }; + auto compareEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast( lhs ) == rhs; }; template auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast( rhs ); }; template auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; }; template - auto compareNotEqual( LhsT lhs, RhsT&& rhs ) -> bool { return lhs != rhs; }; + auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast( lhs ) != rhs; }; template auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast( rhs ); }; template @@ -1493,7 +1494,7 @@ namespace Catch { // end catch_section_info.h // start catch_timer.h -#include +#include namespace Catch { @@ -1701,7 +1702,6 @@ namespace Catch { // end catch_interfaces_exception.h // start catch_approx.hpp -#include #include #include @@ -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(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 - -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 @@ -3625,7 +3596,7 @@ namespace Catch { class ListenerFactory : public IReporterFactory { virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override { - return std::make_shared( config ); + return std::unique_ptr( 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 catch_internal_RegistrarFor##reporterType( name ); } -// Deprecated - use the form without INTERNAL_ -#define INTERNAL_CATCH_REGISTER_LISTENER( listenerType ) \ - namespace{ Catch::ListenerRegistrar catch_internal_RegistrarFor##listenerType; } - #define CATCH_REGISTER_LISTENER( listenerType ) \ namespace{ Catch::ListenerRegistrar 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 + +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::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 expr( Catch::translateActiveException(), matcher, matcherString ); + std::string exceptionMessage = Catch::translateActiveException(); + MatchExpr 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 ) diff --git a/test_package/conanfile.py b/test_package/conanfile.py index 56665718..c96cf111 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -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/2.0.0-develop.1@%s/%s" % (username, channel) + requires = "Catch/2.0.0-develop.2@%s/%s" % (username, channel) def build(self): cmake = CMake(self)