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

Method replace

util/generic/string_ut.cpp:621–694  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

619 }
620#if 0
621 void replace() {
622 // This test case is for the non template basic_TString::replace method,
623 // this is why we play with the const iterators and reference to guaranty
624 // that the right method is called.
625
626 const TStringType v(Data._78());
627 TStringType s(Data._123456());
628 TStringType const& cs = s;
629
630 typename TStringType::iterator i = s.begin() + 1;
631 s.replace(i, i + 3, v.begin(), v.end());
632 UNIT_ASSERT(s == Data._17856());
633
634 s = Data._123456();
635 i = s.begin() + 1;
636 s.replace(i, i + 1, v.begin(), v.end());
637 UNIT_ASSERT(s == Data._1783456());
638
639 s = Data._123456();
640 i = s.begin() + 1;
641 typename TStringType::const_iterator ci = s.begin() + 1;
642 s.replace(i, i + 3, ci + 3, cs.end());
643 UNIT_ASSERT(s == Data._15656());
644
645 s = Data._123456();
646 i = s.begin() + 1;
647 ci = s.begin() + 1;
648 s.replace(i, i + 3, ci, ci + 2);
649 UNIT_ASSERT(s == Data._12356());
650
651 s = Data._123456();
652 i = s.begin() + 1;
653 ci = s.begin() + 1;
654 s.replace(i, i + 3, ci + 1, cs.end());
655 UNIT_ASSERT(s == Data._1345656());
656
657 s = Data._123456();
658 i = s.begin();
659 ci = s.begin() + 1;
660 s.replace(i, i, ci, ci + 1);
661 UNIT_ASSERT(s == Data._2123456());
662
663 s = Data._123456();
664 s.replace(s.begin() + 4, s.end(), cs.begin(), cs.end());
665 UNIT_ASSERT(s == Data._1234123456());
666
667 // This is the test for the template replace method.
668
669 s = Data._123456();
670 typename TStringType::iterator b = s.begin() + 4;
671 typename TStringType::iterator e = s.end();
672 typename TStringType::const_iterator rb = s.begin();
673 typename TStringType::const_iterator re = s.end();
674 s.replace(b, e, rb, re);
675 UNIT_ASSERT(s == Data._1234123456());
676
677 s = Data._123456();
678 s.replace(s.begin() + 4, s.end(), s.begin(), s.end());

Callers 6

get_flake8_resultsFunction · 0.45
TestReplaceMethod · 0.45
string.hFile · 0.45
TestZeroMethod · 0.45
WinSymLinkFunction · 0.45
SlashFolderLocalFunction · 0.45

Calls 14

_78Method · 0.80
_123456Method · 0.80
_17856Method · 0.80
_1783456Method · 0.80
_15656Method · 0.80
_12356Method · 0.80
_1345656Method · 0.80
_2123456Method · 0.80
_1234123456Method · 0.80
IMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by 2

TestReplaceMethod · 0.36
TestZeroMethod · 0.36