| 60 | } |
| 61 | |
| 62 | class SameString { |
| 63 | std::wstring_view m_MatchStr; |
| 64 | |
| 65 | void DescribeHelper(bool matches, std::ostream *os) const |
| 66 | { |
| 67 | *os << "is"; |
| 68 | if (!matches) |
| 69 | { |
| 70 | *os << "n't"; |
| 71 | } |
| 72 | |
| 73 | *os << " equal to " << testing::PrintToString(std::wstring(m_MatchStr)); |
| 74 | } |
| 75 | |
| 76 | public: |
| 77 | using is_gtest_matcher = void; |
| 78 | |
| 79 | constexpr SameString(std::wstring_view str) noexcept : m_MatchStr(str) { } |
| 80 | |
| 81 | constexpr bool MatchAndExplain(const std::tuple<const wchar_t *, rj::SizeType> &args, std::ostream *) const noexcept |
| 82 | { |
| 83 | return m_MatchStr == std::wstring_view { std::get<0>(args), std::get<1>(args) }; |
| 84 | } |
| 85 | |
| 86 | void DescribeTo(std::ostream *os) const { DescribeHelper(true, os); } |
| 87 | void DescribeNegationTo(std::ostream *os) const { DescribeHelper(false, os); } |
| 88 | }; |
| 89 | } |
| 90 | |
| 91 | TEST(RapidJSONHelper_TypeChecks, ReturnsTrueOnSameType) |