Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/serialization/test/test_simple_class.cpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.3 KB
Line 
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)
19namespace std{ 
20    using ::remove;
21}
22#endif
23
24#include "test_tools.hpp"
25#include <boost/preprocessor/stringize.hpp>
26#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST)
27
28#include <boost/serialization/nvp.hpp>
29#include "A.hpp"
30
31int 
32test_main( int /* argc */, char* /* argv */[] )
33{
34    const char * testfile = boost::archive::tmpnam(NULL);
35    BOOST_REQUIRE(NULL != testfile);
36
37    A a, a1;
38    {   
39        test_ostream os(testfile, TEST_STREAM_FLAGS);
40        test_oarchive oa(os);
41        oa << boost::serialization::make_nvp("a", a);
42    }
43    {
44        test_istream is(testfile, TEST_STREAM_FLAGS);
45        test_iarchive ia(is);
46        ia >> boost::serialization::make_nvp("a", a1);
47    }
48    BOOST_CHECK_EQUAL(a, a1);
49    std::remove(testfile);
50    return (a == a1) ? EXIT_SUCCESS : EXIT_SUCCESS;
51}
Note: See TracBrowser for help on using the repository browser.