]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/serialization/test/test_derived_class_ptr.cpp
6749c82219a4ecce9f280759f046088556258993
[ceph.git] / ceph / src / boost / libs / serialization / test / test_derived_class_ptr.cpp
1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2 // test_deriviec_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 <cstddef> // NULL
12 #include <fstream>
13
14 #include <cstdio> // remove
15 #include <boost/config.hpp>
16 #if defined(BOOST_NO_STDC_NAMESPACE)
17 namespace std{
18 using ::remove;
19 }
20 #endif
21
22 #include "test_tools.hpp"
23
24 #include "B.hpp"
25 #include "A.ipp"
26
27 int test_main( int /* argc */, char* /* argv */[] )
28 {
29 const char * testfile = boost::archive::tmpnam(NULL);
30 BOOST_REQUIRE(NULL != testfile);
31
32 B * tb = new B;
33 B * tb1 = NULL;
34
35 {
36 test_ostream os(testfile, TEST_STREAM_FLAGS);
37 test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
38 oa << boost::serialization::make_nvp("tb", tb);
39 }
40 {
41 test_istream is(testfile, TEST_STREAM_FLAGS);
42 test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
43 ia >> boost::serialization::make_nvp("tb",tb1);
44 }
45 BOOST_CHECK(tb != tb1);
46 BOOST_CHECK(*tb == *tb1);
47 delete tb;
48 std::remove(testfile);
49 return EXIT_SUCCESS;
50 }
51
52 // EOF