]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/serialization/performance/performance_vector.cpp
1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
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)
9 // should pass compilation and execution
13 #include <cstdio> // remove
14 #include <boost/config.hpp>
15 #if defined(BOOST_NO_STDC_NAMESPACE)
21 #include "../test/test_tools.hpp"
22 #include <boost/preprocessor/stringize.hpp>
23 // #include <boost/preprocessor/cat.hpp>
24 // the following fails with (only!) gcc 3.4
25 // #include BOOST_PP_STRINGIZE(BOOST_PP_CAT(../test/,BOOST_ARCHIVE_TEST))
26 // just copy over the files from the test directory
27 #include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST)
28 #include <boost/serialization/vector.hpp>
30 #include "../test/A.hpp"
35 const char * testfile
= boost::archive::tmpnam(NULL
);
36 BOOST_REQUIRE(NULL
!= testfile
);
38 // test array of objects
39 std::vector
<T
> avector
;
40 avector
.push_back(T());
41 avector
.push_back(T());
43 test_ostream
os(testfile
, TEST_STREAM_FLAGS
);
44 test_oarchive
oa(os
, TEST_ARCHIVE_FLAGS
);
45 oa
<< boost::serialization::make_nvp("avector", avector
);
47 std::vector
<T
> avector1
;
49 test_istream
is(testfile
, TEST_STREAM_FLAGS
);
50 test_iarchive
ia(is
, TEST_ARCHIVE_FLAGS
);
51 ia
>> boost::serialization::make_nvp("avector", avector1
);
53 BOOST_CHECK(avector
== avector1
);
54 std::remove(testfile
);
58 int test_main( int /* argc */, char* /* argv */[] )
60 int res
= test_vector(A());
61 // test an int vector for which optimized versions should be available
62 if (res
== EXIT_SUCCESS
)
65 if (res
== EXIT_SUCCESS
)
66 res
= test_vector(false);