diff --git a/test/storage_adaptor_serialization_test.cpp b/test/storage_adaptor_serialization_test.cpp new file mode 100644 index 00000000..2a67a2ed --- /dev/null +++ b/test/storage_adaptor_serialization_test.cpp @@ -0,0 +1,52 @@ +// Copyright 2018 Hans Dembinski +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace boost::histogram; + +template +void test_serialization() { + auto a = storage_adaptor(); + a.reset(3); + a(0); + a(2); + std::ostringstream os; + std::string buf; + { + std::ostringstream os; + boost::archive::text_oarchive oa(os); + oa << a; + buf = os.str(); + } + auto b = storage_adaptor(); + BOOST_TEST(!(a == b)); + { + std::istringstream is(buf); + boost::archive::text_iarchive ia(is); + ia >> b; + } + BOOST_TEST(a == b); +} + +int main() { + test_serialization>(); + // test_serialization>(); + // test_serialization>(); + + return boost::report_errors(); +}