mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 19:53:28 +01:00
71df66365e
All C++11 toggles are now removed. What is left is either platform specific (POSIX_SIGNALS, WINDOWS_SEH), or possibly still needed (USE_COUNTER). If current CLion is compatible with `__COUNTER__`, then we should also force `__COUNTER__` usage. Changed * CATCH_AUTO_PTR -> std::unique_ptr * CATCH_OVERRIDE -> override * CATCH_NULL -> nullptr * CATCH_NOEXCEPT -> noexcept * CATCH_NOEXCEPT_IS -> noexcept Removed * CATCH_CONFIG_CPP11_UNIQUE_PTR * CATCH_CONFIG_CPP11_SHUFFLE * CATCH_CONFIG_CPP11_TYPE_TRAITS * CATCH_CONFIG_CPP11_OVERRIDE * CATCH_CONFIG_CPP11_LONG_LONG * CATCH_CONFIG_CPP11_TUPLE * CATCH_CONFIG_CPP11_IS_ENUM * CATCH_CONFIG_CPP11_GENERATED_METHODS * CATCH_CONFIG_CPP11_NOEXCEPT * CATCH_CONFIG_CPP11_NULLPTR * CATCH_CONFIG_VARIADIC_MACROS
68 lines
2.6 KiB
C++
68 lines
2.6 KiB
C++
/*
|
|
* Created by Phil Nash on 08/02/2017.
|
|
* Copyright (c) 2017 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_MATCHERS_STRING_H_INCLUDED
|
|
#define TWOBLUECUBES_CATCH_MATCHERS_STRING_H_INCLUDED
|
|
|
|
#include "catch_matchers.hpp"
|
|
|
|
namespace Catch {
|
|
namespace Matchers {
|
|
|
|
namespace StdString {
|
|
|
|
struct CasedString
|
|
{
|
|
CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity );
|
|
std::string adjustString( std::string const& str ) const;
|
|
std::string caseSensitivitySuffix() const;
|
|
|
|
CaseSensitive::Choice m_caseSensitivity;
|
|
std::string m_str;
|
|
};
|
|
|
|
struct StringMatcherBase : MatcherBase<std::string> {
|
|
StringMatcherBase( std::string const& operation, CasedString const& comparator );
|
|
virtual std::string describe() const override;
|
|
|
|
CasedString m_comparator;
|
|
std::string m_operation;
|
|
};
|
|
|
|
struct EqualsMatcher : StringMatcherBase {
|
|
EqualsMatcher( CasedString const& comparator );
|
|
virtual bool match( std::string const& source ) const override;
|
|
};
|
|
struct ContainsMatcher : StringMatcherBase {
|
|
ContainsMatcher( CasedString const& comparator );
|
|
virtual bool match( std::string const& source ) const override;
|
|
};
|
|
struct StartsWithMatcher : StringMatcherBase {
|
|
StartsWithMatcher( CasedString const& comparator );
|
|
virtual bool match( std::string const& source ) const override;
|
|
};
|
|
struct EndsWithMatcher : StringMatcherBase {
|
|
EndsWithMatcher( CasedString const& comparator );
|
|
virtual bool match( std::string const& source ) const override;
|
|
};
|
|
|
|
} // namespace StdString
|
|
|
|
|
|
// The following functions create the actual matcher objects.
|
|
// This allows the types to be inferred
|
|
|
|
StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
|
|
StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
|
|
StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
|
|
StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
|
|
|
|
} // namespace Matchers
|
|
} // namespace Catch
|
|
|
|
#endif // TWOBLUECUBES_CATCH_MATCHERS_STRING_H_INCLUDED
|