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

Function TEST

library/cpp/iterator/ut/iterate_values_ut.cpp:12–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace testing;
11
12TEST(IterateValues, ConstMappingIteration) {
13 const std::map<int, int> squares{
14 {1, 1},
15 {2, 4},
16 {3, 9},
17 };
18 EXPECT_THAT(
19 IterateValues(squares),
20 ElementsAre(1, 4, 9)
21 );
22
23 const std::unordered_map<int, int> roots{
24 {49, 7},
25 {36, 6},
26 {25, 5},
27 };
28 EXPECT_THAT(
29 IterateValues(roots),
30 UnorderedElementsAre(5, 6, 7)
31 );
32
33 const std::map<int, std::string> translations{
34 {1, "one"},
35 {2, "two"},
36 {3, "three"},
37 };
38 EXPECT_EQ(
39 Accumulate(IterateValues(translations), std::string{}),
40 "onetwothree"
41 );
42}
43
44TEST(IterateValues, NonConstMappingIteration) {
45 std::map<int, int> squares{

Callers

nothing calls this directly

Calls 7

IterateValuesFunction · 0.85
ElementsAreFunction · 0.85
UnorderedElementsAreFunction · 0.85
AccumulateFunction · 0.85
distanceFunction · 0.85
vectorFunction · 0.50
equal_rangeMethod · 0.45

Tested by

no test coverage detected