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

Method TestRefCountedPtrsInHashSetImpl

util/generic/ptr_ut.cpp:747–761  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

745
746template <class T, class TRefCountedPtr>
747void TPointerTest::TestRefCountedPtrsInHashSetImpl() {
748 THashSet<TRefCountedPtr> hashSet;
749 TRefCountedPtr p1(new T());
750 UNIT_ASSERT(!IsIn(hashSet, p1));
751 UNIT_ASSERT(hashSet.insert(p1).second);
752 UNIT_ASSERT(IsIn(hashSet, p1));
753 UNIT_ASSERT_VALUES_EQUAL(hashSet.size(), 1);
754 UNIT_ASSERT(!hashSet.insert(p1).second);
755
756 TRefCountedPtr p2(new T());
757 UNIT_ASSERT(!IsIn(hashSet, p2));
758 UNIT_ASSERT(hashSet.insert(p2).second);
759 UNIT_ASSERT(IsIn(hashSet, p2));
760 UNIT_ASSERT_VALUES_EQUAL(hashSet.size(), 2);
761}
762
763struct TCustomIntrusivePtrOps: TDefaultIntrusivePtrOps<A> {
764};

Callers

nothing calls this directly

Calls 3

IsInFunction · 0.85
insertMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected