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

Function MakeGraph

util/ysafeptr_ut.cpp:65–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63 }
64
65 std::pair<TVector<TObj<TRecursive>>, TVector<TPtr<TRecursive>>> MakeGraph(size_t size) {
66 TVector<TObj<TRecursive>> objects;
67 TVector<TPtr<TRecursive>> references;
68 for (size_t i = 0; i < size; ++i) {
69 TObj<TRecursive> p{new TRecursive{}};
70 if (i > 0) {
71 for (size_t refsN = 0; refsN < 5; ++refsN) {
72 size_t random = IntHash(i) % references.size();
73 p->Ref.push_back(references[random]);
74 }
75 size_t parent = (i - 1) >> 1;
76 objects[parent]->Own.push_back(p.Get());
77 size_t random = IntHash(i) % objects.size();
78 objects[random]->Own.push_back(p.Get());
79 }
80 objects.push_back(p.Get());
81 references.push_back(p.Get());
82 }
83 return {std::move(objects), std::move(references)};
84 }
85} // namespace
86
87Y_UNIT_TEST_SUITE(SafePtr) {

Callers 1

Y_UNIT_TESTFunction · 0.85

Calls 5

IntHashFunction · 0.85
moveFunction · 0.50
sizeMethod · 0.45
push_backMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected