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

Function Y_UNIT_TEST

util/generic/queue_ut.cpp:11–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10Y_UNIT_TEST_SUITE(TYQueueTest) {
11 Y_UNIT_TEST(ConstructorsAndAssignments) {
12 {
13 using container = TQueue<int>;
14
15 container c1;
16 UNIT_ASSERT(!c1);
17 c1.push(100);
18 c1.push(200);
19 UNIT_ASSERT(c1);
20
21 container c2(c1);
22
23 UNIT_ASSERT_VALUES_EQUAL(2, c1.size());
24 UNIT_ASSERT_VALUES_EQUAL(2, c2.size());
25
26 container c3(std::move(c1));
27
28 UNIT_ASSERT_VALUES_EQUAL(0, c1.size());
29 UNIT_ASSERT_VALUES_EQUAL(2, c3.size());
30
31 c2.push(300);
32 c3 = c2;
33
34 UNIT_ASSERT_VALUES_EQUAL(3, c2.size());
35 UNIT_ASSERT_VALUES_EQUAL(3, c3.size());
36
37 c2.push(400);
38 c3 = std::move(c2);
39
40 UNIT_ASSERT_VALUES_EQUAL(0, c2.size());
41 UNIT_ASSERT_VALUES_EQUAL(4, c3.size());
42 }
43
44 {
45 using container = TPriorityQueue<int>;
46
47 container c1;
48 UNIT_ASSERT(!c1);
49 c1.push(100);
50 c1.push(200);
51 UNIT_ASSERT(c1);
52
53 container c2(c1);
54
55 UNIT_ASSERT_VALUES_EQUAL(2, c1.size());
56 UNIT_ASSERT_VALUES_EQUAL(2, c2.size());
57
58 container c3(std::move(c1));
59
60 UNIT_ASSERT_VALUES_EQUAL(0, c1.size());
61 UNIT_ASSERT_VALUES_EQUAL(2, c3.size());
62
63 c2.push(300);
64 c3 = c2;
65
66 UNIT_ASSERT_VALUES_EQUAL(3, c2.size());
67 UNIT_ASSERT_VALUES_EQUAL(3, c3.size());
68

Callers

nothing calls this directly

Calls 11

moveFunction · 0.50
pushMethod · 0.45
sizeMethod · 0.45
popMethod · 0.45
emptyMethod · 0.45
swapMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45
emplaceMethod · 0.45
PopValueMethod · 0.45
frontMethod · 0.45

Tested by

no test coverage detected