]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/serialization/performance/performance_simple_class.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / serialization / performance / performance_simple_class.cpp
1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2 // test_simple_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 // invoke header for a custom archive test.
12
13 #include <fstream>
14
15 #include <cstdio> // remove
16 #include <boost/config.hpp>
17
18 #if defined(BOOST_NO_STDC_NAMESPACE)
19 namespace std{
20 using ::remove;
21 }
22 #endif
23
24 #include "../test/test_tools.hpp"
25 #include <boost/preprocessor/stringize.hpp>
26 // #include <boost/preprocessor/cat.hpp>
27 // the following fails with (only!) gcc 3.4
28 // #include BOOST_PP_STRINGIZE(BOOST_PP_CAT(../test/,BOOST_ARCHIVE_TEST))
29 // just copy over the files from the test directory
30 #include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST)
31
32 #include <boost/serialization/nvp.hpp>
33 #include "../test/A.hpp"
34
35 int
36 test_main( int /* argc */, char* /* argv */[] )
37 {
38 const char * testfile = boost::archive::tmpnam(NULL);
39 BOOST_REQUIRE(NULL != testfile);
40
41 A a, a1;
42 {
43 test_ostream os(testfile, TEST_STREAM_FLAGS);
44 test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
45 oa << boost::serialization::make_nvp("a", a);
46 }
47 {
48 test_istream is(testfile, TEST_STREAM_FLAGS);
49 test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
50 ia >> boost::serialization::make_nvp("a", a1);
51 }
52 BOOST_CHECK_EQUAL(a, a1);
53 std::remove(testfile);
54 return (a == a1) ? EXIT_SUCCESS : EXIT_SUCCESS;
55 }