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

Function SmokingTest

library/cpp/containers/flat_hash/ut/iterator_ut.cpp:15–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14 template <class Container>
15 void SmokingTest(Container& cont) {
16 using value_type = typename Container::value_type;
17 using iterator = TIterator<Container, value_type>;
18 using size_type = typename Container::size_type;
19
20 iterator f(&cont), l(&cont, cont.Size());
21 UNIT_ASSERT_EQUAL(f, l);
22 UNIT_ASSERT_EQUAL((size_type)std::distance(f, l), cont.Taken());
23
24 TVector<std::pair<size_type, value_type>> toAdd{
25 { 0, (int)RandomNumber<size_type>(INIT_SIZE) },
26 { 1 + RandomNumber<size_type>(INIT_SIZE - 2), (int)RandomNumber<size_type>(INIT_SIZE) },
27 { INIT_SIZE - 1, (int)RandomNumber<size_type>(INIT_SIZE) }
28 };
29
30 for (const auto& p : toAdd) {
31 UNIT_ASSERT(cont.IsEmpty(p.first));
32 cont.InitNode(p.first, p.second);
33 }
34 UNIT_ASSERT_EQUAL(cont.Size(), INIT_SIZE);
35 f = iterator{ &cont };
36 l = iterator{ &cont, INIT_SIZE };
37 UNIT_ASSERT_UNEQUAL(f, l);
38 UNIT_ASSERT_EQUAL((size_type)std::distance(f, l), cont.Taken());
39
40 TVector<value_type> added(f, l);
41 UNIT_ASSERT(::Equal(toAdd.begin(), toAdd.end(), added.begin(), [](const auto& p, auto v) {
42 return p.second == v;
43 }));
44 }
45
46 template <class Container>
47 void ConstTest(Container& cont) {

Callers 1

Y_UNIT_TESTFunction · 0.70

Calls 8

distanceFunction · 0.85
EqualFunction · 0.50
SizeMethod · 0.45
TakenMethod · 0.45
IsEmptyMethod · 0.45
InitNodeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected