MCPcopy Create free account
hub / github.com/catboost/catboost / AssertSubstGlobal

Function AssertSubstGlobal

util/string/subst_ut.cpp:12–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10 static const TVector<TString> ALL_TO{TString(""), TString("T"), TString("TT"), TString("TTT")};
11
12 static void AssertSubstGlobal(const TString& sFrom, const TString& sTo, const TString& from, const TString& to, const size_t fromPos, const size_t numSubst) {
13 TString s = sFrom;
14 size_t res = SubstGlobal(s, from, to, fromPos);
15 UNIT_ASSERT_VALUES_EQUAL_C(res, numSubst,
16 TStringBuilder() << "numSubst=" << numSubst << ", fromPos=" << fromPos << ", " << sFrom << " -> " << sTo);
17 if (numSubst) {
18 UNIT_ASSERT_STRINGS_EQUAL_C(s, sTo,
19 TStringBuilder() << "numSubst=" << numSubst << ", fromPos=" << fromPos << ", " << sFrom << " -> " << sTo);
20 } else {
21 // ensure s didn't trigger copy-on-write
22 UNIT_ASSERT_VALUES_EQUAL_C(s.c_str(), sFrom.c_str(),
23 TStringBuilder() << "numSubst=" << numSubst << ", fromPos=" << fromPos << ", " << sFrom << " -> " << sTo);
24 }
25 }
26
27 Y_UNIT_TEST(TestSubstGlobalNoSubstA) {
28 for (const auto& from : ALL_FROM) {

Callers 2

Y_UNIT_TESTFunction · 0.85
DoTestSubstGlobalFunction · 0.85

Calls 3

SubstGlobalFunction · 0.70
TStringBuilderClass · 0.70
c_strMethod · 0.45

Tested by

no test coverage detected