stack4_main.cpp 664 B

123456789101112131415161718192021222324252627282930
  1. // Copyright (C) 2008-2018 Lorenzo Caminiti
  2. // Distributed under the Boost Software License, Version 1.0 (see accompanying
  3. // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
  4. // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
  5. //[meyer97_stack4_main
  6. #include "stack4.hpp"
  7. #include <cassert>
  8. int main() {
  9. stack4<int> s(3);
  10. assert(s.capacity() == 3);
  11. assert(s.count() == 0);
  12. assert(s.empty());
  13. assert(!s.full());
  14. s.put(123);
  15. assert(!s.empty());
  16. assert(!s.full());
  17. assert(s.item() == 123);
  18. s.remove();
  19. assert(s.empty());
  20. assert(!s.full());
  21. return 0;
  22. }
  23. //]