Last change
on this file since 33 was
29,
checked in by landauf, 16 years ago
|
updated boost from 1_33_1 to 1_34_1
|
File size:
1.4 KB
|
Line | |
---|
1 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
---|
2 | // test_vector.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 | #include <boost/preprocessor/stringize.hpp> |
---|
23 | #include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) |
---|
24 | |
---|
25 | #include <boost/serialization/vector.hpp> |
---|
26 | |
---|
27 | #include "A.hpp" |
---|
28 | |
---|
29 | int test_main( int /* argc */, char* /* argv */[] ) |
---|
30 | { |
---|
31 | const char * testfile = boost::archive::tmpnam(NULL); |
---|
32 | BOOST_REQUIRE(NULL != testfile); |
---|
33 | |
---|
34 | // test array of objects |
---|
35 | std::vector<A> avector; |
---|
36 | avector.push_back(A()); |
---|
37 | avector.push_back(A()); |
---|
38 | { |
---|
39 | test_ostream os(testfile, TEST_STREAM_FLAGS); |
---|
40 | test_oarchive oa(os); |
---|
41 | oa << boost::serialization::make_nvp("avector", avector); |
---|
42 | } |
---|
43 | std::vector<A> avector1; |
---|
44 | { |
---|
45 | test_istream is(testfile, TEST_STREAM_FLAGS); |
---|
46 | test_iarchive ia(is); |
---|
47 | ia >> boost::serialization::make_nvp("avector", avector1); |
---|
48 | } |
---|
49 | BOOST_CHECK(avector == avector1); |
---|
50 | std::remove(testfile); |
---|
51 | return EXIT_SUCCESS; |
---|
52 | } |
---|
53 | |
---|
54 | // EOF |
---|
Note: See
TracBrowser
for help on using the repository browser.