X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fboost%2Flibs%2Faccumulators%2Ftest%2Frolling_count.cpp;h=a1b6b6fe8cc948e4172e502f1d88813d66243839;hb=92f5a8d42d07f9929ae4fa7e01342fe8d96808a8;hp=fef132c9a865a2ead76967d176c7a2893e5c4a46;hpb=a0324939f9d0e1905d5df8f57442f09dc70af83d;p=ceph.git diff --git a/ceph/src/boost/libs/accumulators/test/rolling_count.cpp b/ceph/src/boost/libs/accumulators/test/rolling_count.cpp index fef132c9a..a1b6b6fe8 100644 --- a/ceph/src/boost/libs/accumulators/test/rolling_count.cpp +++ b/ceph/src/boost/libs/accumulators/test/rolling_count.cpp @@ -7,6 +7,9 @@ #include #include #include +#include +#include +#include using namespace boost; using namespace unit_test; @@ -37,6 +40,30 @@ void test_stat() BOOST_CHECK_EQUAL(3u, rolling_count(acc)); } +/////////////////////////////////////////////////////////////////////////////// +// test_persistency +// +void test_persistency() +{ + std::stringstream ss; + { + accumulator_set > acc(tag::rolling_window::window_size = 3); + acc(1); + acc(1); + acc(1); + acc(1); + acc(1); + acc(1); + BOOST_CHECK_EQUAL(3u, rolling_count(acc)); + boost::archive::text_oarchive oa(ss); + acc.serialize(oa, 0); + } + accumulator_set > acc(tag::rolling_window::window_size = 3); + boost::archive::text_iarchive ia(ss); + acc.serialize(ia, 0); + BOOST_CHECK_EQUAL(3u, rolling_count(acc)); +} + /////////////////////////////////////////////////////////////////////////////// // init_unit_test_suite // @@ -45,6 +72,7 @@ test_suite* init_unit_test_suite( int argc, char* argv[] ) test_suite *test = BOOST_TEST_SUITE("rolling count test"); test->add(BOOST_TEST_CASE(&test_stat)); + test->add(BOOST_TEST_CASE(&test_persistency)); return test; }