Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include/internal
diff options
context:
space:
mode:
authorPhil Nash2017-11-03 16:56:11 +0000
committerPhil Nash2017-11-03 16:56:11 +0000
commit4acf112c19a554b35ee1fd77e7c122284e8dd8ec (patch)
tree8a16ca54103c4f9d0ec6890fa1ebae408da36eff /include/internal
parent53f6d3fc8e461139fac72c595ab0ff8fba3df365 (diff)
downloadcatch3-4acf112c19a554b35ee1fd77e7c122284e8dd8ec.tar.gz
Removed zombie files
These files were removed from the Catch2 branch, and crept back in when Catch2 merged with master
Diffstat (limited to 'include/internal')
-rw-r--r--include/internal/catch_approx.hpp202
-rw-r--r--include/internal/catch_assertionresult.hpp109
-rw-r--r--include/internal/catch_commandline.hpp240
-rw-r--r--include/internal/catch_evaluate.hpp147
-rw-r--r--include/internal/catch_expression_lhs.hpp174
-rw-r--r--include/internal/catch_run_context.hpp419
-rw-r--r--include/internal/catch_test_case_registry_impl.hpp207
7 files changed, 0 insertions, 1498 deletions
diff --git a/include/internal/catch_approx.hpp b/include/internal/catch_approx.hpp
deleted file mode 100644
index 8f75b5d7..00000000
--- a/include/internal/catch_approx.hpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Created by Phil on 28/04/2011.
- * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
- *
- * Distributed under the Boost Software License, Version 1.0. (See accompanying
- * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- */
-#ifndef TWOBLUECUBES_CATCH_APPROX_HPP_INCLUDED
-#define TWOBLUECUBES_CATCH_APPROX_HPP_INCLUDED
-
-#include "catch_tostring.h"
-
-#include <cmath>
-#include <limits>
-
-#if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS)
-#include <type_traits>
-#endif
-
-namespace Catch {
-namespace Detail {
-
- class Approx {
- public:
- explicit Approx ( double value )
- : m_epsilon( std::numeric_limits<float>::epsilon()*100 ),
- m_margin( 0.0 ),
- m_scale( 1.0 ),
- m_value( value )
- {}
-
- static Approx custom() {
- return Approx( 0 );
- }
-
-#if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS)
-
- template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
- Approx operator()( T value ) {
- Approx approx( static_cast<double>(value) );
- approx.epsilon( m_epsilon );
- approx.margin( m_margin );
- approx.scale( m_scale );
- return approx;
- }
-
- template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
- explicit Approx( T value ): Approx(static_cast<double>(value))
- {}
-
-
- template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
- friend bool operator == ( const T& lhs, Approx const& rhs ) {
- // Thanks to Richard Harris for his help refining this formula
- auto lhs_v = 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)));
- if (relativeOK) {
- return true;
- }
-
- return std::fabs(lhs_v - rhs.m_value) <= rhs.m_margin;
- }
-
- template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
- friend bool operator == ( Approx const& lhs, const T& rhs ) {
- return operator==( rhs, lhs );
- }
-
- template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
- friend bool operator != ( T lhs, Approx const& rhs ) {
- return !operator==( lhs, rhs );
- }
-
- template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
- friend bool operator != ( Approx const& lhs, T rhs ) {
- return !operator==( rhs, lhs );
- }
-
- template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
- friend bool operator <= ( T lhs, Approx const& rhs ) {
- return double(lhs) < rhs.m_value || lhs == rhs;
- }
-
- template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
- friend bool operator <= ( Approx const& lhs, T rhs ) {
- return lhs.m_value < double(rhs) || lhs == rhs;
- }
-
- template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
- friend bool operator >= ( T lhs, Approx const& rhs ) {
- return double(lhs) > rhs.m_value || lhs == rhs;
- }
-
- template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
- friend bool operator >= ( Approx const& lhs, T rhs ) {
- return lhs.m_value > double(rhs) || lhs == rhs;
- }
-
- template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
- Approx& epsilon( T newEpsilon ) {
- m_epsilon = double(newEpsilon);
- return *this;
- }
-
- template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
- Approx& margin( T newMargin ) {
- m_margin = double(newMargin);
- return *this;
- }
-
- template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
- Approx& scale( T newScale ) {
- m_scale = double(newScale);
- return *this;
- }
-
-#else
-
- Approx operator()( double value ) {
- Approx approx( value );
- approx.epsilon( m_epsilon );
- approx.margin( m_margin );
- approx.scale( m_scale );
- return approx;
- }
-
-
- friend bool operator == ( double lhs, Approx const& rhs ) {
- // Thanks to Richard Harris for his help refining this formula
- bool relativeOK = std::fabs( lhs - rhs.m_value ) < rhs.m_epsilon * (rhs.m_scale + (std::max)( std::fabs(lhs), std::fabs(rhs.m_value) ) );
- if (relativeOK) {
- return true;
- }
- return std::fabs(lhs - rhs.m_value) <= rhs.m_margin;
- }
-
- friend bool operator == ( Approx const& lhs, double rhs ) {
- return operator==( rhs, lhs );
- }
-
- friend bool operator != ( double lhs, Approx const& rhs ) {
- return !operator==( lhs, rhs );
- }
-
- friend bool operator != ( Approx const& lhs, double rhs ) {
- return !operator==( rhs, lhs );
- }
-
- friend bool operator <= ( double lhs, Approx const& rhs ) {
- return lhs < rhs.m_value || lhs == rhs;
- }
-
- friend bool operator <= ( Approx const& lhs, double rhs ) {
- return lhs.m_value < rhs || lhs == rhs;
- }
-
- friend bool operator >= ( double lhs, Approx const& rhs ) {
- return lhs > rhs.m_value || lhs == rhs;
- }
-
- friend bool operator >= ( Approx const& lhs, double rhs ) {
- return lhs.m_value > rhs || lhs == rhs;
- }
-
- Approx& epsilon( double newEpsilon ) {
- m_epsilon = newEpsilon;
- return *this;
- }
-
- Approx& margin( double newMargin ) {
- m_margin = newMargin;
- return *this;
- }
-
- Approx& scale( double newScale ) {
- m_scale = newScale;
- return *this;
- }
-#endif
-
- std::string toString() const {
- std::ostringstream oss;
- oss << "Approx( " << Catch::toString( m_value ) << " )";
- return oss.str();
- }
-
- private:
- double m_epsilon;
- double m_margin;
- double m_scale;
- double m_value;
- };
-}
-
-template<>
-inline std::string toString<Detail::Approx>( Detail::Approx const& value ) {
- return value.toString();
-}
-
-} // end namespace Catch
-
-#endif // TWOBLUECUBES_CATCH_APPROX_HPP_INCLUDED
diff --git a/include/internal/catch_assertionresult.hpp b/include/internal/catch_assertionresult.hpp
deleted file mode 100644
index 116b2157..00000000
--- a/include/internal/catch_assertionresult.hpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Created by Phil on 8/8/12
- * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
- *
- * Distributed under the Boost Software License, Version 1.0. (See accompanying
- * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- */
-#ifndef TWOBLUECUBES_CATCH_ASSERTIONRESULT_HPP_INCLUDED
-#define TWOBLUECUBES_CATCH_ASSERTIONRESULT_HPP_INCLUDED
-
-#include "catch_assertionresult.h"
-
-namespace Catch {
-
-
- AssertionInfo::AssertionInfo():macroName(""), capturedExpression(""), resultDisposition(ResultDisposition::Normal), secondArg(""){}
-
- AssertionInfo::AssertionInfo( char const * _macroName,
- SourceLineInfo const& _lineInfo,
- char const * _capturedExpression,
- ResultDisposition::Flags _resultDisposition,
- char const * _secondArg)
- : macroName( _macroName ),
- lineInfo( _lineInfo ),
- capturedExpression( _capturedExpression ),
- resultDisposition( _resultDisposition ),
- secondArg( _secondArg )
- {}
-
- AssertionResult::AssertionResult() {}
-
- AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data )
- : m_info( info ),
- m_resultData( data )
- {}
-
- AssertionResult::~AssertionResult() {}
-
- // Result was a success
- bool AssertionResult::succeeded() const {
- return Catch::isOk( m_resultData.resultType );
- }
-
- // Result was a success, or failure is suppressed
- bool AssertionResult::isOk() const {
- return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition );
- }
-
- ResultWas::OfType AssertionResult::getResultType() const {
- return m_resultData.resultType;
- }
-
- bool AssertionResult::hasExpression() const {
- return m_info.capturedExpression[0] != 0;
- }
-
- bool AssertionResult::hasMessage() const {
- return !m_resultData.message.empty();
- }
-
- std::string capturedExpressionWithSecondArgument( char const * capturedExpression, char const * secondArg ) {
- return (secondArg[0] == 0 || secondArg[0] == '"' && secondArg[1] == '"')
- ? capturedExpression
- : std::string(capturedExpression) + ", " + secondArg;
- }
-
- std::string AssertionResult::getExpression() const {
- if( isFalseTest( m_info.resultDisposition ) )
- return "!(" + capturedExpressionWithSecondArgument(m_info.capturedExpression, m_info.secondArg) + ")";
- else
- return capturedExpressionWithSecondArgument(m_info.capturedExpression, m_info.secondArg);
- }
- std::string AssertionResult::getExpressionInMacro() const {
- if( m_info.macroName[0] == 0 )
- return capturedExpressionWithSecondArgument(m_info.capturedExpression, m_info.secondArg);
- else
- return std::string(m_info.macroName) + "( " + capturedExpressionWithSecondArgument(m_info.capturedExpression, m_info.secondArg) + " )";
- }
-
- bool AssertionResult::hasExpandedExpression() const {
- return hasExpression() && getExpandedExpression() != getExpression();
- }
-
- std::string AssertionResult::getExpandedExpression() const {
- return m_resultData.reconstructExpression();
- }
-
- std::string AssertionResult::getMessage() const {
- return m_resultData.message;
- }
- SourceLineInfo AssertionResult::getSourceInfo() const {
- return m_info.lineInfo;
- }
-
- std::string AssertionResult::getTestMacroName() const {
- return m_info.macroName;
- }
-
- void AssertionResult::discardDecomposedExpression() const {
- m_resultData.decomposedExpression = CATCH_NULL;
- }
-
- void AssertionResult::expandDecomposedExpression() const {
- m_resultData.reconstructExpression();
- }
-
-} // end namespace Catch
-
-#endif // TWOBLUECUBES_CATCH_ASSERTIONRESULT_HPP_INCLUDED
diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp
deleted file mode 100644
index 6ea49ebd..00000000
--- a/include/internal/catch_commandline.hpp
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Created by Phil on 02/11/2010.
- * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
- *
- * Distributed under the Boost Software License, Version 1.0. (See accompanying
- * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- */
-#ifndef TWOBLUECUBES_CATCH_COMMANDLINE_HPP_INCLUDED
-#define TWOBLUECUBES_CATCH_COMMANDLINE_HPP_INCLUDED
-
-#include "catch_config.hpp"
-#include "catch_common.h"
-#include "catch_clara.h"
-
-#include <fstream>
-#include <ctime>
-
-namespace Catch {
-
- inline void abortAfterFirst( ConfigData& config ) { config.abortAfter = 1; }
- inline void abortAfterX( ConfigData& config, int x ) {
- if( x < 1 )
- throw std::runtime_error( "Value after -x or --abortAfter must be greater than zero" );
- config.abortAfter = x;
- }
- inline void addTestOrTags( ConfigData& config, std::string const& _testSpec ) { config.testsOrTags.push_back( _testSpec ); }
- inline void addSectionToRun( ConfigData& config, std::string const& sectionName ) { config.sectionsToRun.push_back( sectionName ); }
- inline void addReporterName( ConfigData& config, std::string const& _reporterName ) { config.reporterNames.push_back( _reporterName ); }
-
- inline void addWarning( ConfigData& config, std::string const& _warning ) {
- if( _warning == "NoAssertions" )
- config.warnings = static_cast<WarnAbout::What>( config.warnings | WarnAbout::NoAssertions );
- else
- throw std::runtime_error( "Unrecognised warning: '" + _warning + '\'' );
- }
- inline void setOrder( ConfigData& config, std::string const& order ) {
- if( startsWith( "declared", order ) )
- config.runOrder = RunTests::InDeclarationOrder;
- else if( startsWith( "lexical", order ) )
- config.runOrder = RunTests::InLexicographicalOrder;
- else if( startsWith( "random", order ) )
- config.runOrder = RunTests::InRandomOrder;
- else
- throw std::runtime_error( "Unrecognised ordering: '" + order + '\'' );
- }
- inline void setRngSeed( ConfigData& config, std::string const& seed ) {
- if( seed == "time" ) {
- config.rngSeed = static_cast<unsigned int>( std::time(0) );
- }
- else {
- std::stringstream ss;
- ss << seed;
- ss >> config.rngSeed;
- if( ss.fail() )
- throw std::runtime_error( "Argument to --rng-seed should be the word 'time' or a number" );
- }
- }
- inline void setVerbosity( ConfigData& config, int level ) {
- // !TBD: accept strings?
- config.verbosity = static_cast<Verbosity::Level>( level );
- }
- inline void setShowDurations( ConfigData& config, bool _showDurations ) {
- config.showDurations = _showDurations
- ? ShowDurations::Always
- : ShowDurations::Never;
- }
- inline void setUseColour( ConfigData& config, std::string const& value ) {
- std::string mode = toLower( value );
-
- if( mode == "yes" )
- config.useColour = UseColour::Yes;
- else if( mode == "no" )
- config.useColour = UseColour::No;
- else if( mode == "auto" )
- config.useColour = UseColour::Auto;
- else
- throw std::runtime_error( "colour mode must be one of: auto, yes or no" );
- }
- inline void setWaitForKeypress( ConfigData& config, std::string const& keypress ) {
- std::string keypressLc = toLower( keypress );
- if( keypressLc == "start" )
- config.waitForKeypress = WaitForKeypress::BeforeStart;
- else if( keypressLc == "exit" )
- config.waitForKeypress = WaitForKeypress::BeforeExit;
- else if( keypressLc == "both" )
- config.waitForKeypress = WaitForKeypress::BeforeStartAndExit;
- else
- throw std::runtime_error( "keypress argument must be one of: start, exit or both. '" + keypress + "' not recognised" );
- };
-
-
- inline void forceColour( ConfigData& config ) {
- config.useColour = UseColour::Yes;
- }
- inline void loadTestNamesFromFile( ConfigData& config, std::string const& _filename ) {
- std::ifstream f( _filename.c_str() );
- if( !f.is_open() )
- throw std::domain_error( "Unable to load input file: " + _filename );
-
- std::string line;
- while( std::getline( f, line ) ) {
- line = trim(line);
- if( !line.empty() && !startsWith( line, '#' ) ) {
- if( !startsWith( line, '"' ) )
- line = '"' + line + '"';
- addTestOrTags( config, line + ',' );
- }
- }
- }
-
- inline Clara::CommandLine<ConfigData> makeCommandLineParser() {
-
- using namespace Clara;
- CommandLine<ConfigData> cli;
-
- cli.bindProcessName( &ConfigData::processName );
-
- cli["-?"]["-h"]["--help"]
- .describe( "display usage information" )
- .bind( &ConfigData::showHelp );
-
- cli["-l"]["--list-tests"]
- .describe( "list all/matching test cases" )
- .bind( &ConfigData::listTests );
-
- cli["-t"]["--list-tags"]
- .describe( "list all/matching tags" )
- .bind( &ConfigData::listTags );
-
- cli["-s"]["--success"]
- .describe( "include successful tests in output" )
- .bind( &ConfigData::showSuccessfulTests );
-
- cli["-b"]["--break"]
- .describe( "break into debugger on failure" )
- .bind( &ConfigData::shouldDebugBreak );
-
- cli["-e"]["--nothrow"]
- .describe( "skip exception tests" )
- .bind( &ConfigData::noThrow );
-
- cli["-i"]["--invisibles"]
- .describe( "show invisibles (tabs, newlines)" )
- .bind( &ConfigData::showInvisibles );
-
- cli["-o"]["--out"]
- .describe( "output filename" )
- .bind( &ConfigData::outputFilename, "filename" );
-
- cli["-r"]["--reporter"]
-// .placeholder( "name[:filename]" )
- .describe( "reporter to use (defaults to console)" )
- .bind( &addReporterName, "name" );
-
- cli["-n"]["--name"]
- .describe( "suite name" )
- .bind( &ConfigData::name, "name" );
-
- cli["-a"]["--abort"]
- .describe( "abort at first failure" )
- .bind( &abortAfterFirst );
-
- cli["-x"]["--abortx"]
- .describe( "abort after x failures" )
- .bind( &abortAfterX, "no. failures" );
-
- cli["-w"]["--warn"]
- .describe( "enable warnings" )
- .bind( &addWarning, "warning name" );
-
-// - needs updating if reinstated
-// cli.into( &setVerbosity )
-// .describe( "level of verbosity (0=no output)" )
-// .shortOpt( "v")
-// .longOpt( "verbosity" )
-// .placeholder( "level" );
-
- cli[_]
- .describe( "which test or tests to use" )
- .bind( &addTestOrTags, "test name, pattern or tags" );
-
- cli["-d"]["--durations"]
- .describe( "show test durations" )
- .bind( &setShowDurations, "yes|no" );
-
- cli["-f"]["--input-file"]
- .describe( "load test names to run from a file" )
- .bind( &loadTestNamesFromFile, "filename" );
-
- cli["-#"]["--filenames-as-tags"]
- .describe( "adds a tag for the filename" )
- .bind( &ConfigData::filenamesAsTags );
-
- cli["-c"]["--section"]
- .describe( "specify section to run" )
- .bind( &addSectionToRun, "section name" );
-
- // Less common commands which don't have a short form
- cli["--list-test-names-only"]
- .describe( "list all/matching test cases names only" )
- .bind( &ConfigData::listTestNamesOnly );
-
- cli["--list-extra-info"]
- .describe( "list all/matching test cases with more info" )
- .bind( &ConfigData::listExtraInfo );
-
- cli["--list-reporters"]
- .describe( "list all reporters" )
- .bind( &ConfigData::listReporters );
-
- cli["--order"]
- .describe( "test case order (defaults to decl)" )
- .bind( &setOrder, "decl|lex|rand" );
-
- cli["--rng-seed"]
- .describe( "set a specific seed for random numbers" )
- .bind( &setRngSeed, "'time'|number" );
-
- cli["--force-colour"]
- .describe( "force colourised output (deprecated)" )
- .bind( &forceColour );
-
- cli["--use-colour"]
- .describe( "should output be colourised" )
- .bind( &setUseColour, "yes|no" );
-
- cli["--libidentify"]
- .describe( "report name and version according to libidentify standard" )
- .bind( &ConfigData::libIdentify );
-
- cli["--wait-for-keypress"]
- .describe( "waits for a keypress before exiting" )
- .bind( &setWaitForKeypress, "start|exit|both" );
-
- return cli;
- }
-
-} // end namespace Catch
-
-#endif // TWOBLUECUBES_CATCH_COMMANDLINE_HPP_INCLUDED
diff --git a/include/internal/catch_evaluate.hpp b/include/internal/catch_evaluate.hpp
deleted file mode 100644
index 8a7ed288..00000000
--- a/include/internal/catch_evaluate.hpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Created by Phil on 04/03/2011.
- * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
- *
- * Distributed under the Boost Software License, Version 1.0. (See accompanying
- * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- */
-#ifndef TWOBLUECUBES_CATCH_EVALUATE_HPP_INCLUDED
-#define TWOBLUECUBES_CATCH_EVALUATE_HPP_INCLUDED
-
-#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 <cstddef>
-
-namespace Catch {
-namespace Internal {
-
- enum Operator {
- IsEqualTo,
- IsNotEqualTo,
- IsLessThan,
- IsGreaterThan,
- IsLessThanOrEqualTo,
- IsGreaterThanOrEqualTo
- };
-
- template<Operator Op> struct OperatorTraits { static const char* getName(){ return "*error*"; } };
- template<> struct OperatorTraits<IsEqualTo> { static const char* getName(){ return "=="; } };
- template<> struct OperatorTraits<IsNotEqualTo> { static const char* getName(){ return "!="; } };
- template<> struct OperatorTraits<IsLessThan> { static const char* getName(){ return "<"; } };
- template<> struct OperatorTraits<IsGreaterThan> { static const char* getName(){ return ">"; } };
- template<> struct OperatorTraits<IsLessThanOrEqualTo> { static const char* getName(){ return "<="; } };
- template<> struct OperatorTraits<IsGreaterThanOrEqualTo>{ static const char* getName(){ return ">="; } };
-
- template<typename T>
- T& removeConst(T const &t) { return const_cast<T&>(t); }
-#ifdef 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<typename T1, typename T2, Operator Op>
- struct Evaluator{};
-
- template<typename T1, typename T2>
- struct Evaluator<T1, T2, IsEqualTo> {
- static bool evaluate( T1 const& lhs, T2 const& rhs) {
- return bool(removeConst(lhs) == removeConst(rhs) );
- }
- };
- template<typename T1, typename T2>
- struct Evaluator<T1, T2, IsNotEqualTo> {
- static bool evaluate( T1 const& lhs, T2 const& rhs ) {
- return bool(removeConst(lhs) != removeConst(rhs) );
- }
- };
- template<typename T1, typename T2>
- struct Evaluator<T1, T2, IsLessThan> {
- static bool evaluate( T1 const& lhs, T2 const& rhs ) {
- return bool(removeConst(lhs) < removeConst(rhs) );
- }
- };
- template<typename T1, typename T2>
- struct Evaluator<T1, T2, IsGreaterThan> {
- static bool evaluate( T1 const& lhs, T2 const& rhs ) {
- return bool(removeConst(lhs) > removeConst(rhs) );
- }
- };
- template<typename T1, typename T2>
- struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> {
- static bool evaluate( T1 const& lhs, T2 const& rhs ) {
- return bool(removeConst(lhs) >= removeConst(rhs) );
- }
- };
- template<typename T1, typename T2>
- struct Evaluator<T1, T2, IsLessThanOrEqualTo> {
- static bool evaluate( T1 const& lhs, T2 const& rhs ) {
- return bool(removeConst(lhs) <= removeConst(rhs) );
- }
- };
-
- // Special case for comparing a pointer to an int (deduced for p==0)
- template<typename T>
- struct Evaluator<int const&, T* const&, IsEqualTo> {
- static bool evaluate( int lhs, T* rhs) {
- return reinterpret_cast<void const*>( lhs ) == rhs;
- }
- };
- template<typename T>
- struct Evaluator<T* const&, int const&, IsEqualTo> {
- static bool evaluate( T* lhs, int rhs) {
- return lhs == reinterpret_cast<void const*>( rhs );
- }
- };
- template<typename T>
- struct Evaluator<int const&, T* const&, IsNotEqualTo> {
- static bool evaluate( int lhs, T* rhs) {
- return reinterpret_cast<void const*>( lhs ) != rhs;
- }
- };
- template<typename T>
- struct Evaluator<T* const&, int const&, IsNotEqualTo> {
- static bool evaluate( T* lhs, int rhs) {
- return lhs != reinterpret_cast<void const*>( rhs );
- }
- };
-
- template<typename T>
- struct Evaluator<long const&, T* const&, IsEqualTo> {
- static bool evaluate( long lhs, T* rhs) {
- return reinterpret_cast<void const*>( lhs ) == rhs;
- }
- };
- template<typename T>
- struct Evaluator<T* const&, long const&, IsEqualTo> {
- static bool evaluate( T* lhs, long rhs) {
- return lhs == reinterpret_cast<void const*>( rhs );
- }
- };
- template<typename T>
- struct Evaluator<long const&, T* const&, IsNotEqualTo> {
- static bool evaluate( long lhs, T* rhs) {
- return reinterpret_cast<void const*>( lhs ) != rhs;
- }
- };
- template<typename T>
- struct Evaluator<T* const&, long const&, IsNotEqualTo> {
- static bool evaluate( T* lhs, long rhs) {
- return lhs != reinterpret_cast<void const*>( rhs );
- }
- };
-
-} // end of namespace Internal
-} // end of namespace Catch
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
-#endif // TWOBLUECUBES_CATCH_EVALUATE_HPP_INCLUDED
diff --git a/include/internal/catch_expression_lhs.hpp b/include/internal/catch_expression_lhs.hpp
deleted file mode 100644
index d809f96f..00000000
--- a/include/internal/catch_expression_lhs.hpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Created by Phil on 11/5/2012.
- * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
- *
- * Distributed under the Boost Software License, Version 1.0. (See accompanying
- * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- */
-#ifndef TWOBLUECUBES_CATCH_EXPRESSION_LHS_HPP_INCLUDED
-#define TWOBLUECUBES_CATCH_EXPRESSION_LHS_HPP_INCLUDED
-
-#include "catch_result_builder.h"
-#include "catch_evaluate.hpp"
-#include "catch_tostring.h"
-
-namespace Catch {
-
-template<typename LhsT, Internal::Operator Op, typename RhsT>
-class BinaryExpression;
-
-template<typename ArgT, typename MatcherT>
-class MatchExpression;
-
-// Wraps the LHS of an expression and overloads comparison operators
-// for also capturing those and RHS (if any)
-template<typename T>
-class ExpressionLhs : public DecomposedExpression {
-public:
- ExpressionLhs( ResultBuilder& rb, T lhs ) : m_rb( rb ), m_lhs( lhs ), m_truthy(false) {}
-
- ExpressionLhs& operator = ( const ExpressionLhs& );
-
- template<typename RhsT>
- BinaryExpression<T, Internal::IsEqualTo, RhsT const&>
- operator == ( RhsT const& rhs ) {
- return captureExpression<Internal::IsEqualTo>( rhs );
- }
-
- template<typename RhsT>
- BinaryExpression<T, Internal::IsNotEqualTo, RhsT const&>
- operator != ( RhsT const& rhs ) {
- return captureExpression<Internal::IsNotEqualTo>( rhs );
- }
-
- template<typename RhsT>
- BinaryExpression<T, Internal::IsLessThan, RhsT const&>
- operator < ( RhsT const& rhs ) {
- return captureExpression<Internal::IsLessThan>( rhs );
- }
-
- template<typename RhsT>
- BinaryExpression<T, Internal::IsGreaterThan, RhsT const&>
- operator > ( RhsT const& rhs ) {
- return captureExpression<Internal::IsGreaterThan>( rhs );
- }
-
- template<typename RhsT>
- BinaryExpression<T, Internal::IsLessThanOrEqualTo, RhsT const&>
- operator <= ( RhsT const& rhs ) {
- return captureExpression<Internal::IsLessThanOrEqualTo>( rhs );
- }
-
- template<typename RhsT>
- BinaryExpression<T, Internal::IsGreaterThanOrEqualTo, RhsT const&>
- operator >= ( RhsT const& rhs ) {
- return captureExpression<Internal::IsGreaterThanOrEqualTo>( rhs );
- }
-
- BinaryExpression<T, Internal::IsEqualTo, bool> operator == ( bool rhs ) {
- return captureExpression<Internal::IsEqualTo>( rhs );
- }
-
- BinaryExpression<T, Internal::IsNotEqualTo, bool> operator != ( bool rhs ) {
- return captureExpression<Internal::IsNotEqualTo>( rhs );
- }
-
- void endExpression() {
- m_truthy = m_lhs ? true : false;
- m_rb
- .setResultType( m_truthy )
- .endExpression( *this );
- }
-
- virtual void reconstructExpression( std::string& dest ) const CATCH_OVERRIDE {
- dest = Catch::toString( m_lhs );
- }
-
-private:
- template<Internal::Operator Op, typename RhsT>
- BinaryExpression<T, Op, RhsT&> captureExpression( RhsT& rhs ) const {
- return BinaryExpression<T, Op, RhsT&>( m_rb, m_lhs, rhs );
- }
-
- template<Internal::Operator Op>
- BinaryExpression<T, Op, bool> captureExpression( bool rhs ) const {
- return BinaryExpression<T, Op, bool>( m_rb, m_lhs, rhs );
- }
-
-private:
- ResultBuilder& m_rb;
- T m_lhs;
- bool m_truthy;
-};
-
-template<typename LhsT, Internal::Operator Op, typename RhsT>
-class BinaryExpression : public DecomposedExpression {
-public:
- BinaryExpression( ResultBuilder& rb, LhsT lhs, RhsT rhs )
- : m_rb( rb ), m_lhs( lhs ), m_rhs( rhs ) {}
-
- BinaryExpression& operator = ( BinaryExpression& );
-
- void endExpression() const {
- m_rb
- .setResultType( Internal::Evaluator<LhsT, RhsT, Op>::evaluate( m_lhs, m_rhs ) )
- .endExpression( *this );
- }
-
- virtual bool isBinaryExpression() const CATCH_OVERRIDE {
- return