]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/histogram/test/detail_accumulator_traits_test.cpp
1 // Copyright 2019 Hans Dembinski
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)
7 #include <boost/core/lightweight_test.hpp>
8 #include <boost/core/lightweight_test_trait.hpp>
9 #include <boost/histogram/detail/accumulator_traits.hpp>
10 #include <boost/histogram/weight.hpp>
13 namespace dtl
= boost::histogram::detail
;
16 using boost::histogram::weight_type
;
18 BOOST_TEST(dtl::accumulator_traits
<int>::weight_support
);
19 BOOST_TEST_TRAIT_SAME(dtl::accumulator_traits
<int>::args
, std::tuple
<>);
21 BOOST_TEST(dtl::accumulator_traits
<float>::weight_support
);
22 BOOST_TEST_TRAIT_SAME(dtl::accumulator_traits
<float>::args
, std::tuple
<>);
28 BOOST_TEST_NOT(dtl::accumulator_traits
<A1
>::weight_support
);
29 BOOST_TEST_TRAIT_SAME(typename
dtl::accumulator_traits
<A1
>::args
, std::tuple
<>);
32 void operator()(int, double);
35 BOOST_TEST_NOT(dtl::accumulator_traits
<A2
>::weight_support
);
36 BOOST_TEST_TRAIT_SAME(typename
dtl::accumulator_traits
<A2
>::args
,
37 std::tuple
<int, double>);
41 void operator()(weight_type
<int>);
44 BOOST_TEST(dtl::accumulator_traits
<A3
>::weight_support
);
45 BOOST_TEST_TRAIT_SAME(typename
dtl::accumulator_traits
<A3
>::args
, std::tuple
<>);
48 void operator()(int, double, char);
49 void operator()(weight_type
<int>, int, double, char);
52 BOOST_TEST(dtl::accumulator_traits
<A4
>::weight_support
);
53 BOOST_TEST_TRAIT_SAME(typename
dtl::accumulator_traits
<A4
>::args
,
54 std::tuple
<int, double, char>);
57 void operator()(const weight_type
<int>, int);
60 BOOST_TEST(dtl::accumulator_traits
<A5
>::weight_support
);
61 BOOST_TEST_TRAIT_SAME(typename
dtl::accumulator_traits
<A5
>::args
, std::tuple
<int>);
64 void operator()(const weight_type
<int>&, const int);
67 BOOST_TEST(dtl::accumulator_traits
<A6
>::weight_support
);
68 BOOST_TEST_TRAIT_SAME(typename
dtl::accumulator_traits
<A6
>::args
, std::tuple
<int>);
71 void operator()(weight_type
<int>&&, int&&);
74 BOOST_TEST(dtl::accumulator_traits
<A7
>::weight_support
);
75 BOOST_TEST_TRAIT_SAME(typename
dtl::accumulator_traits
<A7
>::args
, std::tuple
<int&&>);
81 BOOST_TEST(dtl::accumulator_traits
<B1
>::weight_support
);
82 BOOST_TEST_TRAIT_SAME(typename
dtl::accumulator_traits
<B1
>::args
, std::tuple
<>);
85 int operator+=(weight_type
<int>);
88 BOOST_TEST(dtl::accumulator_traits
<B2
>::weight_support
);
89 BOOST_TEST_TRAIT_SAME(typename
dtl::accumulator_traits
<B2
>::args
, std::tuple
<>);
92 int operator+=(const weight_type
<double>&);
95 BOOST_TEST(dtl::accumulator_traits
<B3
>::weight_support
);
96 BOOST_TEST_TRAIT_SAME(typename
dtl::accumulator_traits
<B3
>::args
, std::tuple
<>);
98 // potentially ambiguous case that mimicks accumulators::weighted_sum
101 int operator+=(const weight_type
<double>&);
102 int operator+=(const B4
&); // *this += 0 succeeds as *this += B4(0)
105 BOOST_TEST(dtl::accumulator_traits
<B4
>::weight_support
);
106 BOOST_TEST_TRAIT_SAME(typename
dtl::accumulator_traits
<B4
>::args
, std::tuple
<>);
108 return boost::report_errors();