1/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2// test_stack.cpp
3
4// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
5// Use, modification and distribution is subject to the Boost Software
6// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8
9// should pass compilation and execution
10
11#include <cstddef>
12#include <fstream>
13
14#include <cstdio> // remove
15#include <boost/config.hpp>
16#if defined(BOOST_NO_STDC_NAMESPACE)
17namespace std{
18 using ::remove;
19}
20#endif
21
22#include "test_tools.hpp"
23
24#include <boost/serialization/nvp.hpp>
25#include <boost/serialization/deque.hpp>
26#include <boost/serialization/stack.hpp>
27
28#include "A.hpp"
29#include "A.ipp"
30
31int test_main( int /* argc */, char* /* argv */[] )
32{
33 const char * testfile = boost::archive::tmpnam(NULL);
34 BOOST_REQUIRE(NULL != testfile);
35
36 // test array of objects
37 std::stack<A, std::deque<A> > astack, astack1;
38 astack.push(x: A());
39 astack.push(x: A());
40 {
41 test_ostream os(testfile, TEST_STREAM_FLAGS);
42 test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
43 oa << boost::serialization::make_nvp(n: "astack",v&: astack);
44 }
45 {
46 test_istream is(testfile, TEST_STREAM_FLAGS);
47 test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
48 ia >> boost::serialization::make_nvp(n: "astack",v&: astack1);
49 }
50 BOOST_CHECK(astack == astack1);
51
52 std::remove(filename: testfile);
53 return EXIT_SUCCESS;
54}
55
56// EOF
57

source code of boost/libs/serialization/test/test_stack.cpp