push.pass.cpp 747 B

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