Skip to content

Commit

Permalink
added serialization test
Browse files Browse the repository at this point in the history
  • Loading branch information
HDembinski committed Apr 24, 2024
1 parent a911efb commit 27391a6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/boost/histogram/accumulators/collector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define BOOST_HISTOGRAM_ACCUMULATORS_COLLECTOR_HPP

#include <algorithm> // for std::equal
#include <boost/core/nvp.hpp>
#include <boost/histogram/detail/detect.hpp>
#include <boost/histogram/fwd.hpp> // for collector<>
#include <initializer_list>
Expand Down
14 changes: 14 additions & 0 deletions test/accumulators_serialization_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,19 @@ int main(int argc, char** argv) {
BOOST_TEST(a == b);
}

// collector
{
const auto filename = join(argv[1], "accumulators_serialization_test_collector.xml");
accumulators::collector<> a;
a(1.5);
a(4.0);
print_xml(filename, a);

accumulators::collector<> b;
BOOST_TEST_NOT(a == b);
load_xml(filename, b);
BOOST_TEST(a == b);
}

return boost::report_errors();
}

0 comments on commit 27391a6

Please sign in to comment.