| 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) { |
no test coverage detected