mirror of
https://github.com/boostorg/histogram.git
synced 2026-01-29 19:42:12 +00:00
changed axis::option_type to compile-time option, replaced fancy histogram iterator with indexed range adaptor, cleanup of various headers
This commit is contained in:
@@ -4,9 +4,14 @@
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <array>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/histogram.hpp>
|
||||
#include <boost/histogram/accumulators/weighted_sum.hpp>
|
||||
#include <boost/histogram/algorithm/sum.hpp>
|
||||
#include <boost/histogram/axis/integer.hpp>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include "utility_histogram.hpp"
|
||||
|
||||
using namespace boost::histogram;
|
||||
@@ -33,6 +38,17 @@ void run_tests() {
|
||||
auto h4 = make_s(Tag(), std::unordered_map<std::size_t, int>(), ax);
|
||||
for (unsigned i = 0; i < 100; ++i) h4(i);
|
||||
BOOST_TEST_EQ(sum(h4), 100);
|
||||
|
||||
auto h5 =
|
||||
make_s(Tag(), std::vector<accumulators::weighted_sum<>>(), axis::integer<>(0, 1),
|
||||
axis::integer<int, axis::null_type, axis::option_type::none>(2, 4));
|
||||
h5(weight(2), 0, 2);
|
||||
h5(-1, 2);
|
||||
h5(1, 3);
|
||||
|
||||
const auto v = algorithm::sum(h5);
|
||||
BOOST_TEST_EQ(v.value(), 4);
|
||||
BOOST_TEST_EQ(v.variance(), 6);
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
Reference in New Issue
Block a user