@@ -822,24 +822,87 @@ TEST(make_heap, ExampleOne) {
822
822
}
823
823
824
824
TEST (push_heap, ExampleOne) {
825
+ // Constructs a max heap.
826
+ std::vector<int > v{1 ,2 ,3 ,4 ,5 ,6 ,5 ,4 };
827
+ std::make_heap (v.begin (), v.end ());
825
828
829
+ v.push_back (9 );
830
+ std::push_heap (v.begin (), v.end ());
831
+
832
+ const std::vector<int > expected_heap{9 ,6 ,5 ,5 ,2 ,3 ,1 ,4 ,4 };
833
+ EXPECT_EQ (v, expected_heap);
826
834
}
827
835
828
836
TEST (pop_heap, ExampleOne) {
837
+ // Removes the largest element.
838
+ std::vector<int > v{1 ,2 ,3 ,4 ,5 ,6 ,5 ,4 };
839
+ std::make_heap (v.begin (), v.end ());
840
+
841
+ std::pop_heap (v.begin (), v.end ());
829
842
843
+ const std::vector<int > expected_heap{5 ,4 ,5 ,4 ,2 ,3 ,1 ,6 };
844
+ EXPECT_EQ (v, expected_heap);
830
845
}
831
846
832
847
TEST (sort_heap, ExampleOne) {
848
+ // Converts the max heap into a sorted range in ascending order.
849
+ std::vector<int > v{1 ,2 ,3 ,4 ,5 ,6 ,5 ,4 };
850
+ std::make_heap (v.begin (), v.end ());
833
851
852
+ const std::vector<int > expected_heap{6 ,5 ,5 ,4 ,2 ,3 ,1 ,4 };
853
+ EXPECT_EQ (v, expected_heap);
854
+
855
+ std::sort_heap (v.begin (), v.end ());
856
+ const std::vector<int > sorted_v{1 ,2 ,3 ,4 ,4 ,5 ,5 ,6 };
857
+ EXPECT_EQ (v, sorted_v);
834
858
}
835
859
836
860
// Minimum, maximum operations.
861
+ TEST (max, ExampleOne) {
862
+
863
+ }
864
+
865
+ TEST (max_element, ExampleOne) {
866
+
867
+ }
868
+
869
+ TEST (min, ExampleOne) {
870
+
871
+ }
872
+
873
+ TEST (min_element, ExampleOne) {
874
+
875
+ }
876
+
877
+ TEST (minmax, ExampleOne) {
878
+
879
+ }
880
+
881
+ TEST (minmax_element, ExampleOne) {
882
+
883
+ }
884
+
885
+ TEST (clamp, ExampleOne) {
886
+
887
+ }
837
888
838
889
// Comparison operations.
890
+ TEST (equal, ExampleOne) {}
891
+
892
+ TEST (lexicographical_compare, ExampleOne) {}
893
+
894
+ TEST (lexicographical_compare_three_way, ExampleOne) {}
839
895
840
896
// Permutation operations.
897
+ TEST (is_permutation, ExampleOne) {}
898
+
899
+ TEST (next_permutation, ExampleOne) {}
900
+
901
+ TEST (prev_permutation, ExampleOne) {}
841
902
842
903
// Numeric operations.
843
904
844
905
// Operations on uninitialized memory.
845
906
907
+ // C library.
908
+
0 commit comments