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 #ifndef BOOST_HISTOGRAM_TEST_UTILITY_AXIS_HPP
8 #define BOOST_HISTOGRAM_TEST_UTILITY_AXIS_HPP
9
10 #include <boost/core/lightweight_test.hpp>
11 #include <boost/histogram/fwd.hpp>
12
13 namespace boost {
14 namespace histogram {
15
16 template <class Axis>
test_axis_iterator(const Axis & a,axis::index_type begin,axis::index_type end)17 void test_axis_iterator(const Axis& a, axis::index_type begin, axis::index_type end) {
18 for (auto bin : a) {
19 BOOST_TEST_EQ(bin, a.bin(begin));
20 ++begin;
21 }
22 BOOST_TEST_EQ(begin, end);
23 auto rit = a.rbegin();
24 for (; rit != a.rend(); ++rit) {
25 --begin;
26 BOOST_TEST_EQ(*rit, a.bin(begin));
27 }
28 }
29
30 namespace axis {
operator ==(const null_type &,const null_type &)31 bool operator==(const null_type&, const null_type&) { return true; }
32 } // namespace axis
33
34 } // namespace histogram
35 } // namespace boost
36
37 #endif
38