diff --git a/.gitattributes b/.gitattributes
index c3de12cbe..3835aa7b7 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -49,7 +49,8 @@ src/utils/*.hpp licensefile=.githooks/LICENSE-C++
src/utils/*.cpp licensefile=.githooks/LICENSE-C++
src/utils/cnpy.hpp !licensefile
src/utils/cnpy.cpp !licensefile
-src/utils/legendre.h !licensefile
+src/utils/Legendre.hpp !licensefile
+src/utils/RungeKutta4.* !licensefile
# tests
tests/unit_tests.cpp licensefile=.githooks/LICENSE-C++
diff --git a/.travis.yml b/.travis.yml
index 9b20032df..b3527fbdc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -61,21 +61,21 @@ matrix:
env:
- CXX_COMPILER='clang++'
- C_COMPILER='clang'
- - Fortran_COMPILER='gfortran-5'
+ - Fortran_COMPILER='gfortran-6'
- BUILD_TYPE='release'
- PYTHON='python2'
- - HOMEBREW_GCC='gcc@5'
+ - HOMEBREW_GCC='gcc@6'
- STATIC='--static'
- RUN_DANGER=false
- os: osx
osx_image: xcode7.3
env:
- - CXX_COMPILER='g++-6'
- - C_COMPILER='gcc-6'
- - Fortran_COMPILER='gfortran-6'
+ - CXX_COMPILER='clang++'
+ - C_COMPILER='clang'
+ - Fortran_COMPILER='gfortran-7'
- BUILD_TYPE='release'
- PYTHON='python3'
- - HOMEBREW_GCC='gcc@6'
+ - HOMEBREW_GCC='gcc@7'
- RUN_DANGER=false
- os: linux
@@ -107,7 +107,7 @@ install:
- |
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
brew update
- brew install ${HOMEBREW_GCC} ${PYTHON} boost ccache cmake
+ brew install ${HOMEBREW_GCC} ${PYTHON} boost ccache cmake zlib
pip install virtualenv --upgrade
export PATH="/usr/local/opt/ccache/libexec:$PATH"
else
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8d7e5697b..23ac6fe68 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,8 +11,24 @@
### Changed
+- Dispatching of Green’s functions in the factory is purely label-based. The
+ input reader generates a string that holds the type of the Green’s function,
+ the strategy for calculating its normal derivatives and the dielectric
+ profile (if needed): `TYPE_DERIVATIVE_PROFILE`. The Green’s functions are
+ subscribed to the factory using this label, which is then also the one used
+ for their creation. Iteration over _lists of types_ to dispatch the correct
+ template parameters is thus completely avoided. This removes the dependency
+ on the metafunctions in `ForId.hpp` and the dependency on Boost.MPL, the
+ Boost metaprogramming library.
+- Dispatching of quadrature rules for the numerical boundary integral operator
+ has been rewritten, removing the dependency on Boost.MPL.
+- The input wrapping data `struct`-s have been modified to include the string
+ defining the type of object and to remove now unused information.
- Documentation building is fully handled _via_ `sphinx-build`: CMake will no longer generate a `doc` build target.
- Simplified `.travis.yml` and got rid of Conda to handle multiple Python versions.
+- The [Catch unit test framework](https://github.com/philsquared/Catch) has
+ been updated to its latest version still supporting C++03
+ [v1.11.0](https://github.com/philsquared/Catch/releases/tag/v1.11.0)
### Fixed
@@ -26,6 +42,24 @@
- `FortranCUtils` header and source files were removed. The `pcmsolver_f2c_string` and `pcmsolver_c2f_string`
functions are thus gone. For the former, use the replacement
`pcmsolver_fstring_to_carray` function provided in the Fortran bindings to the library.
+- Some unused files have been removed:
+ * `Interpolation.hpp`
+ * `Interpolation.cpp`
+ * `Vector2.hpp`
+ * `Vector3.hpp`
+ * `ForId.hpp`
+ * `DerivativeUtils.hpp`
+- The `cavityType()`, `solverType()`, `greenInsideType()`, `greenOutsideType()`
+ and `integratorType()` functions in the `Input` object have been removed.
+ This information is now wrapped into the corresponding input-wrapping
+ `struct`-s: `CavityData`, `SolverData`, `GreenData` and `BIOperatorData`.
+
+### Deprecated
+
+- We are in the process of removing the dependency on the Boost libraries. The
+ only dependency on Boost allowed in the 1.Y.Z release series will be for
+ replacing C++11 functionality that is missing from the C++98 standard. For
+ such code, we will require a pure C++11 counterpart.
## [Version 1.1.11] - 2017-10-25
@@ -378,7 +412,7 @@
## v1.0.0 - 2014-09-30 [YANKED]
-[Unreleased]: https://github.com/PCMSolver/pcmsolver/compare/v1.1.11..HEAD
+[Unreleased]: https://github.com/PCMSolver/pcmsolver/compare/v1.1.11...HEAD
[Version 1.1.11]: https://github.com/PCMSolver/pcmsolver/compare/v1.1.10...v1.1.11
[Version 1.1.10]: https://github.com/PCMSolver/pcmsolver/compare/v1.1.9...v1.1.10
[Version 1.1.9]: https://github.com/PCMSolver/pcmsolver/compare/v1.1.8...v1.1.9
diff --git a/README.md b/README.md
index 6635d0c17..6ec8fffc0 100644
--- a/README.md
+++ b/README.md
@@ -47,9 +47,9 @@ Travis CI runs release builds using [ccache](https://ccache.samba.org/) to speed
with their Xcode 7.3.1 image.
The following compilers are used:
- 1. Apple Clang 7.3.0, GFortran 5.5.0, Python 2.7 This build generates _only_
+ 1. Apple Clang 7.3.0, GFortran 6.4.0, Python 2.7 This build generates _only_
the static library.
- 2. GCC 6.4.0, Python 3.6 This build generates _both_ the shared and static
+ 2. Apple Clang 7.3.0, GFortran 7.2.0, Python 3.6 This build generates _both_ the shared and static
libraries, linking executables to the former.
The build needed for submission to [Coverity scan](https://scan.coverity.com/)
diff --git a/default.nix b/default.nix
index 7c0283191..a69519e7e 100644
--- a/default.nix
+++ b/default.nix
@@ -24,6 +24,7 @@ in
gfortran
graphviz
lldb
+ python3Packages.docopt
python3Packages.matplotlib
python3Packages.numpy
python3Packages.pyyaml
diff --git a/doc/code-reference/greens-functions.rst b/doc/code-reference/greens-functions.rst
index 45f534eca..b94ee8cd4 100644
--- a/doc/code-reference/greens-functions.rst
+++ b/doc/code-reference/greens-functions.rst
@@ -7,6 +7,20 @@ Green's functions objects relies on the Factory Method pattern
:cite:`Gamma1994,Alexandrescu2001`, implemented through the
generic Factory class.
+The top-level header, _i.e._ to be included in client code, is `Green.hpp`.
+The common interface to all Green's function classes is specified by the `IGreensFunction` class,
+this is non-templated.
+All other classes are templated. TODO: explain template parameters.
+The Green's functions are registered to the factory based on a label encoding: type, derivative, and dielectric profile.
+The only allowed labels are:
+- `VACUUM_NUMERICAL`
+- `VACUUM_DERIVATIVE`
+- `VACUMM_GRADIENT`
+- `VACUUM_HESSIAN`
+
+- `SPHERICALDIFFUSE_TANH`
+- `SPHERICALDIFFUSE_ERF`
+
.. image:: ../gfx/green.png
:scale: 70 %
:align: center
diff --git a/doc/programmers/cmake-usage.rst b/doc/programmers/cmake-usage.rst
index 10d7be10a..b6ce451ef 100644
--- a/doc/programmers/cmake-usage.rst
+++ b/doc/programmers/cmake-usage.rst
@@ -6,7 +6,7 @@ This is a brief guide to our CMake infrastructure which is managed
.. warning::
- The minimum required CMake version is 2.8.8
+ The minimum required CMake version is 2.8.10
Adding new source subdirectories and/or files
---------------------------------------------
diff --git a/doc/programmers/general-structure.rst b/doc/programmers/general-structure.rst
index c303e965b..77ac65075 100644
--- a/doc/programmers/general-structure.rst
+++ b/doc/programmers/general-structure.rst
@@ -8,15 +8,18 @@ General Structure
External libraries:
+ parts of the C++ `Boost `_ libraries are used to provide
- various functionality, like timing and metaprogramming.
+ various functionality, like ordinary differential equations integrators.
The source for the 1.54.0 release is shipped with the
module's source code. Some of the libraries used
need to be compiled. Boost is released under the terms
of the `Boost Software License, v1.0 `_ (see also
- http://www.boost.org/users/license.html) We encourage the use of
- Boost whenever some functionality has already been coded within those
- libraries. However, consider **carefully** the introduction of functionality
- depending on compiler Boost libraries.
+ http://www.boost.org/users/license.html)
+
+ .. warning::
+
+ As of v1.1.11 we have started removing the dependency from Boost.
+ The use of Boost is thus deprecated.
+
+ the `Eigen `_ template
library for linear algebra. Almost every operation involving matrices and
vectors is performed through Eigen. Eigen provides convenient type
diff --git a/doc/users/input.rst b/doc/users/input.rst
index 642691f4d..cac3d1001 100644
--- a/doc/users/input.rst
+++ b/doc/users/input.rst
@@ -128,8 +128,7 @@ Cavity section keywords
* **Default**: empty string
Area
- Average area (weight) of the surface partition for the GePol (TsLess)
- cavity.
+ Average area (weight) of the surface partition for the GePol cavity.
* **Type**: double
* **Valid values**: :math:`d \geq 0.01\,\text{a.u.}^2`
diff --git a/external/Catch/catch.hpp b/external/Catch/catch.hpp
index 2a09fd193..849c53c13 100644
--- a/external/Catch/catch.hpp
+++ b/external/Catch/catch.hpp
@@ -1,6 +1,6 @@
/*
- * Catch v1.7.2
- * Generated: 2017-02-13 15:57:33.350226
+ * Catch v1.11.0
+ * Generated: 2017-10-31 13:42:42.914833
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@@ -40,6 +40,8 @@
#elif defined __GNUC__
# pragma GCC diagnostic ignored "-Wvariadic-macros"
# pragma GCC diagnostic ignored "-Wunused-variable"
+# pragma GCC diagnostic ignored "-Wparentheses"
+
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpadded"
#endif
@@ -82,6 +84,7 @@
// CATCH_CONFIG_VARIADIC_MACROS : are variadic macros supported?
// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported?
// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported?
+// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported?
// ****************
// Note to maintainers: if new toggles are added please document them
// in configuration.md, too
@@ -117,11 +120,46 @@
# endif
# if defined(CATCH_CPP11_OR_GREATER)
-# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS _Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
+# define CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
+ _Pragma( "clang diagnostic push" ) \
+ _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" )
+# define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
+ _Pragma( "clang diagnostic pop" )
+
+# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
+ _Pragma( "clang diagnostic push" ) \
+ _Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
+# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
+ _Pragma( "clang diagnostic pop" )
# endif
#endif // __clang__
+////////////////////////////////////////////////////////////////////////////////
+// We know some environments not to support full POSIX signals
+#if defined(__CYGWIN__) || defined(__QNX__)
+
+# if !defined(CATCH_CONFIG_POSIX_SIGNALS)
+# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
+# endif
+
+#endif
+
+#ifdef __OS400__
+# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
+# define CATCH_CONFIG_COLOUR_NONE
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+// Cygwin
+#ifdef __CYGWIN__
+
+// Required for some versions of Cygwin to declare gettimeofday
+// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin
+# define _BSD_SOURCE
+
+#endif // __CYGWIN__
+
////////////////////////////////////////////////////////////////////////////////
// Borland
#ifdef __BORLANDC__
@@ -148,10 +186,6 @@
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
# endif
-# if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) && defined(CATCH_CPP11_OR_GREATER)
-# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS _Pragma( "GCC diagnostic ignored \"-Wparentheses\"" )
-# endif
-
// - otherwise more recent versions define __cplusplus >= 201103L
// and will get picked up below
@@ -191,10 +225,15 @@
// Use __COUNTER__ if the compiler supports it
#if ( defined _MSC_VER && _MSC_VER >= 1300 ) || \
- ( defined __GNUC__ && __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 ) || \
+ ( defined __GNUC__ && ( __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3 )) ) || \
( defined __clang__ && __clang_major__ >= 3 )
-#define CATCH_INTERNAL_CONFIG_COUNTER
+// Use of __COUNTER__ is suppressed during code analysis in CLion/AppCode 2017.2.x and former,
+// because __COUNTER__ is not properly handled by it.
+// This does not affect compilation
+#if ( !defined __JETBRAINS_IDE__ || __JETBRAINS_IDE__ >= 20170300L )
+ #define CATCH_INTERNAL_CONFIG_COUNTER
+#endif
#endif
@@ -275,10 +314,7 @@
#if defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_CPP11_NO_UNIQUE_PTR) && !defined(CATCH_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_NO_CPP11)
# define CATCH_CONFIG_CPP11_UNIQUE_PTR
#endif
-// Use of __COUNTER__ is suppressed if __JETBRAINS_IDE__ is #defined (meaning we're being parsed by a JetBrains IDE for
-// analytics) because, at time of writing, __COUNTER__ is not properly handled by it.
-// This does not affect compilation
-#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) && !defined(__JETBRAINS_IDE__)
+#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
# define CATCH_CONFIG_COUNTER
#endif
#if defined(CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE) && !defined(CATCH_CONFIG_CPP11_NO_SHUFFLE) && !defined(CATCH_CONFIG_CPP11_SHUFFLE) && !defined(CATCH_CONFIG_NO_CPP11)
@@ -290,9 +326,18 @@
#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH)
# define CATCH_CONFIG_WINDOWS_SEH
#endif
+// This is set by default, because we assume that unix compilers are posix-signal-compatible by default.
+#if !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS)
+# define CATCH_CONFIG_POSIX_SIGNALS
+#endif
#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
+# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS
+#endif
+#if !defined(CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS)
+# define CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS
+# define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
#endif
// noexcept support:
@@ -376,14 +421,14 @@ namespace Catch {
};
template
- inline void deleteAll( ContainerT& container ) {
+ void deleteAll( ContainerT& container ) {
typename ContainerT::const_iterator it = container.begin();
typename ContainerT::const_iterator itEnd = container.end();
for(; it != itEnd; ++it )
delete *it;
}
template
- inline void deleteAllValues( AssociativeContainerT& container ) {
+ void deleteAllValues( AssociativeContainerT& container ) {
typename AssociativeContainerT::const_iterator it = container.begin();
typename AssociativeContainerT::const_iterator itEnd = container.end();
for(; it != itEnd; ++it )
@@ -463,7 +508,6 @@ namespace Catch {
{
public:
NotImplementedException( SourceLineInfo const& lineInfo );
- NotImplementedException( NotImplementedException const& ) {}
virtual ~NotImplementedException() CATCH_NOEXCEPT {}
@@ -732,59 +776,76 @@ void registerTestCaseFunction
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \
static void TestName(); \
- namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); }\
+ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
+ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); } /* NOLINT */ \
+ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
static void TestName()
#define INTERNAL_CATCH_TESTCASE( ... ) \
INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ )
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \
- namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); }
+ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
+ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); } /* NOLINT */ \
+ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\
+ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
namespace{ \
struct TestName : ClassName{ \
void test(); \
}; \
- Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &TestName::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 ); /* NOLINT */ \
} \
+ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
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, ... ) \
- Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) );
+ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
+ Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); /* NOLINT */ \
+ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
#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 ) ); }\
+ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
+ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) ); } /* NOLINT */ \
+ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
static void TestName()
#define INTERNAL_CATCH_TESTCASE( Name, Desc ) \
INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), Name, Desc )
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, Name, Desc ) \
- namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( Name, Desc ), CATCH_INTERNAL_LINEINFO ); }
+ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
+ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( Name, Desc ), CATCH_INTERNAL_LINEINFO ); } /* NOLINT */ \
+ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestCaseName, ClassName, TestName, Desc )\
+ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
namespace{ \
struct TestCaseName : ClassName{ \
void test(); \
}; \
- Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &TestCaseName::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 ); /* NOLINT */ \
} \
+ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
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 ) \
- Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) );
+ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
+ Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) ); /* NOLINT */ \
+ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
+
#endif
// #included from: internal/catch_capture.hpp
@@ -871,20 +932,25 @@ namespace Catch {
template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator % ( T const& );
template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator && ( T const& );
template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator || ( T const& );
+
+ private:
+ DecomposedExpression& operator = (DecomposedExpression const&);
};
struct AssertionInfo
{
- AssertionInfo() {}
- AssertionInfo( std::string const& _macroName,
+ AssertionInfo();
+ AssertionInfo( char const * _macroName,
SourceLineInfo const& _lineInfo,
- std::string const& _capturedExpression,
- ResultDisposition::Flags _resultDisposition );
+ char const * _capturedExpression,
+ ResultDisposition::Flags _resultDisposition,
+ char const * _secondArg = "");
- std::string macroName;
+ char const * macroName;
SourceLineInfo lineInfo;
- std::string capturedExpression;
+ char const * capturedExpression;
ResultDisposition::Flags resultDisposition;
+ char const * secondArg;
};
struct AssertionResultData
@@ -967,313 +1033,161 @@ namespace Catch {
namespace Matchers {
namespace Impl {
- namespace Generic {
- template class AllOf;
- template class AnyOf;
- template class Not;
- }
-
- template
- struct Matcher : SharedImpl
- {
- typedef ExpressionT ExpressionType;
-
- virtual ~Matcher() {}
- virtual Ptr clone() const = 0;
- virtual bool match( ExpressionT const& expr ) const = 0;
- virtual std::string toString() const = 0;
-
- Generic::AllOf operator && ( Matcher const& other ) const;
- Generic::AnyOf operator || ( Matcher const& other ) const;
- Generic::Not operator ! () const;
- };
-
- template
- struct MatcherImpl : Matcher {
-
- virtual Ptr > clone() const {
- return Ptr >( new DerivedT( static_cast( *this ) ) );
- }
- };
+ template struct MatchAllOf;
+ template struct MatchAnyOf;
+ template struct MatchNotOf;
- namespace Generic {
- template
- class Not : public MatcherImpl, ExpressionT> {
+ class MatcherUntypedBase {
public:
- explicit Not( Matcher const& matcher ) : m_matcher(matcher.clone()) {}
- Not( Not const& other ) : m_matcher( other.m_matcher ) {}
-
- virtual bool match( ExpressionT const& expr ) const CATCH_OVERRIDE {
- return !m_matcher->match( expr );
+ std::string toString() const {
+ if( m_cachedToString.empty() )
+ m_cachedToString = describe();
+ return m_cachedToString;
}
- virtual std::string toString() const CATCH_OVERRIDE {
- return "not " + m_matcher->toString();
- }
+ protected:
+ virtual ~MatcherUntypedBase();
+ virtual std::string describe() const = 0;
+ mutable std::string m_cachedToString;
private:
- Ptr< Matcher > m_matcher;
+ MatcherUntypedBase& operator = ( MatcherUntypedBase const& );
};
- template
- class AllOf : public MatcherImpl, ExpressionT> {
- public:
+ template
+ struct MatcherMethod {
+ virtual bool match( ObjectT const& arg ) const = 0;
+ };
+ template
+ struct MatcherMethod {
+ virtual bool match( PtrT* arg ) const = 0;
+ };
- AllOf() {}
- AllOf( AllOf const& other ) : m_matchers( other.m_matchers ) {}
+ template
+ struct MatcherBase : MatcherUntypedBase, MatcherMethod {
- AllOf& add( Matcher const& matcher ) {
- m_matchers.push_back( matcher.clone() );
- return *this;
- }
- virtual bool match( ExpressionT const& expr ) const
- {
- for( std::size_t i = 0; i < m_matchers.size(); ++i )
- if( !m_matchers[i]->match( expr ) )
+ MatchAllOf operator && ( MatcherBase const& other ) const;
+ MatchAnyOf operator || ( MatcherBase const& other ) const;
+ MatchNotOf operator ! () const;
+ };
+
+ template
+ struct MatchAllOf : MatcherBase {
+ virtual bool match( ArgT const& arg ) const CATCH_OVERRIDE {
+ for( std::size_t i = 0; i < m_matchers.size(); ++i ) {
+ if (!m_matchers[i]->match(arg))
return false;
+ }
return true;
}
- virtual std::string toString() const {
- std::ostringstream oss;
- oss << "( ";
+ virtual std::string describe() const CATCH_OVERRIDE {
+ std::string description;
+ description.reserve( 4 + m_matchers.size()*32 );
+ description += "( ";
for( std::size_t i = 0; i < m_matchers.size(); ++i ) {
if( i != 0 )
- oss << " and ";
- oss << m_matchers[i]->toString();
+ description += " and ";
+ description += m_matchers[i]->toString();
}
- oss << " )";
- return oss.str();
+ description += " )";
+ return description;
}
- AllOf operator && ( Matcher const& other ) const {
- AllOf allOfExpr( *this );
- allOfExpr.add( other );
- return allOfExpr;
+ MatchAllOf& operator && ( MatcherBase const& other ) {
+ m_matchers.push_back( &other );
+ return *this;
}
- private:
- std::vector > > m_matchers;
+ std::vector const*> m_matchers;
};
+ template
+ struct MatchAnyOf : MatcherBase {
- template
- class AnyOf : public MatcherImpl, ExpressionT> {
- public:
-
- AnyOf() {}
- AnyOf( AnyOf const& other ) : m_matchers( other.m_matchers ) {}
-
- AnyOf& add( Matcher const& matcher ) {
- m_matchers.push_back( matcher.clone() );
- return *this;
- }
- virtual bool match( ExpressionT const& expr ) const
- {
- for( std::size_t i = 0; i < m_matchers.size(); ++i )
- if( m_matchers[i]->match( expr ) )
+ virtual bool match( ArgT const& arg ) const CATCH_OVERRIDE {
+ for( std::size_t i = 0; i < m_matchers.size(); ++i ) {
+ if (m_matchers[i]->match(arg))
return true;
+ }
return false;
}
- virtual std::string toString() const {
- std::ostringstream oss;
- oss << "( ";
+ virtual std::string describe() const CATCH_OVERRIDE {
+ std::string description;
+ description.reserve( 4 + m_matchers.size()*32 );
+ description += "( ";
for( std::size_t i = 0; i < m_matchers.size(); ++i ) {
if( i != 0 )
- oss << " or ";
- oss << m_matchers[i]->toString();
+ description += " or ";
+ description += m_matchers[i]->toString();
}
- oss << " )";
- return oss.str();
- }
-
- AnyOf operator || ( Matcher const& other ) const {
- AnyOf anyOfExpr( *this );
- anyOfExpr.add( other );
- return anyOfExpr;
+ description += " )";
+ return description;
}
- private:
- std::vector > > m_matchers;
- };
-
- } // namespace Generic
-
- template
- Generic::AllOf Matcher::operator && ( Matcher const& other ) const {
- Generic::AllOf allOfExpr;
- allOfExpr.add( *this );
- allOfExpr.add( other );
- return allOfExpr;
- }
-
- template
- Generic::AnyOf Matcher::operator || ( Matcher const& other ) const {
- Generic::AnyOf anyOfExpr;
- anyOfExpr.add( *this );
- anyOfExpr.add( other );
- return anyOfExpr;
- }
-
- template
- Generic::Not Matcher::operator ! () const {
- return Generic::Not( *this );
- }
-
- namespace StdString {
-
- inline std::string makeString( std::string const& str ) { return str; }
- inline std::string makeString( const char* str ) { return str ? std::string( str ) : std::string(); }
-
- struct CasedString
- {
- CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity )
- : m_caseSensitivity( caseSensitivity ),
- m_str( adjustString( str ) )
- {}
- std::string adjustString( std::string const& str ) const {
- return m_caseSensitivity == CaseSensitive::No
- ? toLower( str )
- : str;
-
- }
- std::string toStringSuffix() const
- {
- return m_caseSensitivity == CaseSensitive::No
- ? " (case insensitive)"
- : std::string();
- }
- CaseSensitive::Choice m_caseSensitivity;
- std::string m_str;
- };
-
- struct Equals : MatcherImpl {
- Equals( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes )
- : m_data( str, caseSensitivity )
- {}
- Equals( Equals const& other ) : m_data( other.m_data ){}
-
- virtual ~Equals();
-
- virtual bool match( std::string const& expr ) const {
- return m_data.m_str == m_data.adjustString( expr );;
- }
- virtual std::string toString() const {
- return "equals: \"" + m_data.m_str + '"' + m_data.toStringSuffix();
+ MatchAnyOf& operator || ( MatcherBase const& other ) {
+ m_matchers.push_back( &other );
+ return *this;
}
- CasedString m_data;
+ std::vector const*> m_matchers;
};
- struct Contains : MatcherImpl {
- Contains( std::string const& substr, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes )
- : m_data( substr, caseSensitivity ){}
- Contains( Contains const& other ) : m_data( other.m_data ){}
+ template
+ struct MatchNotOf : MatcherBase {
- virtual ~Contains();
+ MatchNotOf( MatcherBase const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {}
- virtual bool match( std::string const& expr ) const {
- return m_data.adjustString( expr ).find( m_data.m_str ) != std::string::npos;
- }
- virtual std::string toString() const {
- return "contains: \"" + m_data.m_str + '"' + m_data.toStringSuffix();
+ virtual bool match( ArgT const& arg ) const CATCH_OVERRIDE {
+ return !m_underlyingMatcher.match( arg );
}
- CasedString m_data;
- };
-
- struct StartsWith : MatcherImpl {
- StartsWith( std::string const& substr, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes )
- : m_data( substr, caseSensitivity ){}
-
- StartsWith( StartsWith const& other ) : m_data( other.m_data ){}
-
- virtual ~StartsWith();
-
- virtual bool match( std::string const& expr ) const {
- return startsWith( m_data.adjustString( expr ), m_data.m_str );
+ virtual std::string describe() const CATCH_OVERRIDE {
+ return "not " + m_underlyingMatcher.toString();
}
- virtual std::string toString() const {
- return "starts with: \"" + m_data.m_str + '"' + m_data.toStringSuffix();
- }
-
- CasedString m_data;
+ MatcherBase const& m_underlyingMatcher;
};
- struct EndsWith : MatcherImpl {
- EndsWith( std::string const& substr, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes )
- : m_data( substr, caseSensitivity ){}
- EndsWith( EndsWith const& other ) : m_data( other.m_data ){}
-
- virtual ~EndsWith();
-
- virtual bool match( std::string const& expr ) const {
- return endsWith( m_data.adjustString( expr ), m_data.m_str );
- }
- virtual std::string toString() const {
- return "ends with: \"" + m_data.m_str + '"' + m_data.toStringSuffix();
- }
+ template
+ MatchAllOf MatcherBase::operator && ( MatcherBase const& other ) const {
+ return MatchAllOf() && *this && other;
+ }
+ template
+ MatchAnyOf MatcherBase::operator || ( MatcherBase const& other ) const {
+ return MatchAnyOf() || *this || other;
+ }
+ template
+ MatchNotOf MatcherBase::operator ! () const {
+ return MatchNotOf( *this );
+ }
- CasedString m_data;
- };
- } // namespace StdString
} // namespace Impl
// The following functions create the actual matcher objects.
// This allows the types to be inferred
- template
- inline Impl::Generic::Not Not( Impl::Matcher const& m ) {
- return Impl::Generic::Not( m );
- }
-
- template
- inline Impl::Generic::AllOf AllOf( Impl::Matcher const& m1,
- Impl::Matcher const& m2 ) {
- return Impl::Generic::AllOf().add( m1 ).add( m2 );
- }
- template
- inline Impl::Generic::AllOf AllOf( Impl::Matcher const& m1,
- Impl::Matcher const& m2,
- Impl::Matcher const& m3 ) {
- return Impl::Generic::AllOf().add( m1 ).add( m2 ).add( m3 );
- }
- template
- inline Impl::Generic::AnyOf AnyOf( Impl::Matcher const& m1,
- Impl::Matcher const& m2 ) {
- return Impl::Generic::AnyOf().add( m1 ).add( m2 );
- }
- template
- inline Impl::Generic::AnyOf AnyOf( Impl::Matcher const& m1,
- Impl::Matcher const& m2,
- Impl::Matcher const& m3 ) {
- return Impl::Generic::AnyOf().add( m1 ).add( m2 ).add( m3 );
- }
-
- inline Impl::StdString::Equals Equals( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ) {
- return Impl::StdString::Equals( str, caseSensitivity );
- }
- inline Impl::StdString::Equals Equals( const char* str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ) {
- return Impl::StdString::Equals( Impl::StdString::makeString( str ), caseSensitivity );
- }
- inline Impl::StdString::Contains Contains( std::string const& substr, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ) {
- return Impl::StdString::Contains( substr, caseSensitivity );
- }
- inline Impl::StdString::Contains Contains( const char* substr, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ) {
- return Impl::StdString::Contains( Impl::StdString::makeString( substr ), caseSensitivity );
+ // - deprecated: prefer ||, && and !
+ template
+ Impl::MatchNotOf Not( Impl::MatcherBase const& underlyingMatcher ) {
+ return Impl::MatchNotOf( underlyingMatcher );
}
- inline Impl::StdString::StartsWith StartsWith( std::string const& substr ) {
- return Impl::StdString::StartsWith( substr );
+ template
+ Impl::MatchAllOf AllOf( Impl::MatcherBase const& m1, Impl::MatcherBase const& m2 ) {
+ return Impl::MatchAllOf() && m1 && m2;
}
- inline Impl::StdString::StartsWith StartsWith( const char* substr ) {
- return Impl::StdString::StartsWith( Impl::StdString::makeString( substr ) );
+ template
+ Impl::MatchAllOf AllOf( Impl::MatcherBase const& m1, Impl::MatcherBase const& m2, Impl::MatcherBase const& m3 ) {
+ return Impl::MatchAllOf() && m1 && m2 && m3;
}
- inline Impl::StdString::EndsWith EndsWith( std::string const& substr ) {
- return Impl::StdString::EndsWith( substr );
+ template
+ Impl::MatchAnyOf AnyOf( Impl::MatcherBase const& m1, Impl::MatcherBase const& m2 ) {
+ return Impl::MatchAnyOf() || m1 || m2;
}
- inline Impl::StdString::EndsWith EndsWith( const char* substr ) {
- return Impl::StdString::EndsWith( Impl::StdString::makeString( substr ) );
+ template
+ Impl::MatchAnyOf AnyOf( Impl::MatcherBase const& m1, Impl::MatcherBase const& m2, Impl::MatcherBase const& m3 ) {
+ return Impl::MatchAnyOf() || m1 || m2 || m3;
}
} // namespace Matchers
using namespace Matchers;
+using Matchers::Impl::MatcherBase;
} // namespace Catch
@@ -1303,6 +1217,7 @@ namespace Catch {
char const* capturedExpression,
ResultDisposition::Flags resultDisposition,
char const* secondArg = "" );
+ ~ResultBuilder();
template
ExpressionLhs operator <= ( T const& operand );
@@ -1310,7 +1225,7 @@ namespace Catch {
template
ResultBuilder& operator << ( T const& value ) {
- m_stream.oss << value;
+ stream().oss << value;
return *this;
}
@@ -1328,7 +1243,7 @@ namespace Catch {
void captureResult( ResultWas::OfType resultType );
void captureExpression();
void captureExpectedException( std::string const& expectedMessage );
- void captureExpectedException( Matchers::Impl::Matcher const& matcher );
+ void captureExpectedException( Matchers::Impl::MatcherBase const& matcher );
void handleResult( AssertionResult const& result );
void react();
bool shouldDebugBreak() const;
@@ -1337,13 +1252,33 @@ namespace Catch {
template
void captureMatch( ArgT const& arg, MatcherT const& matcher, char const* matcherString );
+ void setExceptionGuard();
+ void unsetExceptionGuard();
+
private:
AssertionInfo m_assertionInfo;
AssertionResultData m_data;
- CopyableStream m_stream;
+
+ CopyableStream &stream()
+ {
+ if(!m_usedStream)
+ {
+ m_usedStream = true;
+ m_stream().oss.str("");
+ }
+ return m_stream();
+ }
+
+ static CopyableStream &m_stream()
+ {
+ static CopyableStream s;
+ return s;
+ }
bool m_shouldDebugBreak;
bool m_shouldThrow;
+ bool m_guardException;
+ bool m_usedStream;
};
} // namespace Catch
@@ -1358,6 +1293,8 @@ namespace Catch {
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
+#pragma warning(disable:4018) // more "signed/unsigned mismatch"
+#pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform)
#endif
#include
@@ -1383,176 +1320,103 @@ namespace Internal {
template<> struct OperatorTraits{ static const char* getName(){ return ">="; } };
template
- inline T& opCast(T const& t) { return const_cast(t); }
-
-// nullptr_t support based on pull request #154 from Konstantin Baumann
+ T& removeConst(T const &t) { return const_cast(t); }
#ifdef CATCH_CONFIG_CPP11_NULLPTR
- inline std::nullptr_t opCast(std::nullptr_t) { return nullptr; }
-#endif // CATCH_CONFIG_CPP11_NULLPTR
+ inline std::nullptr_t removeConst(std::nullptr_t) { return nullptr; }
+#endif
// So the compare overloads can be operator agnostic we convey the operator as a template
// enum, which is used to specialise an Evaluator for doing the comparison.
template
- class Evaluator{};
+ struct Evaluator{};
template
struct Evaluator {
static bool evaluate( T1 const& lhs, T2 const& rhs) {
- return bool( opCast( lhs ) == opCast( rhs ) );
+ return bool(removeConst(lhs) == removeConst(rhs) );
}
};
template
struct Evaluator {
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
- return bool( opCast( lhs ) != opCast( rhs ) );
+ return bool(removeConst(lhs) != removeConst(rhs) );
}
};
template
struct Evaluator {
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
- return bool( opCast( lhs ) < opCast( rhs ) );
+ return bool(removeConst(lhs) < removeConst(rhs) );
}
};
template
struct Evaluator {
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
- return bool( opCast( lhs ) > opCast( rhs ) );
+ return bool(removeConst(lhs) > removeConst(rhs) );
}
};
template
struct Evaluator {
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
- return bool( opCast( lhs ) >= opCast( rhs ) );
+ return bool(removeConst(lhs) >= removeConst(rhs) );
}
};
template
struct Evaluator {
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
- return bool( opCast( lhs ) <= opCast( rhs ) );
+ return bool(removeConst(lhs) <= removeConst(rhs) );
}
};
- template
- bool applyEvaluator( T1 const& lhs, T2 const& rhs ) {
- return Evaluator::evaluate( lhs, rhs );
- }
-
- // This level of indirection allows us to specialise for integer types
- // to avoid signed/ unsigned warnings
-
- // "base" overload
- template
- bool compare( T1 const& lhs, T2 const& rhs ) {
- return Evaluator::evaluate( lhs, rhs );
- }
-
- // unsigned X to int
- template bool compare( unsigned int lhs, int rhs ) {
- return applyEvaluator( lhs, static_cast( rhs ) );
- }
- template bool compare( unsigned long lhs, int rhs ) {
- return applyEvaluator( lhs, static_cast( rhs ) );
- }
- template bool compare( unsigned char lhs, int rhs ) {
- return applyEvaluator( lhs, static_cast( rhs ) );
- }
-
- // unsigned X to long
- template bool compare( unsigned int lhs, long rhs ) {
- return applyEvaluator( lhs, static_cast( rhs ) );
- }
- template bool compare( unsigned long lhs, long rhs ) {
- return applyEvaluator( lhs, static_cast( rhs ) );
- }
- template bool compare( unsigned char lhs, long rhs ) {
- return applyEvaluator( lhs, static_cast( rhs ) );
- }
-
- // int to unsigned X
- template bool compare( int lhs, unsigned int rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( int lhs, unsigned long rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( int lhs, unsigned char rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
-
- // long to unsigned X
- template bool compare( long lhs, unsigned int rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( long lhs, unsigned long rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( long lhs, unsigned char rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
-
- // pointer to long (when comparing against NULL)
- template bool compare( long lhs, T* rhs ) {
- return Evaluator::evaluate( reinterpret_cast( lhs ), rhs );
- }
- template bool compare( T* lhs, long rhs ) {
- return Evaluator::evaluate( lhs, reinterpret_cast( rhs ) );
- }
-
- // pointer to int (when comparing against NULL)
- template bool compare( int lhs, T* rhs ) {
- return Evaluator::evaluate( reinterpret_cast( lhs ), rhs );
- }
- template bool compare( T* lhs, int rhs ) {
- return Evaluator::evaluate( lhs, reinterpret_cast( rhs ) );
- }
-
-#ifdef CATCH_CONFIG_CPP11_LONG_LONG
- // long long to unsigned X
- template bool compare( long long lhs, unsigned int rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( long long lhs, unsigned long rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( long long lhs, unsigned long long rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( long long lhs, unsigned char rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
-
- // unsigned long long to X
- template bool compare( unsigned long long lhs, int rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( unsigned long long lhs, long rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( unsigned long long lhs, long long rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( unsigned long long lhs, char rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
-
- // pointer to long long (when comparing against NULL)
- template bool compare( long long lhs, T* rhs ) {
- return Evaluator::evaluate( reinterpret_cast( lhs ), rhs );
- }
- template bool compare( T* lhs, long long rhs ) {
- return Evaluator::evaluate( lhs, reinterpret_cast( rhs ) );
- }
-#endif // CATCH_CONFIG_CPP11_LONG_LONG
+ // Special case for comparing a pointer to an int (deduced for p==0)
+ template
+ struct Evaluator {
+ static bool evaluate( int lhs, T* rhs) {
+ return reinterpret_cast( lhs ) == rhs;
+ }
+ };
+ template
+ struct Evaluator