Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / histogram / test / detail_args_type_test.cpp
1 // Copyright 2015-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_trait.hpp>
8 #include <boost/histogram/detail/args_type.hpp>
9 #include <tuple>
10 #include "std_ostream.hpp"
11
12 namespace dtl = boost::histogram::detail;
13
14 struct Foo {
15   int f1(char);
16   int f2(long) const;
17   static int f3(char, int);
18   auto f4(char, int) { return 0; };
19 };
20
21 int main() {
22   BOOST_TEST_TRAIT_SAME(dtl::args_type<decltype(&Foo::f1)>, std::tuple<char>);
23   BOOST_TEST_TRAIT_SAME(dtl::args_type<decltype(&Foo::f2)>, std::tuple<long>);
24   BOOST_TEST_TRAIT_SAME(dtl::args_type<decltype(&Foo::f3)>, std::tuple<char, int>);
25   BOOST_TEST_TRAIT_SAME(dtl::args_type<decltype(&Foo::f4)>, std::tuple<char, int>);
26
27   BOOST_TEST_TRAIT_SAME(dtl::arg_type<decltype(&Foo::f3)>, char);
28   BOOST_TEST_TRAIT_SAME(dtl::arg_type<decltype(&Foo::f3), 1>, int);
29
30   return boost::report_errors();
31 }