@@ -794,14 +794,30 @@ TEST(set_union, ExampleTwoWithDuplicates) {
794794
795795// Heap operations.
796796TEST (is_heap, ExampleOne) {
797-
797+ // Checks if the elements in the range are a max heap.
798+ const std::vector<int > v{9 , 5 , 4 , 1 , 1 , 3 };
799+ const bool v_is_heap = std::is_heap (v.cbegin (), v.cend ());
800+ EXPECT_TRUE (v_is_heap);
798801}
799802
800803TEST (is_heap_until, ExampleOne) {
804+ // Finds largest subsequence in the range that make a max heap.
805+ const std::vector<int > v1{9 , 5 , 4 , 1 , 1 , 3 };
806+ const auto iterator = std::is_heap_until (v1.cbegin (), v1.cend ());
807+ EXPECT_EQ (iterator, v1.cend ());
801808
809+ const std::vector<int > v2{9 , 5 , 4 , 1 , 1 , 3 , 2 , 6 };
810+ const auto iterator2 = std::is_heap_until (v2.cbegin (), v2.cend ());
811+ EXPECT_EQ (iterator2, v2.cend () - 1 );
802812}
803813
804814TEST (make_heap, ExampleOne) {
815+ // Constructs a max heap.
816+ std::vector<int > v{1 ,2 ,3 ,4 ,5 ,6 ,5 ,4 };
817+ std::make_heap (v.begin (), v.end ());
818+
819+ const std::vector<int > expected_heap{6 ,5 ,5 ,4 ,2 ,3 ,1 ,4 };
820+ EXPECT_EQ (v, expected_heap);
805821
806822}
807823
0 commit comments