Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/type_traits/test/function_traits_test.cpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 2.6 KB
Line 
1
2//  (C) Copyright John Maddock 2000.
3//  Use, modification and distribution are subject to the
4//  Boost Software License, Version 1.0. (See accompanying file
5//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7#include "test.hpp"
8#include "check_type.hpp"
9#include "check_integral_constant.hpp"
10#ifdef TEST_STD
11#  include <type_traits>
12#else
13#  include <boost/type_traits/function_traits.hpp>
14#endif
15
16typedef void(pf_zero1)();
17typedef int(pf_zero2)();
18typedef const int& (pf_zero3)();
19typedef void(pf_one1)(int);
20typedef int(pf_one2)(int);
21typedef const int&(pf_one3)(const int&);
22typedef void(pf_two1)(int,int);
23typedef int(pf_two2)(int,int);
24typedef const int&(pf_two3)(const int&,const int&);
25
26
27TT_TEST_BEGIN(function_traits)
28
29BOOST_CHECK_INTEGRAL_CONSTANT(::tt::function_traits<pf_zero1>::arity, 0);
30BOOST_CHECK_INTEGRAL_CONSTANT(::tt::function_traits<pf_zero2>::arity, 0);
31BOOST_CHECK_INTEGRAL_CONSTANT(::tt::function_traits<pf_zero3>::arity, 0);
32BOOST_CHECK_INTEGRAL_CONSTANT(::tt::function_traits<pf_one1>::arity, 1);
33BOOST_CHECK_INTEGRAL_CONSTANT(::tt::function_traits<pf_one2>::arity, 1);
34BOOST_CHECK_INTEGRAL_CONSTANT(::tt::function_traits<pf_one3>::arity, 1);
35BOOST_CHECK_INTEGRAL_CONSTANT(::tt::function_traits<pf_two1>::arity, 2);
36BOOST_CHECK_INTEGRAL_CONSTANT(::tt::function_traits<pf_two2>::arity, 2);
37BOOST_CHECK_INTEGRAL_CONSTANT(::tt::function_traits<pf_two3>::arity, 2);
38
39BOOST_CHECK_TYPE(void, ::tt::function_traits<pf_zero1>::result_type);
40BOOST_CHECK_TYPE(::tt::function_traits<pf_zero2>::result_type, int);
41BOOST_CHECK_TYPE(::tt::function_traits<pf_zero3>::result_type, const int&);
42BOOST_CHECK_TYPE(::tt::function_traits<pf_one1>::result_type, void);
43BOOST_CHECK_TYPE(::tt::function_traits<pf_one2>::result_type, int);
44BOOST_CHECK_TYPE(::tt::function_traits<pf_one3>::result_type, const int&);
45BOOST_CHECK_TYPE(::tt::function_traits<pf_two1>::result_type, void);
46BOOST_CHECK_TYPE(::tt::function_traits<pf_two2>::result_type, int);
47BOOST_CHECK_TYPE(::tt::function_traits<pf_two3>::result_type, const int&);
48
49BOOST_CHECK_TYPE(::tt::function_traits<pf_one1>::arg1_type, int);
50BOOST_CHECK_TYPE(::tt::function_traits<pf_one2>::arg1_type, int);
51BOOST_CHECK_TYPE(::tt::function_traits<pf_one3>::arg1_type, const int&);
52
53BOOST_CHECK_TYPE(::tt::function_traits<pf_two1>::arg1_type, int);
54BOOST_CHECK_TYPE(::tt::function_traits<pf_two2>::arg1_type, int);
55BOOST_CHECK_TYPE(::tt::function_traits<pf_two3>::arg1_type, const int&);
56BOOST_CHECK_TYPE(::tt::function_traits<pf_two1>::arg2_type, int);
57BOOST_CHECK_TYPE(::tt::function_traits<pf_two2>::arg2_type, int);
58BOOST_CHECK_TYPE(::tt::function_traits<pf_two3>::arg2_type, const int&);
59
60TT_TEST_END
61
62
63
64
65
66
67
68
Note: See TracBrowser for help on using the repository browser.