1a11cd0d9STom Stellard // Copyright 2007, Google Inc.
2a11cd0d9STom Stellard // All rights reserved.
3a11cd0d9STom Stellard //
4a11cd0d9STom Stellard // Redistribution and use in source and binary forms, with or without
5a11cd0d9STom Stellard // modification, are permitted provided that the following conditions are
6a11cd0d9STom Stellard // met:
7a11cd0d9STom Stellard //
8a11cd0d9STom Stellard // * Redistributions of source code must retain the above copyright
9a11cd0d9STom Stellard // notice, this list of conditions and the following disclaimer.
10a11cd0d9STom Stellard // * Redistributions in binary form must reproduce the above
11a11cd0d9STom Stellard // copyright notice, this list of conditions and the following disclaimer
12a11cd0d9STom Stellard // in the documentation and/or other materials provided with the
13a11cd0d9STom Stellard // distribution.
14a11cd0d9STom Stellard // * Neither the name of Google Inc. nor the names of its
15a11cd0d9STom Stellard // contributors may be used to endorse or promote products derived from
16a11cd0d9STom Stellard // this software without specific prior written permission.
17a11cd0d9STom Stellard //
18a11cd0d9STom Stellard // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19a11cd0d9STom Stellard // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20a11cd0d9STom Stellard // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21a11cd0d9STom Stellard // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22a11cd0d9STom Stellard // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23a11cd0d9STom Stellard // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24a11cd0d9STom Stellard // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25a11cd0d9STom Stellard // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26a11cd0d9STom Stellard // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27a11cd0d9STom Stellard // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28a11cd0d9STom Stellard // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29a11cd0d9STom Stellard
30a11cd0d9STom Stellard // The Google C++ Testing and Mocking Framework (Google Test)
31a11cd0d9STom Stellard //
32a11cd0d9STom Stellard // This file implements just enough of the matcher interface to allow
33a11cd0d9STom Stellard // EXPECT_DEATH and friends to accept a matcher argument.
34a11cd0d9STom Stellard
35a11cd0d9STom Stellard #include "gtest/gtest-matchers.h"
36a11cd0d9STom Stellard
37a11cd0d9STom Stellard #include <string>
38a11cd0d9STom Stellard
39*a866ce78SHaowei Wu #include "gtest/internal/gtest-internal.h"
40*a866ce78SHaowei Wu #include "gtest/internal/gtest-port.h"
41*a866ce78SHaowei Wu
42a11cd0d9STom Stellard namespace testing {
43a11cd0d9STom Stellard
44a11cd0d9STom Stellard // Constructs a matcher that matches a const std::string& whose value is
45a11cd0d9STom Stellard // equal to s.
Matcher(const std::string & s)46a11cd0d9STom Stellard Matcher<const std::string&>::Matcher(const std::string& s) { *this = Eq(s); }
47a11cd0d9STom Stellard
48a11cd0d9STom Stellard // Constructs a matcher that matches a const std::string& whose value is
49a11cd0d9STom Stellard // equal to s.
Matcher(const char * s)50a11cd0d9STom Stellard Matcher<const std::string&>::Matcher(const char* s) {
51a11cd0d9STom Stellard *this = Eq(std::string(s));
52a11cd0d9STom Stellard }
53a11cd0d9STom Stellard
54a11cd0d9STom Stellard // Constructs a matcher that matches a std::string whose value is equal to
55a11cd0d9STom Stellard // s.
Matcher(const std::string & s)56a11cd0d9STom Stellard Matcher<std::string>::Matcher(const std::string& s) { *this = Eq(s); }
57a11cd0d9STom Stellard
58a11cd0d9STom Stellard // Constructs a matcher that matches a std::string whose value is equal to
59a11cd0d9STom Stellard // s.
Matcher(const char * s)60a11cd0d9STom Stellard Matcher<std::string>::Matcher(const char* s) { *this = Eq(std::string(s)); }
61a11cd0d9STom Stellard
62*a866ce78SHaowei Wu #if GTEST_INTERNAL_HAS_STRING_VIEW
63*a866ce78SHaowei Wu // Constructs a matcher that matches a const StringView& whose value is
64a11cd0d9STom Stellard // equal to s.
Matcher(const std::string & s)65*a866ce78SHaowei Wu Matcher<const internal::StringView&>::Matcher(const std::string& s) {
66a11cd0d9STom Stellard *this = Eq(s);
67a11cd0d9STom Stellard }
68a11cd0d9STom Stellard
69*a866ce78SHaowei Wu // Constructs a matcher that matches a const StringView& whose value is
70a11cd0d9STom Stellard // equal to s.
Matcher(const char * s)71*a866ce78SHaowei Wu Matcher<const internal::StringView&>::Matcher(const char* s) {
72a11cd0d9STom Stellard *this = Eq(std::string(s));
73a11cd0d9STom Stellard }
74a11cd0d9STom Stellard
75*a866ce78SHaowei Wu // Constructs a matcher that matches a const StringView& whose value is
76a11cd0d9STom Stellard // equal to s.
Matcher(internal::StringView s)77*a866ce78SHaowei Wu Matcher<const internal::StringView&>::Matcher(internal::StringView s) {
78a11cd0d9STom Stellard *this = Eq(std::string(s));
79a11cd0d9STom Stellard }
80a11cd0d9STom Stellard
81*a866ce78SHaowei Wu // Constructs a matcher that matches a StringView whose value is equal to
82a11cd0d9STom Stellard // s.
Matcher(const std::string & s)83*a866ce78SHaowei Wu Matcher<internal::StringView>::Matcher(const std::string& s) { *this = Eq(s); }
84a11cd0d9STom Stellard
85*a866ce78SHaowei Wu // Constructs a matcher that matches a StringView whose value is equal to
86a11cd0d9STom Stellard // s.
Matcher(const char * s)87*a866ce78SHaowei Wu Matcher<internal::StringView>::Matcher(const char* s) {
88a11cd0d9STom Stellard *this = Eq(std::string(s));
89a11cd0d9STom Stellard }
90a11cd0d9STom Stellard
91*a866ce78SHaowei Wu // Constructs a matcher that matches a StringView whose value is equal to
92a11cd0d9STom Stellard // s.
Matcher(internal::StringView s)93*a866ce78SHaowei Wu Matcher<internal::StringView>::Matcher(internal::StringView s) {
94a11cd0d9STom Stellard *this = Eq(std::string(s));
95a11cd0d9STom Stellard }
96*a866ce78SHaowei Wu #endif // GTEST_INTERNAL_HAS_STRING_VIEW
97a11cd0d9STom Stellard
98a11cd0d9STom Stellard } // namespace testing
99