pop.pass.cpp 791 B

12345678910111213141516171819202122232425262728293031323334353637
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. // <queue>
  9. // priority_queue();
  10. // void pop();
  11. #include <queue>
  12. #include <cassert>
  13. #include "test_macros.h"
  14. int main(int, char**)
  15. {
  16. std::priority_queue<int> q;
  17. q.push(1);
  18. assert(q.top() == 1);
  19. q.push(3);
  20. assert(q.top() == 3);
  21. q.push(2);
  22. assert(q.top() == 3);
  23. q.pop();
  24. assert(q.top() == 2);
  25. q.pop();
  26. assert(q.top() == 1);
  27. q.pop();
  28. assert(q.empty());
  29. return 0;
  30. }