• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2 // test_forward_list.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> // NULL
12 #include <fstream>
13 #include <cstdio> // remove
14 #if defined(BOOST_NO_STDC_NAMESPACE)
15 namespace std{
16     using ::remove;
17 }
18 #endif
19 
20 #include <boost/config.hpp>
21 #include <boost/serialization/forward_list.hpp>
22 
23 #include <boost/archive/archive_exception.hpp>
24 #include "test_tools.hpp"
25 
26 #include "A.hpp"
27 #include "A.ipp"
28 
test_main(int,char * [])29 int test_main( int /* argc */, char* /* argv */[] )
30 {
31     const char * testfile = boost::archive::tmpnam(NULL);
32     std::forward_list<A> aslist;
33     aslist.push_front(A());
34     aslist.push_front(A());
35     {
36         test_ostream os(testfile, TEST_STREAM_FLAGS);
37         test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
38         oa << boost::serialization::make_nvp("aslist", aslist);
39     }
40     std::forward_list<A> aslist1;{
41         test_istream is(testfile, TEST_STREAM_FLAGS);
42         test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
43         ia >> boost::serialization::make_nvp("aslist", aslist1);
44     }
45     BOOST_CHECK(aslist == aslist1);
46     std::remove(testfile);
47     return EXIT_SUCCESS;
48 }
49 
50 // EOF
51 
52