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

Method TestRefCount

util/generic/string_ut.h:650–670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

648
649#ifndef TSTRING_IS_STD_STRING
650 void TestRefCount() {
651 using TStr = TStringType;
652
653 struct TestStroka: public TStr {
654 using TStr::TStr;
655 // un-protect
656 using TStr::RefCount;
657 };
658
659 TestStroka s1(Data.orig());
660 UNIT_ASSERT_EQUAL(s1.RefCount() == 1, true);
661 TestStroka s2(s1);
662 UNIT_ASSERT_EQUAL(s1.RefCount() == 2, true);
663 UNIT_ASSERT_EQUAL(s2.RefCount() == 2, true);
664 UNIT_ASSERT_EQUAL(s1.c_str() == s2.c_str(), true); // the same pointer
665 char_type* beg = s2.begin();
666 UNIT_ASSERT_EQUAL(s1 == beg, true);
667 UNIT_ASSERT_EQUAL(s1.RefCount() == 1, true);
668 UNIT_ASSERT_EQUAL(s2.RefCount() == 1, true);
669 UNIT_ASSERT_EQUAL(s1.c_str() == s2.c_str(), false);
670 }
671#endif
672
673 // Find family

Callers

nothing calls this directly

Calls 4

origMethod · 0.80
RefCountMethod · 0.45
c_strMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected