MCPcopy Create free account
hub / github.com/apache/singa / IsSubstringImpl

Function IsSubstringImpl

test/gtest/gtest-all.cc:2744–2759  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2742// or ::std::wstring.
2743template <typename StringType>
2744AssertionResult IsSubstringImpl(
2745 bool expected_to_be_substring,
2746 const char* needle_expr, const char* haystack_expr,
2747 const StringType& needle, const StringType& haystack) {
2748 if (IsSubstringPred(needle, haystack) == expected_to_be_substring)
2749 return AssertionSuccess();
2750
2751 const bool is_wide_string = sizeof(needle[0]) > 1;
2752 const char* const begin_string_quote = is_wide_string ? "L\"" : "\"";
2753 return AssertionFailure()
2754 << "Value of: " << needle_expr << "\n"
2755 << " Actual: " << begin_string_quote << needle << "\"\n"
2756 << "Expected: " << (expected_to_be_substring ? "" : "not ")
2757 << "a substring of " << haystack_expr << "\n"
2758 << "Which is: " << begin_string_quote << haystack << "\"";
2759}
2760
2761} // namespace
2762

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