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

Method TestConstructorsAndAssignments

util/generic/vector_ut.cpp:36–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34
35private:
36 void TestConstructorsAndAssignments() {
37 using container = TVector<int>;
38
39 container c1;
40 c1.push_back(100);
41 c1.push_back(200);
42
43 container c2(c1);
44
45 UNIT_ASSERT_VALUES_EQUAL(2, c1.size());
46 UNIT_ASSERT_VALUES_EQUAL(2, c2.size());
47 UNIT_ASSERT_VALUES_EQUAL(100, c1.at(0));
48 UNIT_ASSERT_VALUES_EQUAL(200, c2.at(1));
49
50 container c3(std::move(c1));
51
52 UNIT_ASSERT_VALUES_EQUAL(0, c1.size());
53 UNIT_ASSERT_VALUES_EQUAL(2, c3.size());
54 UNIT_ASSERT_VALUES_EQUAL(100, c3.at(0));
55
56 c2.push_back(300);
57 c3 = c2;
58
59 UNIT_ASSERT_VALUES_EQUAL(3, c2.size());
60 UNIT_ASSERT_VALUES_EQUAL(3, c3.size());
61 UNIT_ASSERT_VALUES_EQUAL(300, c3.at(2));
62
63 c2.push_back(400);
64 c3 = std::move(c2);
65
66 UNIT_ASSERT_VALUES_EQUAL(0, c2.size());
67 UNIT_ASSERT_VALUES_EQUAL(4, c3.size());
68 UNIT_ASSERT_VALUES_EQUAL(400, c3.at(3));
69 }
70
71 inline void TestTildeEmptyToNull() {
72 TVector<int> v;

Callers

nothing calls this directly

Calls 4

moveFunction · 0.50
push_backMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected