MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / IsSubstringImpl

Function IsSubstringImpl

test/common/gtest/gtest.cpp:3055–3070  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3053// or ::std::wstring.
3054template <typename StringType>
3055AssertionResult IsSubstringImpl(
3056 bool expected_to_be_substring,
3057 const char* needle_expr, const char* haystack_expr,
3058 const StringType& needle, const StringType& haystack) {
3059 if (IsSubstringPred(needle, haystack) == expected_to_be_substring)
3060 return AssertionSuccess();
3061
3062 const bool is_wide_string = sizeof(needle[0]) > 1;
3063 const char* const begin_string_quote = is_wide_string ? "L\"" : "\"";
3064 return AssertionFailure()
3065 << "Value of: " << needle_expr << "\n"
3066 << " Actual: " << begin_string_quote << needle << "\"\n"
3067 << "Expected: " << (expected_to_be_substring ? "" : "not ")
3068 << "a substring of " << haystack_expr << "\n"
3069 << "Which is: " << begin_string_quote << haystack << "\"";
3070}
3071
3072} // namespace
3073

Callers 2

IsSubstringFunction · 0.85
IsNotSubstringFunction · 0.85

Calls 3

IsSubstringPredFunction · 0.85
AssertionSuccessFunction · 0.85
AssertionFailureFunction · 0.85

Tested by

no test coverage detected