]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/histogram/test/boost_range_support_test.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / histogram / test / boost_range_support_test.cpp
1 // Copyright 2018-2019 Hans Dembinski
2 //
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt
5 // or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7 #include <boost/core/lightweight_test.hpp>
8 #include <boost/histogram/axis/integer.hpp>
9 #include "throw_exception.hpp"
10 #include <boost/histogram/histogram.hpp>
11 #include <boost/histogram/make_histogram.hpp>
12 #include <boost/range/adaptor/filtered.hpp>
13 #include <boost/range/numeric.hpp>
14
15 using namespace boost::histogram;
16 using namespace boost::adaptors;
17
18 int main() {
19 auto h = make_histogram(axis::integer<>(1, 4));
20 h(1, weight(1));
21 h(2, weight(2));
22 h(3, weight(3));
23 h(4, weight(4));
24
25 auto s1 = boost::accumulate(h | filtered([](double x) { return x > 2; }), 0.0);
26 BOOST_TEST_EQ(s1, 7);
27
28 return boost::report_errors();
29 }