From ca5be78419920b869f060ec5ff72ba208865dc26 Mon Sep 17 00:00:00 2001 From: Robert Ramey Date: Thu, 27 Sep 2007 04:10:56 +0000 Subject: [PATCH] improvements to extended type info system - unfortunately, these break the export. [SVN r39568] --- test/Jamfile.v2 | 157 +++------------------------- test/binary_archive.hpp | 4 +- test/polymorphic_text_archive.hpp | 1 - test/polymorphic_text_warchive.hpp | 1 - test/polymorphic_xml_archive.hpp | 1 - test/polymorphic_xml_warchive.hpp | 1 - test/portable_binary_archive.hpp | 11 +- test/test_array.cpp | 8 +- test/test_binary.cpp | 6 +- test/test_class_info_load.cpp | 4 +- test/test_class_info_save.cpp | 4 +- test/test_contained_class.cpp | 6 +- test/test_cyclic_ptrs.cpp | 6 +- test/test_delete_pointer.cpp | 6 +- test/test_demo.cpp | 5 - test/test_demo_auto_ptr.cpp | 5 - test/test_demo_exception.cpp | 5 - test/test_demo_fast_archive.cpp | 5 - test/test_demo_pimpl.cpp | 5 - test/test_demo_polymorphic.cpp | 5 - test/test_demo_portable_archive.cpp | 5 - test/test_demo_shared_ptr.cpp | 5 - test/test_demo_xml.cpp | 5 - test/test_demo_xml_load.cpp | 5 - test/test_demo_xml_save.cpp | 5 - test/test_deque.cpp | 6 +- test/test_derived.cpp | 15 ++- test/test_derived_class.cpp | 6 +- test/test_derived_class_ptr.cpp | 6 +- test/test_diamond.cpp | 2 - test/test_exported.cpp | 11 +- test/test_list.cpp | 10 +- test/test_list_ptrs.cpp | 10 +- test/test_map.cpp | 22 ++-- test/test_mi.cpp | 2 - test/test_mult_archive_types.cpp | 2 - test/test_multiple_ptrs.cpp | 6 +- test/test_no_rtti.cpp | 18 ++-- test/test_non_default_ctor.cpp | 6 +- test/test_non_default_ctor2.cpp | 6 +- test/test_non_intrusive.cpp | 6 +- test/test_not_serializable.cpp | 6 +- test/test_null_ptr.cpp | 6 +- test/test_nvp.cpp | 10 +- test/test_object.cpp | 6 +- test/test_optional.cpp | 6 +- test/test_pimpl.cpp | 2 - test/test_polymorphic.cpp | 23 ++-- test/test_primitive.cpp | 6 +- test/test_recursion.cpp | 6 +- test/test_registered.cpp | 22 ++-- test/test_set.cpp | 18 ++-- test/test_shared_ptr.cpp | 14 ++- test/test_shared_ptr_132.cpp | 14 ++- test/test_simple_class.cpp | 6 +- test/test_simple_class_ptr.cpp | 6 +- test/test_split.cpp | 6 +- test/test_tools.hpp | 90 ++++++++++++++-- test/test_tracking.cpp | 6 +- test/test_traits_fail.cpp | 2 - test/test_traits_pass.cpp | 2 - test/test_unregistered.cpp | 17 ++- test/test_valarray.cpp | 6 +- test/test_variant.cpp | 10 +- test/test_vector.cpp | 6 +- test/test_void_cast.cpp | 62 +++++------ test/text_archive.hpp | 1 - test/text_warchive.hpp | 6 -- test/xml_archive.hpp | 3 - test/xml_warchive.hpp | 3 - 70 files changed, 284 insertions(+), 492 deletions(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 9e27d74d..11b45d22 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -10,21 +10,19 @@ project libs/serialization/test : id serialization_test ; -BOOST_ARCHIVE_LIST = [ modules.peek : BOOST_ARCHIVE_LIST ] ; +# import rules from the boost serialization test +# import ../util/test : test-bsl-run-no-lib ; +import ../util/test : + run-invoke + run-winvoke + test-bsl-run-no-lib + test-bsl-run + test-bsl-run_archive + test-bsl-run_files + test-bsl-run_polymorphic_archive +; -# these are used to shorten testing while in development. It permits -# testing to be applied to just a particular type of archive -if ! $(BOOST_ARCHIVE_LIST) { - BOOST_ARCHIVE_LIST = - "text_archive.hpp" - "text_warchive.hpp" - "binary_archive.hpp" - "xml_archive.hpp" - "xml_warchive.hpp" - ; - # enable the tests which don't depend on a particular archive - BOOST_SERIALIZATION_TEST = true ; -} +BOOST_ARCHIVE_LIST = [ modules.peek : BOOST_ARCHIVE_LIST ] ; rule run-template ( test-name : sources * : requirements * ) { return [ @@ -42,7 +40,7 @@ rule run-template ( test-name : sources * : requirements * ) { msvc:"-Gy" # toolset shared library support como,shared:no -# msvc,stlport,shared:no + msvc,stlport,shared:no cw,static:no $(requirements) : # test name @@ -50,133 +48,6 @@ rule run-template ( test-name : sources * : requirements * ) { ] ; } -# Given a name of test, return the 'save' test that must be run -# before the named test, or empty string if there's no such test. -rule dependency-save-test ( test ) -{ - local m = [ MATCH (.*)load(.*) : $(test) ] ; - if $(m) - { - return $(m[1])save$(m[2]) ; - } -} - -# each of the following tests is run with each type of archive -rule run-invoke ( test-name : sources * : defns * ) -{ - local save-test = [ dependency-save-test $(test-name) ] ; - - local tests ; - tests += [ - run-template $(test-name) - : # sources - $(sources) - ../build//boost_serialization - : # requirements - $(defns) - BOOST_LIB_DIAGNOSTIC=1 - $(save-test) - ] ; - return $(tests) ; -} - -# each of the following tests is run with each type of archive -rule run-winvoke ( test-name : sources * : defns * ) -{ - local save-test = [ dependency-save-test $(test-name) ] ; - - local tests ; - tests += [ - run-template $(test-name) - : # sources - $(sources) - ../build//boost_serialization - ../build//boost_wserialization - : # requirements - $(defns) - BOOST_LIB_DIAGNOSTIC=1 - # both stlport and msvc6 define iswspace - msvc,stlport:"-force:multiple" - $(save-test) - ../../config/test//BOOST_NO_STD_WSTREAMBUF - ] ; - return $(tests) ; -} - -# for tests which don't use library code - usually just headers -rule test-bsl-run-no-lib ( test-name : sources * : requirements * ) -{ - local tests ; - tests += [ - run-template $(test-name) - : # sources - $(test-name).cpp $(sources).cpp - : - $(requirements) - ] ; - return $(tests) ; -} - -rule test-bsl-run ( test-name : sources * : requirements * ) -{ - local tests ; - tests += [ - run-invoke $(test-name) - : # sources - $(test-name).cpp $(sources).cpp - : - $(requirements) - ] ; - return $(tests) ; -} - -rule test-bsl-run_archive ( test-name : archive-name : sources * ) { - local tests ; - switch $(archive-name) { - case "*_warchive" : - tests += [ - run-winvoke $(test-name)_$(archive-name) - : - $(sources).cpp - : - BOOST_ARCHIVE_TEST=$(archive-name).hpp - ] ; - case "*" : - tests += [ - run-invoke $(test-name)_$(archive-name) - : - $(sources).cpp - : - BOOST_ARCHIVE_TEST=$(archive-name).hpp - ] ; - } - return $(tests) ; -} - -rule test-bsl-run_files ( test-name : sources * ) { - local tests ; - for local defn in $(BOOST_ARCHIVE_LIST) { - tests += [ - test-bsl-run_archive $(test-name) - : $(defn:LB) - : $(test-name) $(sources) - ] ; - } - return $(tests) ; -} - -rule test-bsl-run_polymorphic_archive ( test-name : sources * ) { - local tests ; - for local defn in $(BOOST_ARCHIVE_LIST) { - tests += [ - test-bsl-run_archive test - : polymorphic_$(defn:LB) - : test_polymorphic $(sources) - ] ; - } - return $(tests) ; -} - test-suite "serialization" : [ test-bsl-run_files test_array ] [ test-bsl-run_files test_binary ] @@ -221,7 +92,7 @@ test-suite "serialization" : [ test-bsl-run_polymorphic_archive test_polymorphic : test_polymorphic_A ] ; -if $(BOOST_SERIALIZATION_TEST) { +if ! $(BOOST_ARCHIVE_LIST) { test-suite "serialization2" : [ test-bsl-run test_private_ctor ] [ test-bsl-run test_reset_object_address ] diff --git a/test/binary_archive.hpp b/test/binary_archive.hpp index 3569bcf3..b4dc63ea 100644 --- a/test/binary_archive.hpp +++ b/test/binary_archive.hpp @@ -15,8 +15,10 @@ #include typedef boost::archive::binary_oarchive test_oarchive; typedef std::ofstream test_ostream; + #include typedef boost::archive::binary_iarchive test_iarchive; typedef std::ifstream test_istream; -#define TEST_STREAM_FLAGS std::ios::binary +//#define TEST_STREAM_FLAGS (std::ios::binary | std::ios::in | std::ios::out) +#define TEST_STREAM_FLAGS (std::ios::binary) diff --git a/test/polymorphic_text_archive.hpp b/test/polymorphic_text_archive.hpp index c8184b15..adf2e00d 100644 --- a/test/polymorphic_text_archive.hpp +++ b/test/polymorphic_text_archive.hpp @@ -10,4 +10,3 @@ typedef std::ofstream test_ostream; #include typedef boost::archive::polymorphic_text_iarchive test_iarchive; typedef std::ifstream test_istream; -#define TEST_STREAM_FLAGS (std::ios_base::openmode)0 diff --git a/test/polymorphic_text_warchive.hpp b/test/polymorphic_text_warchive.hpp index 1e1aff1c..3d9473a6 100644 --- a/test/polymorphic_text_warchive.hpp +++ b/test/polymorphic_text_warchive.hpp @@ -14,5 +14,4 @@ typedef std::wofstream test_ostream; #include typedef boost::archive::polymorphic_text_wiarchive test_iarchive; typedef std::wifstream test_istream; -#define TEST_STREAM_FLAGS (std::ios_base::openmode)0 #endif \ No newline at end of file diff --git a/test/polymorphic_xml_archive.hpp b/test/polymorphic_xml_archive.hpp index 849d1a02..163cb101 100644 --- a/test/polymorphic_xml_archive.hpp +++ b/test/polymorphic_xml_archive.hpp @@ -10,4 +10,3 @@ typedef std::ofstream test_ostream; #include typedef boost::archive::polymorphic_xml_iarchive test_iarchive; typedef std::ifstream test_istream; -#define TEST_STREAM_FLAGS (std::ios_base::openmode)0 diff --git a/test/polymorphic_xml_warchive.hpp b/test/polymorphic_xml_warchive.hpp index 1f5c5ff0..581ec163 100644 --- a/test/polymorphic_xml_warchive.hpp +++ b/test/polymorphic_xml_warchive.hpp @@ -10,4 +10,3 @@ typedef std::wofstream test_ostream; #include typedef boost::archive::polymorphic_xml_wiarchive test_iarchive; typedef std::wifstream test_istream; -#define TEST_STREAM_FLAGS (std::ios_base::openmode)0 diff --git a/test/portable_binary_archive.hpp b/test/portable_binary_archive.hpp index c1377c92..ce913316 100644 --- a/test/portable_binary_archive.hpp +++ b/test/portable_binary_archive.hpp @@ -3,9 +3,12 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// See http://www.boost.org for updates, documentation, and revision history.// file includes for testing a custom archive. +// See http://www.boost.org for updates, documentation, and revision history. +// file includes for testing a custom archive. // as an example this tests the portable binary archive +#include + // #include output archive header #include "../example/portable_binary_oarchive.hpp" // define output archive class to be used @@ -18,5 +21,11 @@ typedef std::ofstream test_ostream; typedef portable_binary_iarchive test_iarchive; typedef std::ifstream test_istream; +// since this archive class isn't compiled into the +// boost serialization library, include this here +// so that things get instantiated +#include "../example/portable_binary_oarchive.cpp" +#include "../example/portable_binary_iarchive.cpp" + // and stream open flags #define TEST_STREAM_FLAGS std::ios::binary diff --git a/test/test_array.cpp b/test/test_array.cpp index b836ce2a..9335169a 100644 --- a/test/test_array.cpp +++ b/test/test_array.cpp @@ -18,8 +18,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -61,13 +59,13 @@ int test_array(T) const T a_array[10]={T(),T(),T(),T(),T(),T(),T(),T(),T(),T()}; { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("a_array", a_array); } { T a_array1[10]; test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("a_array", a_array1); array_equal_to/**/ Compare; @@ -77,7 +75,7 @@ int test_array(T) T a_array1[9]; test_istream is(testfile, TEST_STREAM_FLAGS); BOOST_TRY { - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); bool exception_invoked = false; BOOST_TRY { ia >> boost::serialization::make_nvp("a_array", a_array1); diff --git a/test/test_binary.cpp b/test/test_binary.cpp index e78459cb..4637ff31 100644 --- a/test/test_binary.cpp +++ b/test/test_binary.cpp @@ -21,8 +21,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -71,7 +69,7 @@ int test_main( int /* argc */, char* /* argv */[] ) int i1 = 34790; { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(a); // note: add a little bit on the end of the archive to detect // failure of text mode binary. @@ -79,7 +77,7 @@ int test_main( int /* argc */, char* /* argv */[] ) } { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> BOOST_SERIALIZATION_NVP(a1); ia >> BOOST_SERIALIZATION_NVP(i1); } diff --git a/test/test_class_info_load.cpp b/test/test_class_info_load.cpp index b7bf30ed..af153294 100644 --- a/test/test_class_info_load.cpp +++ b/test/test_class_info_load.cpp @@ -15,8 +15,6 @@ #include #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -65,7 +63,7 @@ BOOST_CLASS_VERSION(B, 4) void in(const char *testfile, A & a, B & b) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> BOOST_SERIALIZATION_NVP(a); ia >> BOOST_SERIALIZATION_NVP(a); BOOST_CHECK(a.count == 2); // no tracking => redundant loads diff --git a/test/test_class_info_save.cpp b/test/test_class_info_save.cpp index 6bfe312d..2ac9b144 100644 --- a/test/test_class_info_save.cpp +++ b/test/test_class_info_save.cpp @@ -16,8 +16,6 @@ #include #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -69,7 +67,7 @@ BOOST_CLASS_TRACKING(B, boost::serialization::track_always) void out(const char *testfile, const A & a, const B & b) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); // write object twice to check tracking oa << BOOST_SERIALIZATION_NVP(a); oa << BOOST_SERIALIZATION_NVP(a); diff --git a/test/test_contained_class.cpp b/test/test_contained_class.cpp index 7fe4b4db..b04ccccb 100644 --- a/test/test_contained_class.cpp +++ b/test/test_contained_class.cpp @@ -19,8 +19,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include "B.hpp" @@ -53,12 +51,12 @@ int test_main( int /* argc */, char* /* argv */[] ) C c1; { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("c", c); } { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("c", c1); } BOOST_CHECK(c == c1); diff --git a/test/test_cyclic_ptrs.cpp b/test/test_cyclic_ptrs.cpp index 49375ce4..5e3cb711 100644 --- a/test/test_cyclic_ptrs.cpp +++ b/test/test_cyclic_ptrs.cpp @@ -20,8 +20,6 @@ namespace std{ #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -115,7 +113,7 @@ int test_main( int /* argc */, char* /* argv */[] ) ); { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); BOOST_TRY { oa << BOOST_SERIALIZATION_NVP(k); } @@ -131,7 +129,7 @@ int test_main( int /* argc */, char* /* argv */[] ) if(exception.code == boost::archive::archive_exception::no_exception){ // try to read the archive test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); exception = boost::archive::archive_exception( boost::archive::archive_exception::no_exception ); diff --git a/test/test_delete_pointer.cpp b/test/test_delete_pointer.cpp index a2f384cc..dccabbe1 100644 --- a/test/test_delete_pointer.cpp +++ b/test/test_delete_pointer.cpp @@ -18,8 +18,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -96,7 +94,7 @@ test_main( int /* argc */, char* /* argv */[] ) //output the vector { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(vec); } @@ -108,7 +106,7 @@ test_main( int /* argc */, char* /* argv */[] ) //read the vector back { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); BOOST_TRY { ia >> BOOST_SERIALIZATION_NVP(vec); } diff --git a/test/test_demo.cpp b/test/test_demo.cpp index 08fac6fa..a3db770d 100644 --- a/test/test_demo.cpp +++ b/test/test_demo.cpp @@ -6,8 +6,3 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include - -#define main test_main - -#include "../example/demo.cpp" diff --git a/test/test_demo_auto_ptr.cpp b/test/test_demo_auto_ptr.cpp index a4672584..0245efce 100644 --- a/test/test_demo_auto_ptr.cpp +++ b/test/test_demo_auto_ptr.cpp @@ -6,8 +6,3 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include - -#define main test_main - -#include "../example/demo_auto_ptr.cpp" diff --git a/test/test_demo_exception.cpp b/test/test_demo_exception.cpp index 08fac6fa..a3db770d 100644 --- a/test/test_demo_exception.cpp +++ b/test/test_demo_exception.cpp @@ -6,8 +6,3 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include - -#define main test_main - -#include "../example/demo.cpp" diff --git a/test/test_demo_fast_archive.cpp b/test/test_demo_fast_archive.cpp index 7fa0b408..83bfe6be 100644 --- a/test/test_demo_fast_archive.cpp +++ b/test/test_demo_fast_archive.cpp @@ -6,8 +6,3 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include - -#define main test_main - -#include "../example/demo_fast_archive.cpp" diff --git a/test/test_demo_pimpl.cpp b/test/test_demo_pimpl.cpp index e3ea93c0..e4bf6557 100644 --- a/test/test_demo_pimpl.cpp +++ b/test/test_demo_pimpl.cpp @@ -6,8 +6,3 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include - -#define main test_main - -#include "../example/demo_pimpl.cpp" diff --git a/test/test_demo_polymorphic.cpp b/test/test_demo_polymorphic.cpp index 22946b8e..99c100ca 100644 --- a/test/test_demo_polymorphic.cpp +++ b/test/test_demo_polymorphic.cpp @@ -6,8 +6,3 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include - -#define main test_main - -#include "../example/demo_polymorphic.cpp" diff --git a/test/test_demo_portable_archive.cpp b/test/test_demo_portable_archive.cpp index 2cde280a..17fefb81 100644 --- a/test/test_demo_portable_archive.cpp +++ b/test/test_demo_portable_archive.cpp @@ -6,8 +6,3 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include - -#define main test_main - -#include "../example/demo_portable_archive.cpp" diff --git a/test/test_demo_shared_ptr.cpp b/test/test_demo_shared_ptr.cpp index 08fac6fa..a3db770d 100644 --- a/test/test_demo_shared_ptr.cpp +++ b/test/test_demo_shared_ptr.cpp @@ -6,8 +6,3 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include - -#define main test_main - -#include "../example/demo.cpp" diff --git a/test/test_demo_xml.cpp b/test/test_demo_xml.cpp index bad1d1fa..61862964 100644 --- a/test/test_demo_xml.cpp +++ b/test/test_demo_xml.cpp @@ -6,8 +6,3 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include - -#define main test_main - -#include "../example/demo_xml.cpp" diff --git a/test/test_demo_xml_load.cpp b/test/test_demo_xml_load.cpp index 7ab23092..a3db770d 100644 --- a/test/test_demo_xml_load.cpp +++ b/test/test_demo_xml_load.cpp @@ -6,8 +6,3 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include - -#define main test_main - -#include "../example/demo_xml_load.cpp" diff --git a/test/test_demo_xml_save.cpp b/test/test_demo_xml_save.cpp index 36da0452..a3db770d 100644 --- a/test/test_demo_xml_save.cpp +++ b/test/test_demo_xml_save.cpp @@ -6,8 +6,3 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include - -#define main test_main - -#include "../example/demo_xml_save.cpp" diff --git a/test/test_deque.cpp b/test/test_deque.cpp index b2bbd578..953d7015 100644 --- a/test/test_deque.cpp +++ b/test/test_deque.cpp @@ -20,8 +20,6 @@ namespace std{ #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include "A.hpp" @@ -35,12 +33,12 @@ int test_main( int /* argc */, char* /* argv */[] ) std::deque adeque, adeque1; { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("adeque",adeque); } { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("adeque",adeque1); } BOOST_CHECK(adeque == adeque1); diff --git a/test/test_derived.cpp b/test/test_derived.cpp index 7ec56342..212a16a7 100644 --- a/test/test_derived.cpp +++ b/test/test_derived.cpp @@ -20,10 +20,9 @@ namespace std{ #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include +#include class base { @@ -55,7 +54,7 @@ class derived2 : public base void save_derived(const char *testfile) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); // registration not necessary when serializing the most derived pointer derived1 *d1 = new derived1; @@ -71,14 +70,14 @@ void save_derived(const char *testfile) // type id for non-polymorphic types const boost::serialization::extended_type_info & this_type = * boost::serialization::type_info_implementation::type - ::get_instance(); + ::find(); // retrieve the true type of the object pointed to const boost::serialization::extended_type_info & true_type = * boost::serialization::type_info_implementation::type ::get_derived_extended_type_info(*b1); BOOST_WARN_MESSAGE( - (this_type != true_type), + !(this_type == true_type), "current type id system does not support non-polymorphic types" ); @@ -93,7 +92,7 @@ void save_derived(const char *testfile) void load_derived(const char *testfile) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); // registration not necessary when serializing the most derived pointer derived1 *d1 = NULL; @@ -109,14 +108,14 @@ void load_derived(const char *testfile) // type id for non-polymorphic types const boost::serialization::extended_type_info & this_type = * boost::serialization::type_info_implementation::type - ::get_instance(); + ::find(); // retrieve the true type of the object pointed to const boost::serialization::extended_type_info & true_type = * boost::serialization::type_info_implementation::type ::get_derived_extended_type_info(*b1); BOOST_WARN_MESSAGE( - this_type != true_type, + ! (this_type == true_type), "current type id system does fails for non-polymorphic types" ); diff --git a/test/test_derived_class.cpp b/test/test_derived_class.cpp index e3718899..59dae105 100644 --- a/test/test_derived_class.cpp +++ b/test/test_derived_class.cpp @@ -19,8 +19,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include "B.hpp" @@ -34,12 +32,12 @@ int test_main( int argc, char* argv[] ) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("b", b); } { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("b1", b1); } BOOST_CHECK(b == b1); diff --git a/test/test_derived_class_ptr.cpp b/test/test_derived_class_ptr.cpp index 889901f2..90528b58 100644 --- a/test/test_derived_class_ptr.cpp +++ b/test/test_derived_class_ptr.cpp @@ -19,8 +19,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include "B.hpp" @@ -34,12 +32,12 @@ int test_main( int /* argc */, char* /* argv */[] ) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("tb", tb); } { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("tb",tb1); } BOOST_CHECK(tb != tb1); diff --git a/test/test_diamond.cpp b/test/test_diamond.cpp index 6fd9c091..ca92ef8f 100644 --- a/test/test_diamond.cpp +++ b/test/test_diamond.cpp @@ -20,8 +20,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include diff --git a/test/test_exported.cpp b/test/test_exported.cpp index f892bc29..d23ba481 100644 --- a/test/test_exported.cpp +++ b/test/test_exported.cpp @@ -20,11 +20,10 @@ namespace std{ #include #include +#include #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) class polymorphic_base { @@ -74,7 +73,7 @@ BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derive void save_exported(const char *testfile) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); polymorphic_base *rb1 = new polymorphic_derived1; polymorphic_base *rb2 = new polymorphic_derived2; @@ -92,7 +91,7 @@ void save_exported(const char *testfile) void load_exported(const char *testfile) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); polymorphic_base *rb1 = NULL; polymorphic_base *rb2 = NULL; @@ -102,7 +101,7 @@ void load_exported(const char *testfile) ia >> BOOST_SERIALIZATION_NVP(rb1); BOOST_CHECK_MESSAGE( boost::serialization::type_info_implementation - ::type::get_instance() + ::type::find() == boost::serialization::type_info_implementation ::type::get_derived_extended_type_info(*rb1), "restored pointer b1 not of correct type" @@ -111,7 +110,7 @@ void load_exported(const char *testfile) ia >> BOOST_SERIALIZATION_NVP(rb2); BOOST_CHECK_MESSAGE( boost::serialization::type_info_implementation - ::type::get_instance() + ::type::find() == boost::serialization::type_info_implementation ::type::get_derived_extended_type_info(*rb2), "restored pointer b2 not of correct type" diff --git a/test/test_list.cpp b/test/test_list.cpp index 4e642d34..93f87145 100644 --- a/test/test_list.cpp +++ b/test/test_list.cpp @@ -20,8 +20,6 @@ namespace std{ #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #ifdef BOOST_HAS_SLIST @@ -40,14 +38,14 @@ int test_main( int /* argc */, char* /* argv */[] ) alist.push_back(A()); { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("alist",alist); } std::list alist1; { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("alist",alist1); } BOOST_CHECK(alist == alist1); @@ -58,12 +56,12 @@ int test_main( int /* argc */, char* /* argv */[] ) aslist.push_front(A()); { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("aslist", aslist); } BOOST_STD_EXTENSION_NAMESPACE::slist aslist1;{ test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("aslist", aslist1); } BOOST_CHECK(aslist == aslist1); diff --git a/test/test_list_ptrs.cpp b/test/test_list_ptrs.cpp index 65210a6e..7170e8bc 100644 --- a/test/test_list_ptrs.cpp +++ b/test/test_list_ptrs.cpp @@ -24,8 +24,6 @@ namespace std{ #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #ifdef BOOST_HAS_SLIST @@ -57,7 +55,7 @@ int test_main( int /* argc */, char* /* argv */[] ) std::list alist; { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); A * free_a_ptr = new A; alist.push_back(free_a_ptr); alist.push_back(new A); @@ -69,7 +67,7 @@ int test_main( int /* argc */, char* /* argv */[] ) std::list alist1; { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); A * free_a_ptr1; ia >> boost::serialization::make_nvp("alist", alist1); ia >> boost::serialization::make_nvp("free_a_ptr", free_a_ptr1); @@ -98,7 +96,7 @@ int test_main( int /* argc */, char* /* argv */[] ) aslist.push_back(new A); aslist.push_back(new A); test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); aslist.push_back(new A); aslist.push_back(new A); oa << boost::serialization::make_nvp("aslist", aslist); @@ -106,7 +104,7 @@ int test_main( int /* argc */, char* /* argv */[] ) std::list aslist1; { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("aslist", aslist1); BOOST_CHECK(aslist.size() == aslist1.size() && std::equal(aslist.begin(),aslist.end(),aslist1.begin(),ptr_equal_to()) diff --git a/test/test_map.cpp b/test/test_map.cpp index d47156c9..8afa5847 100644 --- a/test/test_map.cpp +++ b/test/test_map.cpp @@ -25,8 +25,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -72,13 +70,13 @@ test_map(){ amap.insert(std::make_pair(random_key(), A())); { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("amap", amap); } std::map amap1; { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("amap", amap1); } BOOST_CHECK(amap == amap1); @@ -100,7 +98,7 @@ test_map_2(){ test_ostream os(testfile, TEST_STREAM_FLAGS); std::pair * const pa = &a; std::map * const pb = &b; - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(pb); oa << BOOST_SERIALIZATION_NVP(pa); } @@ -108,7 +106,7 @@ test_map_2(){ test_istream is(testfile, TEST_STREAM_FLAGS); std::pair *pa = 0; std::map *pb = 0; - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> BOOST_SERIALIZATION_NVP(pb); ia >> BOOST_SERIALIZATION_NVP(pa); delete pa; @@ -128,13 +126,13 @@ test_multimap(){ amultimap.insert(std::make_pair(random_key(), A())); { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("amultimap", amultimap); } std::multimap amultimap1; { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("amultimap", amultimap1); } BOOST_CHECK(amultimap == amultimap1); @@ -165,13 +163,13 @@ test_hash_map(){ ahash_map.insert(std::make_pair(random_key(), A())); { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("ahashmap",ahash_map); } BOOST_STD_EXTENSION_NAMESPACE::hash_map ahash_map1; { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("ahashmap",ahash_map1); } @@ -204,13 +202,13 @@ test_hash_multimap(){ ahash_multimap.insert(std::make_pair(random_key(), A())); { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("ahash_multimap", ahash_multimap); } BOOST_STD_EXTENSION_NAMESPACE::hash_multimap ahash_multimap1; { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("ahash_multimap", ahash_multimap1); } #if ! defined(__SGI_STL_PORT) || (__SGI_STL_PORT < 0x500) diff --git a/test/test_mi.cpp b/test/test_mi.cpp index 72b9de94..ec4ca9f2 100644 --- a/test/test_mi.cpp +++ b/test/test_mi.cpp @@ -21,8 +21,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include diff --git a/test/test_mult_archive_types.cpp b/test/test_mult_archive_types.cpp index 45318e5f..29391257 100644 --- a/test/test_mult_archive_types.cpp +++ b/test/test_mult_archive_types.cpp @@ -21,8 +21,6 @@ namespace std{ #include #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include diff --git a/test/test_multiple_ptrs.cpp b/test/test_multiple_ptrs.cpp index c07c1abb..0ef74f26 100644 --- a/test/test_multiple_ptrs.cpp +++ b/test/test_multiple_ptrs.cpp @@ -19,8 +19,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include "D.hpp" @@ -34,12 +32,12 @@ int test_main( int /* argc */, char* /* argv */[] ) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("a", a); } { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("a", a1); } BOOST_CHECK(a == a1); diff --git a/test/test_no_rtti.cpp b/test/test_no_rtti.cpp index 4eef02de..f1591779 100644 --- a/test/test_no_rtti.cpp +++ b/test/test_no_rtti.cpp @@ -29,8 +29,6 @@ namespace std{ #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -77,7 +75,7 @@ BOOST_CLASS_EXPORT(polymorphic_derived1) const char * polymorphic_derived1::get_key() const { const boost::serialization::extended_type_info *eti = boost::serialization::type_info_implementation - ::type::get_instance(); + ::type::find(); return eti->get_key(); } @@ -104,7 +102,7 @@ const char * polymorphic_derived2::get_key() const { // use the exported key as the identifier const boost::serialization::extended_type_info *eti = boost::serialization::type_info_implementation - ::type::get_instance(); + ::type::find(); return eti->get_key(); } @@ -112,7 +110,7 @@ const char * polymorphic_derived2::get_key() const { void save_derived(const char *testfile) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); polymorphic_derived1 *rd1 = new polymorphic_derived1; polymorphic_derived2 *rd2 = new polymorphic_derived2; @@ -136,7 +134,7 @@ void save_derived(const char *testfile) void load_derived(const char *testfile) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); polymorphic_derived1 *rd1 = NULL; polymorphic_derived2 *rd2 = NULL; @@ -145,7 +143,7 @@ void load_derived(const char *testfile) BOOST_CHECK_MESSAGE( boost::serialization::type_info_implementation - ::type::get_instance() + ::type::find() == boost::serialization::type_info_implementation ::type::get_derived_extended_type_info(*rd1), "restored pointer d1 not of correct type" @@ -155,7 +153,7 @@ void load_derived(const char *testfile) BOOST_CHECK_MESSAGE( boost::serialization::type_info_implementation - ::type::get_instance() + ::type::find() == boost::serialization::type_info_implementation ::type::get_derived_extended_type_info(*rd2), "restored pointer d2 not of correct type" @@ -176,7 +174,7 @@ void load_derived(const char *testfile) BOOST_CHECK_MESSAGE( boost::serialization::type_info_implementation - ::type::get_instance() + ::type::find() == boost::serialization::type_info_implementation ::type::get_derived_extended_type_info(*rb1), "restored pointer b1 not of correct type" @@ -191,7 +189,7 @@ void load_derived(const char *testfile) BOOST_CHECK_MESSAGE( boost::serialization::type_info_implementation - ::type::get_instance() + ::type::find() == boost::serialization::type_info_implementation ::type::get_derived_extended_type_info(*rb2), "restored pointer b2 not of correct type" diff --git a/test/test_non_default_ctor.cpp b/test/test_non_default_ctor.cpp index 255bd04f..e1347207 100644 --- a/test/test_non_default_ctor.cpp +++ b/test/test_non_default_ctor.cpp @@ -28,8 +28,6 @@ namespace std{ #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) /////////////////////////////////////////////////////// // simple class test - using non-intrusive syntax @@ -145,7 +143,7 @@ inline void load_construct_data( void save(const char * testfile){ test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); A a(2); oa << BOOST_SERIALIZATION_NVP(a); @@ -162,7 +160,7 @@ void save(const char * testfile){ } void load(const char * testfile){ test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); A a(4); ia >> BOOST_SERIALIZATION_NVP(a); diff --git a/test/test_non_default_ctor2.cpp b/test/test_non_default_ctor2.cpp index c1103200..d2c90b2d 100644 --- a/test/test_non_default_ctor2.cpp +++ b/test/test_non_default_ctor2.cpp @@ -16,8 +16,6 @@ #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) class IntValueHolder { @@ -123,7 +121,7 @@ int test_main( int /* argc */, char* /* argv */[] ) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(a); } @@ -131,7 +129,7 @@ int test_main( int /* argc */, char* /* argv */[] ) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> BOOST_SERIALIZATION_NVP(a_new); } delete a; diff --git a/test/test_non_intrusive.cpp b/test/test_non_intrusive.cpp index 06ef9396..ca90890f 100644 --- a/test/test_non_intrusive.cpp +++ b/test/test_non_intrusive.cpp @@ -28,8 +28,6 @@ namespace std{ #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) /////////////////////////////////////////////////////// // simple class test - using non-intrusive syntax @@ -124,7 +122,7 @@ void serialize( void save(const char * testfile){ test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); A a; oa << BOOST_SERIALIZATION_NVP(a); @@ -142,7 +140,7 @@ void save(const char * testfile){ void load(const char * testfile){ test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); A a; ia >> BOOST_SERIALIZATION_NVP(a); diff --git a/test/test_not_serializable.cpp b/test/test_not_serializable.cpp index 31983849..4833512d 100644 --- a/test/test_not_serializable.cpp +++ b/test/test_not_serializable.cpp @@ -12,8 +12,6 @@ #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -26,14 +24,14 @@ BOOST_CLASS_IMPLEMENTATION(A, boost::serialization::not_serializable) void out(A & a) { test_ostream os("testfile", TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(a); } void in(A & a) { test_istream is("testfile", TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> BOOST_SERIALIZATION_NVP(a); } diff --git a/test/test_null_ptr.cpp b/test/test_null_ptr.cpp index 29aee9ba..511d0ecd 100644 --- a/test/test_null_ptr.cpp +++ b/test/test_null_ptr.cpp @@ -19,8 +19,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include class polymorphic_base @@ -46,7 +44,7 @@ class polymorphic_derived1 : public polymorphic_base void save(const char *testfile) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); polymorphic_base *rb1 = NULL; polymorphic_derived1 *rd1 = NULL; @@ -59,7 +57,7 @@ void save(const char *testfile) void load(const char *testfile) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); polymorphic_base *rb1 = (polymorphic_base *)0xfffffff; polymorphic_derived1 *rd1 = (polymorphic_derived1 *)0xffffffff; diff --git a/test/test_nvp.cpp b/test/test_nvp.cpp index 03b36afe..1a4ec130 100644 --- a/test/test_nvp.cpp +++ b/test/test_nvp.cpp @@ -19,8 +19,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include @@ -35,12 +33,12 @@ int test_main( int argc, char* argv[] ) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(b); } { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> BOOST_SERIALIZATION_NVP(b1); } BOOST_CHECK(b == b1); @@ -50,12 +48,12 @@ int test_main( int argc, char* argv[] ) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(bptr); } { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> BOOST_SERIALIZATION_NVP(bptr1); } BOOST_CHECK(b == *bptr1); diff --git a/test/test_object.cpp b/test/test_object.cpp index 352e359d..512d5ad5 100644 --- a/test/test_object.cpp +++ b/test/test_object.cpp @@ -20,8 +20,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -44,14 +42,14 @@ BOOST_CLASS_IMPLEMENTATION(A, boost::serialization::object_serializable) void out(const char *testfile, A & a) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(a); } void in(const char *testfile, A & a) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> BOOST_SERIALIZATION_NVP(a); } diff --git a/test/test_optional.cpp b/test/test_optional.cpp index 8eb2c662..efa6f46a 100644 --- a/test/test_optional.cpp +++ b/test/test_optional.cpp @@ -21,8 +21,6 @@ namespace std{ #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include @@ -37,7 +35,7 @@ int test_main( int /* argc */, char* /* argv */[] ) const boost::optional aoptional2(123); { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("aoptional1",aoptional1); oa << boost::serialization::make_nvp("aoptional2",aoptional2); } @@ -47,7 +45,7 @@ int test_main( int /* argc */, char* /* argv */[] ) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("aoptional1",aoptional1a); ia >> boost::serialization::make_nvp("aoptional2",aoptional2a); } diff --git a/test/test_pimpl.cpp b/test/test_pimpl.cpp index 6279be3a..7b4b1962 100644 --- a/test/test_pimpl.cpp +++ b/test/test_pimpl.cpp @@ -14,8 +14,6 @@ #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) class B; diff --git a/test/test_polymorphic.cpp b/test/test_polymorphic.cpp index fdc0267c..0dfb5c69 100644 --- a/test/test_polymorphic.cpp +++ b/test/test_polymorphic.cpp @@ -18,12 +18,6 @@ namespace std{ } #endif -#include "test_tools.hpp" - -#if !defined(BOOST_ARCHIVE_TEST) -#define BOOST_ARCHIVE_TEST polymorphic_text_archive.hpp -#endif - // the following is to ensure that when one of the libraries changes // BJAM rebuilds and relinks the test. /* @@ -32,10 +26,11 @@ namespace std{ #include "polymorphic_binary_archive.hpp" #include "polymorphic_xml_archive.hpp" #include "polymorphic_xml_warchive.hpp" +#include "polymorphic_portable_le_binary_archive.hpp" +#include "polymorphic_portable_be_binary_archive.hpp" */ -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) +#include "test_tools.hpp" #include #include @@ -52,13 +47,13 @@ int test_main(int /* argc */, char * /* argv */ []) // test using using polymorphic interface { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa_implementation(os); + test_oarchive oa_implementation(os, TEST_ARCHIVE_FLAGS); boost::archive::polymorphic_oarchive & oa_interface = oa_implementation; oa_interface << BOOST_SERIALIZATION_NVP(d); } { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia_implementation(is); + test_iarchive ia_implementation(is, TEST_ARCHIVE_FLAGS); boost::archive::polymorphic_iarchive & ia_interface = ia_implementation; ia_interface >> BOOST_SERIALIZATION_NVP(d1); } @@ -68,12 +63,12 @@ int test_main(int /* argc */, char * /* argv */ []) // test using using polymorphic implementation. { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa_implementation(os); + test_oarchive oa_implementation(os, TEST_ARCHIVE_FLAGS); oa_implementation << BOOST_SERIALIZATION_NVP(d); } { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia_implementation(is); + test_iarchive ia_implementation(is, TEST_ARCHIVE_FLAGS); ia_implementation >> BOOST_SERIALIZATION_NVP(d1); } BOOST_CHECK(d == d1); @@ -83,14 +78,14 @@ int test_main(int /* argc */, char * /* argv */ []) { test_ostream os(testfile, TEST_STREAM_FLAGS); boost::archive::polymorphic_oarchive * oa_implementation - = new test_oarchive(os); + = new test_oarchive(os, TEST_ARCHIVE_FLAGS); *oa_implementation << BOOST_SERIALIZATION_NVP(d); delete oa_implementation; } { test_istream is(testfile, TEST_STREAM_FLAGS); boost::archive::polymorphic_iarchive * ia_implementation - = new test_iarchive(is); + = new test_iarchive(is, TEST_ARCHIVE_FLAGS); *ia_implementation >> BOOST_SERIALIZATION_NVP(d1); delete ia_implementation; } diff --git a/test/test_primitive.cpp b/test/test_primitive.cpp index 846e80dd..f65a231b 100644 --- a/test/test_primitive.cpp +++ b/test/test_primitive.cpp @@ -11,8 +11,6 @@ #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -39,14 +37,14 @@ BOOST_CLASS_IMPLEMENTATION(A, boost::serialization::primitive_type) void out(const char *testfile, A & a) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(a); } void in(const char *testfile, A & a) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> BOOST_SERIALIZATION_NVP(a); } diff --git a/test/test_recursion.cpp b/test/test_recursion.cpp index 40d497f9..4a0bfb93 100644 --- a/test/test_recursion.cpp +++ b/test/test_recursion.cpp @@ -19,8 +19,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include "J.hpp" @@ -35,12 +33,12 @@ int test_main( int /* argc */, char* /* argv */[] ) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(j); } { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> BOOST_SERIALIZATION_NVP(j1); } BOOST_CHECK(j == j1); diff --git a/test/test_registered.cpp b/test/test_registered.cpp index 845d926e..d4b8a47a 100644 --- a/test/test_registered.cpp +++ b/test/test_registered.cpp @@ -20,8 +20,6 @@ namespace std{ #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -58,7 +56,7 @@ class polymorphic_derived2 : public polymorphic_base void save_derived(const char *testfile) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); polymorphic_derived1 *rd1 = new polymorphic_derived1; polymorphic_derived2 *rd2 = new polymorphic_derived2; @@ -86,7 +84,7 @@ void save_derived(const char *testfile) void load_derived(const char *testfile) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); polymorphic_derived1 *rd1 = NULL; polymorphic_derived2 *rd2 = NULL; @@ -100,7 +98,7 @@ void load_derived(const char *testfile) const boost::serialization::extended_type_info * p1; p1 = boost::serialization::type_info_implementation - ::type::get_instance(); + ::type::find(); BOOST_CHECK(NULL != p1); @@ -116,7 +114,7 @@ void load_derived(const char *testfile) BOOST_CHECK_MESSAGE( boost::serialization::type_info_implementation - ::type::get_instance() + ::type::find() == boost::serialization::type_info_implementation ::type::get_derived_extended_type_info(*rd2), "restored pointer d2 not of correct type" @@ -136,7 +134,7 @@ void load_derived(const char *testfile) ); p1 = boost::serialization::type_info_implementation - ::type::get_instance(); + ::type::find(); BOOST_CHECK(NULL != p1); @@ -156,7 +154,7 @@ void load_derived(const char *testfile) BOOST_CHECK_MESSAGE( boost::serialization::type_info_implementation - ::type::get_instance() + ::type::find() == boost::serialization::type_info_implementation ::type::get_derived_extended_type_info(*rb2), "restored pointer b2 not of correct type" @@ -170,7 +168,7 @@ void load_derived(const char *testfile) void save_registered(const char *testfile) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); polymorphic_base *rb1 = new polymorphic_derived1; polymorphic_base *rb2 = new polymorphic_derived2; @@ -189,7 +187,7 @@ void save_registered(const char *testfile) void load_registered(const char *testfile) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); polymorphic_base *rb1 = NULL; polymorphic_base *rb2 = NULL; @@ -202,7 +200,7 @@ void load_registered(const char *testfile) BOOST_CHECK_MESSAGE( boost::serialization::type_info_implementation - ::type::get_instance() + ::type::find() == boost::serialization::type_info_implementation ::type::get_derived_extended_type_info(*rb1), "restored pointer b1 not of correct type" @@ -210,7 +208,7 @@ void load_registered(const char *testfile) BOOST_CHECK_MESSAGE( boost::serialization::type_info_implementation - ::type::get_instance() + ::type::find() == boost::serialization::type_info_implementation ::type::get_derived_extended_type_info(*rb2), "restored pointer b2 not of correct type" diff --git a/test/test_set.cpp b/test/test_set.cpp index 6ecd8141..39f37bb7 100644 --- a/test/test_set.cpp +++ b/test/test_set.cpp @@ -25,8 +25,6 @@ namespace std{ #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -44,13 +42,13 @@ test_set(){ aset.insert(A()); { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("aset", aset); } std::set aset1; { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("aset", aset1); } BOOST_CHECK(aset == aset1); @@ -67,13 +65,13 @@ test_multiset(){ amultiset.insert(A()); { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("amultiset", amultiset); } std::multiset amultiset1; { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("amultiset", amultiset1); } BOOST_CHECK(amultiset == amultiset1); @@ -105,13 +103,13 @@ test_hash_set(){ ahash_set.insert(a1); { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("ahash_set", ahash_set); } BOOST_STD_EXTENSION_NAMESPACE::hash_set ahash_set1; { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("ahash_set", ahash_set1); } #if ! defined(__SGI_STL_PORT) || (__SGI_STL_PORT < 0x500) @@ -139,13 +137,13 @@ test_hash_multiset(){ ahash_multiset.insert(A()); { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("ahash_multiset", ahash_multiset); } BOOST_STD_EXTENSION_NAMESPACE::hash_multiset ahash_multiset1; { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("ahash_multiset", ahash_multiset1); } diff --git a/test/test_shared_ptr.cpp b/test/test_shared_ptr.cpp index c92a9cba..82b87cd0 100644 --- a/test/test_shared_ptr.cpp +++ b/test/test_shared_ptr.cpp @@ -24,8 +24,6 @@ namespace std{ #include #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include @@ -77,14 +75,14 @@ int A::count = 0; void save(const char * testfile, const boost::shared_ptr& spa) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(spa); } void load(const char * testfile, boost::shared_ptr& spa) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> BOOST_SERIALIZATION_NVP(spa); } @@ -110,7 +108,7 @@ void save2( const boost::shared_ptr& second ){ test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(first); oa << BOOST_SERIALIZATION_NVP(second); } @@ -121,7 +119,7 @@ void load2( boost::shared_ptr& second) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> BOOST_SERIALIZATION_NVP(first); ia >> BOOST_SERIALIZATION_NVP(second); } @@ -153,7 +151,7 @@ void save3( boost::weak_ptr& third ){ test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(third); oa << BOOST_SERIALIZATION_NVP(first); oa << BOOST_SERIALIZATION_NVP(second); @@ -166,7 +164,7 @@ void load3( boost::weak_ptr& third ){ test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); // note that we serialize the weak pointer first ia >> BOOST_SERIALIZATION_NVP(third); // inorder to test that a temporarily solitary weak pointer diff --git a/test/test_shared_ptr_132.cpp b/test/test_shared_ptr_132.cpp index 99b91bb1..c5a28eaa 100644 --- a/test/test_shared_ptr_132.cpp +++ b/test/test_shared_ptr_132.cpp @@ -19,8 +19,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -93,7 +91,7 @@ template void save(const char * testfile, const T & spa) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(spa); } @@ -101,7 +99,7 @@ template void load(const char * testfile, T & spa) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> BOOST_SERIALIZATION_NVP(spa); } @@ -133,7 +131,7 @@ void save2( const T & second ){ test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(first); oa << BOOST_SERIALIZATION_NVP(second); } @@ -145,7 +143,7 @@ void load2( T & second) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> BOOST_SERIALIZATION_NVP(first); ia >> BOOST_SERIALIZATION_NVP(second); } @@ -180,7 +178,7 @@ void save3( const T & third ){ test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(third); oa << BOOST_SERIALIZATION_NVP(first); oa << BOOST_SERIALIZATION_NVP(second); @@ -194,7 +192,7 @@ void load3( T & third ){ test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); // note that we serialize the weak pointer first ia >> BOOST_SERIALIZATION_NVP(third); // inorder to test that a temporarily solitary weak pointer diff --git a/test/test_simple_class.cpp b/test/test_simple_class.cpp index e87ca0ff..be6dbd04 100644 --- a/test/test_simple_class.cpp +++ b/test/test_simple_class.cpp @@ -22,8 +22,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include "A.hpp" @@ -37,12 +35,12 @@ test_main( int /* argc */, char* /* argv */[] ) A a, a1; { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("a", a); } { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("a", a1); } BOOST_CHECK_EQUAL(a, a1); diff --git a/test/test_simple_class_ptr.cpp b/test/test_simple_class_ptr.cpp index 5438817d..aeb62bd7 100644 --- a/test/test_simple_class_ptr.cpp +++ b/test/test_simple_class_ptr.cpp @@ -19,8 +19,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include "A.hpp" @@ -35,12 +33,12 @@ int test_main( int /* argc */, char* /* argv */[] ) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("ta", ta); } { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("ta", ta1); } BOOST_CHECK(ta != ta1); diff --git a/test/test_split.cpp b/test/test_split.cpp index 63908373..9bdcedd3 100644 --- a/test/test_split.cpp +++ b/test/test_split.cpp @@ -19,8 +19,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -132,7 +130,7 @@ BOOST_SERIALIZATION_SPLIT_FREE(C) void out(const char *testfile, A & a, B & b, C & c) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(a); oa << BOOST_SERIALIZATION_NVP(b); oa << BOOST_SERIALIZATION_NVP(c); @@ -141,7 +139,7 @@ void out(const char *testfile, A & a, B & b, C & c) void in(const char *testfile, A & a, B & b, C & c) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> BOOST_SERIALIZATION_NVP(a); ia >> BOOST_SERIALIZATION_NVP(b); ia >> BOOST_SERIALIZATION_NVP(c); diff --git a/test/test_tools.hpp b/test/test_tools.hpp index 129ee243..04471be0 100644 --- a/test/test_tools.hpp +++ b/test/test_tools.hpp @@ -16,8 +16,12 @@ // See http://www.boost.org for updates, documentation, and revision history. -#include #include // remove, tmpnam +#ifndef BOOST_NO_EXCEPTION_STD_NAMESPACE + #include +#endif +#include +#include // win32 has a brain-dead tmpnam implementation. // which leaves temp files in root directory @@ -50,6 +54,35 @@ namespace std{ namespace boost { namespace archive { + char * test_filename(char * dir = NULL, char *fname = NULL){ + static char ibuffer [512]; + + if(NULL == dir) + dir = boost::archive::tmpdir(); + + if(NULL == fname){ + char old_dir[256]; + _getcwd(old_dir, sizeof(old_dir) - 1); + chdir(dir); + + std::tmpnam(ibuffer); + chdir(old_dir); + } + else{ + STRCPY(ibuffer, dir); + std::strcat(ibuffer, "/"); + std::strcat(ibuffer, fname); + } + return ibuffer; + } + char * tmpnam(char * buffer){ + char * name = test_filename(NULL, NULL); + if(NULL != buffer){ + STRCPY(buffer, name); + } + return name; + } +#if 0 char * tmpnam(char * buffer){ char old_dir[256]; _getcwd(old_dir, sizeof(old_dir) - 1); @@ -70,6 +103,9 @@ namespace archive { std::strcat(buffer, temp_name); return buffer; } +#endif + + } // archive } // boost @@ -101,12 +137,6 @@ namespace archive { #endif // defined(__hpux) #endif // defined(_WIN32) || defined(__WIN32__) || defined(WIN32) -///////////////////////////////////////////// -// invoke header for a custom archive test. -#if ! defined(BOOST_ARCHIVE_TEST) -#define BOOST_ARCHIVE_TEST text_archive.hpp -#endif - //#include #include @@ -145,7 +175,18 @@ int test_main(int argc, char * argv[]); int main(int argc, char * argv[]){ - test_main(argc, argv); + BOOST_TRY{ + test_main(argc, argv); + } + #ifndef BOOST_NO_EXCEPTION_STD_NAMESPACE + BOOST_CATCH(const std::exception e){ + BOOST_FAIL(e.what()); + } + #endif + BOOST_CATCH(...){ + BOOST_FAIL("failed with uncaught exception:"); + } + BOOST_CATCH_END return boost::report_errors(); } @@ -157,6 +198,39 @@ main(int argc, char * argv[]){ #include "binary_archive.hpp" #include "xml_archive.hpp" #include "xml_warchive.hpp" +#include "portable_le_binary_archive.hpp" +#include "portable_be_binary_archive.hpp" */ +///////////////////////////////////////////// +// invoke header for a custom archive test. + +///////////////////////////////////////////// +// invoke header for a custom archive test. +#if ! defined(BOOST_ARCHIVE_TEST) +#define BOOST_ARCHIVE_TEST text_archive.hpp +#endif + +//#undef BOOST_ARCHIVE_TEST +//#define BOOST_ARCHIVE_TEST portable_le_binary_archive.hpp + +#include +#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) + +#ifndef TEST_STREAM_FLAGS + #define TEST_STREAM_FLAGS (std::ios_base::openmode)0 +#endif + +#ifndef TEST_ARCHIVE_FLAGS + #define TEST_ARCHIVE_FLAGS 0 +#endif + +#ifndef TEST_DIRECTORY +#define TEST_DIRECTORY +#else +#define __x__ TEST_DIRECTORY +#undef TEST_DIRECTORY +#define TEST_DIRECTORY BOOST_PP_STRINGIZE(__x__) +#endif + #endif // BOOST_SERIALIZATION_TEST_TOOLS_HPP diff --git a/test/test_tracking.cpp b/test/test_tracking.cpp index c3692463..75e40560 100644 --- a/test/test_tracking.cpp +++ b/test/test_tracking.cpp @@ -19,8 +19,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include @@ -50,7 +48,7 @@ TEST_CLASS(PAA, ::boost::serialization::track_always) void out(const char *testfile) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); // write object twice to check tracking AN an; AS as; @@ -79,7 +77,7 @@ void out(const char *testfile) void in(const char *testfile) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); // read object twice to check tracking AN an; AS as; diff --git a/test/test_traits_fail.cpp b/test/test_traits_fail.cpp index 707ec790..2e371062 100644 --- a/test/test_traits_fail.cpp +++ b/test/test_traits_fail.cpp @@ -8,8 +8,6 @@ // compile test for traits #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include diff --git a/test/test_traits_pass.cpp b/test/test_traits_pass.cpp index d7498a97..2e650034 100644 --- a/test/test_traits_pass.cpp +++ b/test/test_traits_pass.cpp @@ -8,8 +8,6 @@ // compile test for traits #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include diff --git a/test/test_unregistered.cpp b/test/test_unregistered.cpp index 282683f0..3dd33ccd 100644 --- a/test/test_unregistered.cpp +++ b/test/test_unregistered.cpp @@ -19,11 +19,10 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include #include +#include #include class polymorphic_base @@ -58,7 +57,7 @@ class polymorphic_derived2 : public polymorphic_base void save_unregistered1(const char *testfile) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); polymorphic_base *rb1 = new polymorphic_derived1; @@ -113,7 +112,7 @@ void load_unregistered1(const char *testfile) void save_unregistered2(const char *testfile) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); polymorphic_derived1 *rd1 = new polymorphic_derived1; @@ -139,7 +138,7 @@ void save_unregistered2(const char *testfile) void load_unregistered2(const char *testfile) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); polymorphic_derived1 *rd1 = NULL; @@ -166,7 +165,7 @@ void load_unregistered2(const char *testfile) void save_registered(const char *testfile) { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); polymorphic_base *rb1 = new polymorphic_derived1; polymorphic_base *rb2 = new polymorphic_derived2; @@ -186,7 +185,7 @@ void save_registered(const char *testfile) void load_registered(const char *testfile) { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); polymorphic_base *rb1 = NULL; polymorphic_base *rb2 = NULL; @@ -201,7 +200,7 @@ void load_registered(const char *testfile) BOOST_CHECK_MESSAGE(NULL != rb1, "Load resulted in NULL pointer"); BOOST_CHECK_MESSAGE( boost::serialization::type_info_implementation - ::type::get_instance() + ::type::find() == boost::serialization::type_info_implementation ::type::get_derived_extended_type_info(*rb1), "restored pointer b1 not of correct type" @@ -211,7 +210,7 @@ void load_registered(const char *testfile) BOOST_CHECK_MESSAGE(NULL != rb2, "Load resulted in NULL pointer"); BOOST_CHECK_MESSAGE( boost::serialization::type_info_implementation - ::type::get_instance() + ::type::find() == boost::serialization::type_info_implementation ::type::get_derived_extended_type_info(*rb2), "restored pointer b2 not of correct type" diff --git a/test/test_valarray.cpp b/test/test_valarray.cpp index 87efe6c4..334bdc1f 100644 --- a/test/test_valarray.cpp +++ b/test/test_valarray.cpp @@ -19,8 +19,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include @@ -35,13 +33,13 @@ int test_main( int /* argc */, char* /* argv */[] ) avalarray[1] = -42; { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("avalarray", avalarray); } std::valarray avalarray1; { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("avalarray", avalarray1); } bool equal = ( avalarray.size() == avalarray1.size() diff --git a/test/test_variant.cpp b/test/test_variant.cpp index d87c8a4f..b64857ac 100644 --- a/test/test_variant.cpp +++ b/test/test_variant.cpp @@ -35,8 +35,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include @@ -91,14 +89,14 @@ void test_type(const T& gets_written){ BOOST_REQUIRE(testfile != NULL); { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("written", gets_written); } T got_read; { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("written", got_read); } BOOST_CHECK(boost::apply_visitor(are_equal(), gets_written, got_read)); @@ -125,13 +123,13 @@ void do_bad_read() BOOST_REQUIRE(testfile != NULL); { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << BOOST_SERIALIZATION_NVP(big_variant); } boost::variant little_variant; { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); bool exception_invoked = false; BOOST_TRY { ia >> BOOST_SERIALIZATION_NVP(little_variant); diff --git a/test/test_vector.cpp b/test/test_vector.cpp index faf4d4b3..a1872a64 100644 --- a/test/test_vector.cpp +++ b/test/test_vector.cpp @@ -19,8 +19,6 @@ namespace std{ #endif #include "test_tools.hpp" -#include -#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) #include @@ -38,13 +36,13 @@ int test_vector(T) avector.push_back(T()); { test_ostream os(testfile, TEST_STREAM_FLAGS); - test_oarchive oa(os); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); oa << boost::serialization::make_nvp("avector", avector); } std::vector avector1; { test_istream is(testfile, TEST_STREAM_FLAGS); - test_iarchive ia(is); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); ia >> boost::serialization::make_nvp("avector", avector1); } BOOST_CHECK(avector == avector1); diff --git a/test/test_void_cast.cpp b/test/test_void_cast.cpp index 89309523..4ad88b8a 100644 --- a/test/test_void_cast.cpp +++ b/test/test_void_cast.cpp @@ -48,86 +48,85 @@ test_main( int /* argc */, char* /* argv */[] ) // simple casts only requiring table lookup BOOST_CHECK(vpc == boost::serialization::void_downcast( - * boost::serialization::extended_type_info_typeid::get_instance(), - * boost::serialization::extended_type_info_typeid::get_instance(), + * boost::serialization::extended_type_info_typeid::find(), + * boost::serialization::extended_type_info_typeid::find(), vpa )); BOOST_CHECK(vpa == boost::serialization::void_upcast( - * boost::serialization::extended_type_info_typeid::get_instance(), - * boost::serialization::extended_type_info_typeid::get_instance(), + * boost::serialization::extended_type_info_typeid::find(), + * boost::serialization::extended_type_info_typeid::find(), vpc )); BOOST_CHECK(vpc == boost::serialization::void_downcast( - * boost::serialization::extended_type_info_typeid::get_instance(), - * boost::serialization::extended_type_info_typeid::get_instance(), + * boost::serialization::extended_type_info_typeid::find(), + * boost::serialization::extended_type_info_typeid::find(), vpb )); BOOST_CHECK(vpb == boost::serialization::void_upcast( - * boost::serialization::extended_type_info_typeid::get_instance(), - * boost::serialization::extended_type_info_typeid::get_instance(), + * boost::serialization::extended_type_info_typeid::find(), + * boost::serialization::extended_type_info_typeid::find(), vpc )); BOOST_CHECK(vpd == boost::serialization::void_downcast( - * boost::serialization::extended_type_info_typeid::get_instance(), - * boost::serialization::extended_type_info_typeid::get_instance(), + * boost::serialization::extended_type_info_typeid::find(), + * boost::serialization::extended_type_info_typeid::find(), vpc )); BOOST_CHECK(vpc == boost::serialization::void_upcast( - * boost::serialization::extended_type_info_typeid::get_instance(), - * boost::serialization::extended_type_info_typeid::get_instance(), + * boost::serialization::extended_type_info_typeid::find(), + * boost::serialization::extended_type_info_typeid::find(), vpd )); - // note relationship between MostDerived and Base1 is automatically derived BOOST_CHECK(vpd == boost::serialization::void_downcast( - * boost::serialization::extended_type_info_typeid::get_instance(), - * boost::serialization::extended_type_info_typeid::get_instance(), + * boost::serialization::extended_type_info_typeid::find(), + * boost::serialization::extended_type_info_typeid::find(), vpa )); BOOST_CHECK(vpa == boost::serialization::void_upcast( - * boost::serialization::extended_type_info_typeid::get_instance(), - * boost::serialization::extended_type_info_typeid::get_instance(), + * boost::serialization::extended_type_info_typeid::find(), + * boost::serialization::extended_type_info_typeid::find(), vpd )); // note relationship between MostDerived and Base2 is automatically derived BOOST_CHECK(vpd == boost::serialization::void_downcast( - * boost::serialization::extended_type_info_typeid::get_instance(), - * boost::serialization::extended_type_info_typeid::get_instance(), + * boost::serialization::extended_type_info_typeid::find(), + * boost::serialization::extended_type_info_typeid::find(), vpb )); BOOST_CHECK(vpb == boost::serialization::void_upcast( - * boost::serialization::extended_type_info_typeid::get_instance(), - * boost::serialization::extended_type_info_typeid::get_instance(), + * boost::serialization::extended_type_info_typeid::find(), + * boost::serialization::extended_type_info_typeid::find(), vpd )); // need to double check to validate speed up optimization of derivations BOOST_CHECK(vpd == boost::serialization::void_downcast( - * boost::serialization::extended_type_info_typeid::get_instance(), - * boost::serialization::extended_type_info_typeid::get_instance(), + * boost::serialization::extended_type_info_typeid::find(), + * boost::serialization::extended_type_info_typeid::find(), vpa )); BOOST_CHECK(vpa == boost::serialization::void_upcast( - * boost::serialization::extended_type_info_typeid::get_instance(), - * boost::serialization::extended_type_info_typeid::get_instance(), + * boost::serialization::extended_type_info_typeid::find(), + * boost::serialization::extended_type_info_typeid::find(), vpd )); BOOST_CHECK(vpd == boost::serialization::void_downcast( - * boost::serialization::extended_type_info_typeid::get_instance(), - * boost::serialization::extended_type_info_typeid::get_instance(), + * boost::serialization::extended_type_info_typeid::find(), + * boost::serialization::extended_type_info_typeid::find(), vpb )); BOOST_CHECK(vpb == boost::serialization::void_upcast( - * boost::serialization::extended_type_info_typeid::get_instance(), - * boost::serialization::extended_type_info_typeid::get_instance(), + * boost::serialization::extended_type_info_typeid::find(), + * boost::serialization::extended_type_info_typeid::find(), vpd )); // check things that should fail BOOST_CHECK(NULL == boost::serialization::void_downcast( - * boost::serialization::extended_type_info_typeid::get_instance(), - * boost::serialization::extended_type_info_typeid::get_instance(), + * boost::serialization::extended_type_info_typeid::find(), + * boost::serialization::extended_type_info_typeid::find(), vpa )); @@ -147,6 +146,7 @@ test_main( int /* argc */, char* /* argv */[] ) static_cast(NULL), static_cast(NULL) ); + return EXIT_SUCCESS; } diff --git a/test/text_archive.hpp b/test/text_archive.hpp index e7e1b3ca..65425ce5 100644 --- a/test/text_archive.hpp +++ b/test/text_archive.hpp @@ -11,4 +11,3 @@ typedef std::ofstream test_ostream; #include typedef boost::archive::text_iarchive test_iarchive; typedef std::ifstream test_istream; -#define TEST_STREAM_FLAGS (std::ios_base::openmode)0 diff --git a/test/text_warchive.hpp b/test/text_warchive.hpp index de7dea01..8f77bf2d 100644 --- a/test/text_warchive.hpp +++ b/test/text_warchive.hpp @@ -11,9 +11,3 @@ typedef std::wofstream test_ostream; #include typedef boost::archive::text_wiarchive test_iarchive; typedef std::wifstream test_istream; -#define TEST_STREAM_FLAGS (std::ios_base::openmode)0 - - - - - diff --git a/test/xml_archive.hpp b/test/xml_archive.hpp index 1e3bdc1a..c7ca3433 100644 --- a/test/xml_archive.hpp +++ b/test/xml_archive.hpp @@ -11,6 +11,3 @@ typedef std::ofstream test_ostream; #include typedef boost::archive::xml_iarchive test_iarchive; typedef std::ifstream test_istream; -#define TEST_STREAM_FLAGS (std::ios_base::openmode)0 - - diff --git a/test/xml_warchive.hpp b/test/xml_warchive.hpp index 3483e225..22e4dba6 100644 --- a/test/xml_warchive.hpp +++ b/test/xml_warchive.hpp @@ -11,6 +11,3 @@ typedef std::wofstream test_ostream; #include typedef boost::archive::xml_wiarchive test_iarchive; typedef std::wifstream test_istream; -#define TEST_STREAM_FLAGS (std::ios_base::openmode)0 - -