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:
Hans Dembinski
2018-11-25 22:35:26 +01:00
parent e9c75559c4
commit 08a09235a4
40 changed files with 720 additions and 611 deletions

View File

@@ -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() {