Path: blob/master/dep/googletest/src/gtest-matchers.cc
4804 views
// Copyright 2007, Google Inc.1// All rights reserved.2//3// Redistribution and use in source and binary forms, with or without4// modification, are permitted provided that the following conditions are5// met:6//7// * Redistributions of source code must retain the above copyright8// notice, this list of conditions and the following disclaimer.9// * Redistributions in binary form must reproduce the above10// copyright notice, this list of conditions and the following disclaimer11// in the documentation and/or other materials provided with the12// distribution.13// * Neither the name of Google Inc. nor the names of its14// contributors may be used to endorse or promote products derived from15// this software without specific prior written permission.16//17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT19// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR20// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT21// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,22// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT23// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,24// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY25// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT26// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE27// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.2829// The Google C++ Testing and Mocking Framework (Google Test)30//31// This file implements just enough of the matcher interface to allow32// EXPECT_DEATH and friends to accept a matcher argument.3334#include "gtest/gtest-matchers.h"3536#include <string>3738#include "gtest/internal/gtest-internal.h"39#include "gtest/internal/gtest-port.h"4041namespace testing {4243// Constructs a matcher that matches a const std::string& whose value is44// equal to s.45Matcher<const std::string&>::Matcher(const std::string& s) { *this = Eq(s); }4647// Constructs a matcher that matches a const std::string& whose value is48// equal to s.49Matcher<const std::string&>::Matcher(const char* s) {50*this = Eq(std::string(s));51}5253// Constructs a matcher that matches a std::string whose value is equal to54// s.55Matcher<std::string>::Matcher(const std::string& s) { *this = Eq(s); }5657// Constructs a matcher that matches a std::string whose value is equal to58// s.59Matcher<std::string>::Matcher(const char* s) { *this = Eq(std::string(s)); }6061#if GTEST_INTERNAL_HAS_STRING_VIEW62// Constructs a matcher that matches a const StringView& whose value is63// equal to s.64Matcher<const internal::StringView&>::Matcher(const std::string& s) {65*this = Eq(s);66}6768// Constructs a matcher that matches a const StringView& whose value is69// equal to s.70Matcher<const internal::StringView&>::Matcher(const char* s) {71*this = Eq(std::string(s));72}7374// Constructs a matcher that matches a const StringView& whose value is75// equal to s.76Matcher<const internal::StringView&>::Matcher(internal::StringView s) {77*this = Eq(std::string(s));78}7980// Constructs a matcher that matches a StringView whose value is equal to81// s.82Matcher<internal::StringView>::Matcher(const std::string& s) { *this = Eq(s); }8384// Constructs a matcher that matches a StringView whose value is equal to85// s.86Matcher<internal::StringView>::Matcher(const char* s) {87*this = Eq(std::string(s));88}8990// Constructs a matcher that matches a StringView whose value is equal to91// s.92Matcher<internal::StringView>::Matcher(internal::StringView s) {93*this = Eq(std::string(s));94}95#endif // GTEST_INTERNAL_HAS_STRING_VIEW9697} // namespace testing9899100