push.pass.cpp 834 B

1234567891011121314151617181920212223242526272829303132333435
  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. // void push(const value_type& v);
  10. #include <queue>
  11. #include <cassert>
  12. #include "test_macros.h"
  13. int main(int, char**)
  14. {
  15. std::queue<int> q;
  16. q.push(1);
  17. assert(q.size() == 1);
  18. assert(q.front() == 1);
  19. assert(q.back() == 1);
  20. q.push(2);
  21. assert(q.size() == 2);
  22. assert(q.front() == 1);
  23. assert(q.back() == 2);
  24. q.push(3);
  25. assert(q.size() == 3);
  26. assert(q.front() == 1);
  27. assert(q.back() == 3);
  28. return 0;
  29. }