@@ -9,60 +9,60 @@ using std::string;
9
9
10
10
#include " heap.hpp"
11
11
12
- TEST (heap, empty ) {
13
- heap <int > hp1;
14
- ASSERT_EQ (hp1.empty (), true );
15
- ASSERT_EQ (hp1.size (), 0 );
16
- hp1.push (1 );
17
- ASSERT_EQ (hp1.empty (), false );
18
- ASSERT_EQ (hp1.size (), 1 );
19
- ASSERT_EQ (hp1.pop_bottom (), 1 );
20
- EXPECT_THROW (hp1.bottom (), std::runtime_error);
21
- EXPECT_THROW (hp1.pop_bottom (), std::runtime_error);
12
+ TEST (Heap, Empty ) {
13
+ Heap <int > hp1;
14
+ ASSERT_EQ (hp1.Empty (), true );
15
+ ASSERT_EQ (hp1.Size (), 0 );
16
+ hp1.Push (1 );
17
+ ASSERT_EQ (hp1.Empty (), false );
18
+ ASSERT_EQ (hp1.Size (), 1 );
19
+ ASSERT_EQ (hp1.PopBottom (), 1 );
20
+ EXPECT_THROW (hp1.Bottom (), std::runtime_error);
21
+ EXPECT_THROW (hp1.PopBottom (), std::runtime_error);
22
22
}
23
- TEST (heap, comparable_1 ) {
24
- heap <std::array<int , 5 >> hp2;
25
- hp2.push ({1 , 1 , 1 , 1 , 1 });
23
+ TEST (Heap, Comparable1 ) {
24
+ Heap <std::array<int , 5 >> hp2;
25
+ hp2.Push ({1 , 1 , 1 , 1 , 1 });
26
26
std::array<int , 5 > test_array_1 = {1 , 1 , 1 , 1 , 1 };
27
27
std::array<int , 5 > test_array_2 = {1 , 1 , 1 , 1 , 0 };
28
- ASSERT_EQ (hp2.bottom (), test_array_1);
29
- ASSERT_EQ (hp2.pop_bottom () == test_array_2, false );
28
+ ASSERT_EQ (hp2.Bottom (), test_array_1);
29
+ ASSERT_EQ (hp2.PopBottom () == test_array_2, false );
30
30
}
31
31
32
- TEST (heap, without_duplicates ) {
33
- heap <int > hp3{};
34
- for (int value : {3 , 1 , 2 , 4 , 5 }) hp3.push (value);
35
- ASSERT_EQ (hp3.pop_bottom (), 1 );
36
- ASSERT_EQ (hp3.pop_bottom (), 2 );
37
- ASSERT_EQ (hp3.pop_bottom (), 3 );
38
- ASSERT_EQ (hp3.pop_bottom (), 4 );
39
- ASSERT_EQ (hp3.pop_bottom (), 5 );
32
+ TEST (Heap, WithoutDuplicates ) {
33
+ Heap <int > hp3{};
34
+ for (int value : {3 , 1 , 2 , 4 , 5 }) hp3.Push (value);
35
+ ASSERT_EQ (hp3.PopBottom (), 1 );
36
+ ASSERT_EQ (hp3.PopBottom (), 2 );
37
+ ASSERT_EQ (hp3.PopBottom (), 3 );
38
+ ASSERT_EQ (hp3.PopBottom (), 4 );
39
+ ASSERT_EQ (hp3.PopBottom (), 5 );
40
40
}
41
41
42
- TEST (heap, with_duplicates ) {
43
- heap <int > hp4{};
44
- for (int value : {6 , 7 , 7 , 3 , 3 , 3 , 1 , 2 }) hp4.push (value);
45
- ASSERT_EQ (hp4.pop_bottom (), 1 );
46
- ASSERT_EQ (hp4.pop_bottom (), 2 );
47
- ASSERT_EQ (hp4.pop_bottom (), 3 );
48
- ASSERT_EQ (hp4.pop_bottom (), 3 );
49
- ASSERT_EQ (hp4.pop_bottom (), 3 );
50
- ASSERT_EQ (hp4.pop_bottom (), 6 );
51
- ASSERT_EQ (hp4.pop_bottom (), 7 );
52
- ASSERT_EQ (hp4.pop_bottom (), 7 );
42
+ TEST (Heap, WithDuplicates ) {
43
+ Heap <int > hp4{};
44
+ for (int value : {6 , 7 , 7 , 3 , 3 , 3 , 1 , 2 }) hp4.Push (value);
45
+ ASSERT_EQ (hp4.PopBottom (), 1 );
46
+ ASSERT_EQ (hp4.PopBottom (), 2 );
47
+ ASSERT_EQ (hp4.PopBottom (), 3 );
48
+ ASSERT_EQ (hp4.PopBottom (), 3 );
49
+ ASSERT_EQ (hp4.PopBottom (), 3 );
50
+ ASSERT_EQ (hp4.PopBottom (), 6 );
51
+ ASSERT_EQ (hp4.PopBottom (), 7 );
52
+ ASSERT_EQ (hp4.PopBottom (), 7 );
53
53
}
54
54
55
- TEST (heap, init_list_constructor ) {
56
- heap <int > hp5{1 , 2 , 3 };
57
- ASSERT_EQ (hp5.pop_bottom (), 1 );
58
- ASSERT_EQ (hp5.pop_bottom (), 2 );
59
- ASSERT_EQ (hp5.pop_bottom (), 3 );
55
+ TEST (Heap, InitListConstructor ) {
56
+ Heap <int > hp5{1 , 2 , 3 };
57
+ ASSERT_EQ (hp5.PopBottom (), 1 );
58
+ ASSERT_EQ (hp5.PopBottom (), 2 );
59
+ ASSERT_EQ (hp5.PopBottom (), 3 );
60
60
}
61
61
62
- TEST (string_heap, simple_test ) {
63
- heap <string> hp6{" azz" , " bzz" , " zaa" , " zab" };
64
- ASSERT_EQ (hp6.pop_bottom (), " azz" );
65
- ASSERT_EQ (hp6.pop_bottom (), " bzz" );
66
- ASSERT_EQ (hp6.pop_bottom (), " zaa" );
67
- ASSERT_EQ (hp6.pop_bottom (), " zab" );
62
+ TEST (StringHeap, SimpleTest ) {
63
+ Heap <string> hp6{" azz" , " bzz" , " zaa" , " zab" };
64
+ ASSERT_EQ (hp6.PopBottom (), " azz" );
65
+ ASSERT_EQ (hp6.PopBottom (), " bzz" );
66
+ ASSERT_EQ (hp6.PopBottom (), " zaa" );
67
+ ASSERT_EQ (hp6.PopBottom (), " zab" );
68
68
}
0 commit comments