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

Function DoTestSubstGlobal

util/string/subst_ut.cpp:64–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62 }
63
64 static void DoTestSubstGlobal(TVector<TString>& parts, const size_t minBeg, const size_t sz,
65 const TString& from, const size_t fromPos, const size_t numSubst) {
66 const size_t numLeft = numSubst - parts.size();
67 for (size_t fromBeg = minBeg; fromBeg <= sz - numLeft * from.size(); ++fromBeg) {
68 if (parts.empty()) {
69 parts.emplace_back(fromBeg, '.');
70 } else {
71 parts.emplace_back(fromBeg - minBeg, '.');
72 }
73
74 if (numLeft == 1) {
75 parts.emplace_back(sz - fromBeg - from.size(), '.');
76 TString sFrom = JoinSeq(from, parts);
77 UNIT_ASSERT_VALUES_EQUAL_C(sFrom.size(), sz, sFrom);
78 for (const auto& to : ALL_TO) {
79 TString sTo = JoinSeq(to, parts);
80 AssertSubstGlobal(sFrom, sTo, from, to, fromPos, numSubst);
81 }
82 parts.pop_back();
83 } else {
84 DoTestSubstGlobal(parts, fromBeg + from.size(), sz, from, fromPos, numSubst);
85 }
86
87 parts.pop_back();
88 }
89 }
90
91 static void DoTestSubstGlobal(size_t numSubst) {
92 TVector<TString> parts;

Callers 1

Y_UNIT_TESTFunction · 0.85

Calls 6

JoinSeqFunction · 0.85
AssertSubstGlobalFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45
emplace_backMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected