MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / IsSubstringImpl

Function IsSubstringImpl

tests/gtest/src/gtest.cc:1754–1769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1752// or ::std::wstring.
1753template <typename StringType>
1754AssertionResult IsSubstringImpl(
1755 bool expected_to_be_substring,
1756 const char* needle_expr, const char* haystack_expr,
1757 const StringType& needle, const StringType& haystack) {
1758 if (IsSubstringPred(needle, haystack) == expected_to_be_substring)
1759 return AssertionSuccess();
1760
1761 const bool is_wide_string = sizeof(needle[0]) > 1;
1762 const char* const begin_string_quote = is_wide_string ? "L\"" : "\"";
1763 return AssertionFailure()
1764 << "Value of: " << needle_expr << "\n"
1765 << " Actual: " << begin_string_quote << needle << "\"\n"
1766 << "Expected: " << (expected_to_be_substring ? "" : "not ")
1767 << "a substring of " << haystack_expr << "\n"
1768 << "Which is: " << begin_string_quote << haystack << "\"";
1769}
1770
1771} // namespace
1772

Callers 2

IsSubstringFunction · 0.70
IsNotSubstringFunction · 0.70

Calls 3

IsSubstringPredFunction · 0.70
AssertionSuccessFunction · 0.70
AssertionFailureFunction · 0.70

Tested by

no test coverage detected