|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r48718 - trunk/libs/serialization/test
From: ramey_at_[hidden]
Date: 2008-09-10 23:49:39
Author: ramey
Date: 2008-09-10 23:49:39 EDT (Wed, 10 Sep 2008)
New Revision: 48718
URL: http://svn.boost.org/trac/boost/changeset/48718
Log:
updated test for text binary
Text files modified:
trunk/libs/serialization/test/test_binary.cpp | 36 +++++++++++++++++++++++++++++++++++-
trunk/libs/serialization/test/test_exported.cpp | 2 +-
2 files changed, 36 insertions(+), 2 deletions(-)
Modified: trunk/libs/serialization/test/test_binary.cpp
==============================================================================
--- trunk/libs/serialization/test/test_binary.cpp (original)
+++ trunk/libs/serialization/test/test_binary.cpp 2008-09-10 23:49:39 EDT (Wed, 10 Sep 2008)
@@ -65,13 +65,33 @@
BOOST_REQUIRE(NULL != testfile);
const A a;
- A a1;
+ char s1[] = "a";
+ char s2[] = "ab";
+ char s3[] = "abc";
+ char s4[] = "abcd";
const int i = 12345;
+ A a1;
+ char s1_1[10];
+ char s1_2[10];
+ char s1_3[10];
+ char s1_4[10];
int i1 = 34790;
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
oa << BOOST_SERIALIZATION_NVP(a);
+ boost::serialization::make_nvp(
+ "s1", boost::serialization::make_binary_object(s1, sizeof(s1))
+ );
+ oa << boost::serialization::make_nvp(
+ "s2", boost::serialization::make_binary_object(s2, sizeof(s2))
+ );
+ oa << boost::serialization::make_nvp(
+ "s3", boost::serialization::make_binary_object(s3, sizeof(s3))
+ );
+ oa << boost::serialization::make_nvp(
+ "s4", boost::serialization::make_binary_object(s4, sizeof(s4))
+ );
// note: add a little bit on the end of the archive to detect
// failure of text mode binary.
oa << BOOST_SERIALIZATION_NVP(i);
@@ -80,6 +100,20 @@
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
ia >> BOOST_SERIALIZATION_NVP(a1);
+ boost::serialization::make_nvp(
+ "s1", boost::serialization::make_binary_object(s1_1, sizeof(s1))
+ );
+ ia >> boost::serialization::make_nvp(
+ "s2", boost::serialization::make_binary_object(s1_2, sizeof(s2))
+ );
+ ia >> boost::serialization::make_nvp(
+ "s3", boost::serialization::make_binary_object(s1_3, sizeof(s3))
+ );
+ ia >> boost::serialization::make_nvp(
+ "s4", boost::serialization::make_binary_object(s1_4, sizeof(s4))
+ );
+ // note: add a little bit on the end of the archive to detect
+ // failure of text mode binary.
ia >> BOOST_SERIALIZATION_NVP(i1);
}
BOOST_CHECK(i == i1);
Modified: trunk/libs/serialization/test/test_exported.cpp
==============================================================================
--- trunk/libs/serialization/test/test_exported.cpp (original)
+++ trunk/libs/serialization/test/test_exported.cpp 2008-09-10 23:49:39 EDT (Wed, 10 Sep 2008)
@@ -19,8 +19,8 @@
}
#endif
-#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
+#include <boost/serialization/base_object.hpp>
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/archive/archive_exception.hpp>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk