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