Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60277 - trunk/libs/serialization/test
From: ramey_at_[hidden]
Date: 2010-03-06 22:13:33


Author: ramey
Date: 2010-03-06 22:13:32 EST (Sat, 06 Mar 2010)
New Revision: 60277
URL: http://svn.boost.org/trac/boost/changeset/60277

Log:
update tests for latest changes
Text files modified:
   trunk/libs/serialization/test/Jamfile.v2 | 4 ++--
   trunk/libs/serialization/test/polymorphic_derived2.cpp | 9 ++++++++-
   trunk/libs/serialization/test/polymorphic_derived2.hpp | 7 +------
   trunk/libs/serialization/test/test_check.cpp | 2 +-
   trunk/libs/serialization/test/test_dll_exported.cpp | 13 +++++++++++++
   trunk/libs/serialization/test/test_exported.cpp | 21 +++++++++++++++++++--
   trunk/libs/serialization/test/test_no_rtti.cpp | 8 ++++++++
   7 files changed, 52 insertions(+), 12 deletions(-)

Modified: trunk/libs/serialization/test/Jamfile.v2
==============================================================================
--- trunk/libs/serialization/test/Jamfile.v2 (original)
+++ trunk/libs/serialization/test/Jamfile.v2 2010-03-06 22:13:32 EST (Sat, 06 Mar 2010)
@@ -71,7 +71,7 @@
      [ test-bsl-run_files test_derived_class : A ]
      [ test-bsl-run_files test_derived_class_ptr : A ]
      [ test-bsl-run_files test_diamond ]
- [ test-bsl-run_files test_exported : polymorphic_base ]
+ [ test-bsl-run_files test_exported : polymorphic_base polymorphic_derived2 ]
      [ test-bsl-run_files test_class_info_load ]
      [ test-bsl-run_files test_class_info_save ]
      [ test-bsl-run_files test_object ]
@@ -111,7 +111,7 @@
 if ! $(BOOST_ARCHIVE_LIST) {
     test-suite "serialization2" :
         [ test-bsl-run test_dll_exported : : dll_polymorphic_derived2_lib : <runtime-link>shared ]
-# [ test-bsl-run test_dll_plugin : : dll_polymorphic_derived2_lib : <runtime-link>shared ]
+ [ test-bsl-run test_dll_plugin : : dll_polymorphic_derived2_lib : <runtime-link>shared ]
         [ compile test_dll_plugin.cpp ]
         [ test-bsl-run test_dll_simple : : dll_a_lib : <runtime-link>shared ]
         [ test-bsl-run test_private_ctor ]

Modified: trunk/libs/serialization/test/polymorphic_derived2.cpp
==============================================================================
--- trunk/libs/serialization/test/polymorphic_derived2.cpp (original)
+++ trunk/libs/serialization/test/polymorphic_derived2.cpp 2010-03-06 22:13:32 EST (Sat, 06 Mar 2010)
@@ -15,6 +15,14 @@
 #define POLYMORPHIC_DERIVED2_EXPORT
 #include "polymorphic_derived2.hpp"
 
+template<class Archive>
+void polymorphic_derived2::serialize(
+ Archive &ar,
+ const unsigned int /* file_version */
+){
+ ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);
+}
+
 // instantiate code for text archives
 #include <boost/archive/text_oarchive.hpp>
 #include <boost/archive/text_iarchive.hpp>
@@ -47,7 +55,6 @@
 // note: export has to be AFTER #includes for all archive classes
 BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_derived2)
 
-// export plug-in not yet working !!!
 #if 0
 #include <boost/serialization/factory.hpp>
 BOOST_SERIALIZATION_FACTORY_0(polymorphic_derived2)

Modified: trunk/libs/serialization/test/polymorphic_derived2.hpp
==============================================================================
--- trunk/libs/serialization/test/polymorphic_derived2.hpp (original)
+++ trunk/libs/serialization/test/polymorphic_derived2.hpp 2010-03-06 22:13:32 EST (Sat, 06 Mar 2010)
@@ -21,7 +21,6 @@
 #include <boost/serialization/base_object.hpp>
 #include <boost/serialization/type_info_implementation.hpp>
 #include <boost/serialization/extended_type_info_typeid.hpp>
-#include <boost/serialization/factory.hpp>
 
 #include <boost/preprocessor/empty.hpp>
 
@@ -45,9 +44,7 @@
     void serialize(
         Archive &ar,
         const unsigned int /* file_version */
- ){
- ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);
- }
+ );
     virtual const char * get_key() const {
         return "polymorphic_derived2";
     }
@@ -66,8 +63,6 @@
     boost::serialization::extended_type_info_typeid<polymorphic_derived2>
 )
 
-BOOST_SERIALIZATION_FACTORY_0(polymorphic_derived2)
-
 #undef DLL_DECL
 
 #endif // POLYMORPHIC_DERIVED2_HPP

Modified: trunk/libs/serialization/test/test_check.cpp
==============================================================================
--- trunk/libs/serialization/test/test_check.cpp (original)
+++ trunk/libs/serialization/test/test_check.cpp 2010-03-06 22:13:32 EST (Sat, 06 Mar 2010)
@@ -106,7 +106,7 @@
         oa << BOOST_SERIALIZATION_NVP(c1_out);
 
         check1 c1_non_const_out;
- oa << BOOST_SERIALIZATION_NVP(c1_non_const_out; // warn check_object_tracking
+ oa << BOOST_SERIALIZATION_NVP(c1_non_const_out); // warn check_object_tracking
 
         check1 * const c1_ptr_out = 0;
         oa << BOOST_SERIALIZATION_NVP(c1_ptr_out); // warn check_pointer_level

Modified: trunk/libs/serialization/test/test_dll_exported.cpp
==============================================================================
--- trunk/libs/serialization/test/test_dll_exported.cpp (original)
+++ trunk/libs/serialization/test/test_dll_exported.cpp 2010-03-06 22:13:32 EST (Sat, 06 Mar 2010)
@@ -77,11 +77,13 @@
 
     polymorphic_base *rb1 = new polymorphic_derived1;
     polymorphic_base *rb2 = new polymorphic_derived2;
+ polymorphic_derived2 *rd21 = new polymorphic_derived2;
 
     // export will permit correct serialization
     // through a pointer to a base class
     oa << BOOST_SERIALIZATION_NVP(rb1);
     oa << BOOST_SERIALIZATION_NVP(rb2);
+ oa << BOOST_SERIALIZATION_NVP(rd21);
 
     delete rb1;
     delete rb2;
@@ -95,6 +97,7 @@
 
     polymorphic_base *rb1 = NULL;
     polymorphic_base *rb2 = NULL;
+ polymorphic_derived2 *rd21 = NULL;
 
     // export will permit correct serialization
     // through a pointer to a base class
@@ -116,8 +119,18 @@
             ::type::get_const_instance().get_derived_extended_type_info(*rb2),
         "restored pointer b2 not of correct type"
     );
+ ia >> BOOST_SERIALIZATION_NVP(rd21);
+ BOOST_CHECK_MESSAGE(
+ boost::serialization::type_info_implementation<polymorphic_derived2>
+ ::type::get_const_instance()
+ ==
+ * boost::serialization::type_info_implementation<polymorphic_derived2>
+ ::type::get_const_instance().get_derived_extended_type_info(*rd21),
+ "restored pointer d2 not of correct type"
+ );
     delete rb1;
     delete rb2;
+ delete rd21;
 }
 
 int

Modified: trunk/libs/serialization/test/test_exported.cpp
==============================================================================
--- trunk/libs/serialization/test/test_exported.cpp (original)
+++ trunk/libs/serialization/test/test_exported.cpp 2010-03-06 22:13:32 EST (Sat, 06 Mar 2010)
@@ -53,11 +53,28 @@
 
 #include "polymorphic_derived2.hpp"
 
-BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_derived2)
-
 // MWerks users can do this to make their code work
 BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived2)
 
+template<class Archive>
+void polymorphic_derived2::serialize(
+ Archive &ar,
+ const unsigned int /* file_version */
+){
+ ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);
+}
+
+BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_derived2)
+
+template EXPORT_DECL(void) polymorphic_derived2::serialize(
+ test_oarchive & ar,
+ const unsigned int version
+);
+template EXPORT_DECL(void) polymorphic_derived2::serialize(
+ test_iarchive & ar,
+ const unsigned int version
+);
+
 // save exported polymorphic class
 void save_exported(const char *testfile)
 {

Modified: trunk/libs/serialization/test/test_no_rtti.cpp
==============================================================================
--- trunk/libs/serialization/test/test_no_rtti.cpp (original)
+++ trunk/libs/serialization/test/test_no_rtti.cpp 2010-03-06 22:13:32 EST (Sat, 06 Mar 2010)
@@ -44,6 +44,14 @@
 #include "polymorphic_derived1.hpp"
 #include "polymorphic_derived2.hpp"
 
+template<class Archive>
+void polymorphic_derived2::serialize(
+ Archive &ar,
+ const unsigned int /* file_version */
+){
+ ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);
+}
+
 template void polymorphic_derived2::serialize(
     test_oarchive & ar,
     const unsigned int version


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