]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/type_traits/test/make_unsigned_test.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / type_traits / test / make_unsigned_test.cpp
1
2 // (C) Copyright John Maddock 2007.
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.tt.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/make_unsigned.hpp>
14 #endif
15
16 TT_TEST_BEGIN(make_unsigned)
17 // signed types:
18 BOOST_CHECK_TYPE(::tt::make_unsigned<signed char>::type, unsigned char);
19 BOOST_CHECK_TYPE(::tt::make_unsigned<short>::type, unsigned short);
20 BOOST_CHECK_TYPE(::tt::make_unsigned<int>::type, unsigned int);
21 BOOST_CHECK_TYPE(::tt::make_unsigned<long>::type, unsigned long);
22 #ifdef BOOST_HAS_LONG_LONG
23 BOOST_CHECK_TYPE(::tt::make_unsigned<boost::long_long_type>::type, boost::ulong_long_type);
24 #elif defined(BOOST_HAS_MS_INT64)
25 BOOST_CHECK_TYPE(::tt::make_unsigned<__int64>::type, unsigned __int64);
26 #endif
27 // const signed types:
28 BOOST_CHECK_TYPE(::tt::make_unsigned<const signed char>::type, const unsigned char);
29 BOOST_CHECK_TYPE(::tt::make_unsigned<const short>::type, const unsigned short);
30 BOOST_CHECK_TYPE(::tt::make_unsigned<const int>::type, const unsigned int);
31 BOOST_CHECK_TYPE(::tt::make_unsigned<const long>::type, const unsigned long);
32 #ifdef BOOST_HAS_LONG_LONG
33 BOOST_CHECK_TYPE(::tt::make_unsigned<const boost::long_long_type>::type, const boost::ulong_long_type);
34 #elif defined(BOOST_HAS_MS_INT64)
35 BOOST_CHECK_TYPE(::tt::make_unsigned<const __int64>::type, const unsigned __int64);
36 #endif
37 // volatile signed types:
38 BOOST_CHECK_TYPE(::tt::make_unsigned<volatile signed char>::type, volatile unsigned char);
39 BOOST_CHECK_TYPE(::tt::make_unsigned<volatile short>::type, volatile unsigned short);
40 BOOST_CHECK_TYPE(::tt::make_unsigned<volatile int>::type, volatile unsigned int);
41 BOOST_CHECK_TYPE(::tt::make_unsigned<volatile long>::type, volatile unsigned long);
42 #ifdef BOOST_HAS_LONG_LONG
43 BOOST_CHECK_TYPE(::tt::make_unsigned<volatile boost::long_long_type>::type, volatile boost::ulong_long_type);
44 #elif defined(BOOST_HAS_MS_INT64)
45 BOOST_CHECK_TYPE(::tt::make_unsigned<volatile __int64>::type, volatile unsigned __int64);
46 #endif
47 // const volatile signed types:
48 BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile signed char>::type, const volatile unsigned char);
49 BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile short>::type, const volatile unsigned short);
50 BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile int>::type, const volatile unsigned int);
51 BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile long>::type, const volatile unsigned long);
52 #ifdef BOOST_HAS_LONG_LONG
53 BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile boost::long_long_type>::type, const volatile boost::ulong_long_type);
54 #elif defined(BOOST_HAS_MS_INT64)
55 BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile __int64>::type, const volatile unsigned __int64);
56 #endif
57
58 // unsigned types:
59 BOOST_CHECK_TYPE(::tt::make_unsigned<unsigned char>::type, unsigned char);
60 BOOST_CHECK_TYPE(::tt::make_unsigned<unsigned short>::type, unsigned short);
61 BOOST_CHECK_TYPE(::tt::make_unsigned<unsigned int>::type, unsigned int);
62 BOOST_CHECK_TYPE(::tt::make_unsigned<unsigned long>::type, unsigned long);
63 #ifdef BOOST_HAS_LONG_LONG
64 BOOST_CHECK_TYPE(::tt::make_unsigned<boost::ulong_long_type>::type, boost::ulong_long_type);
65 #elif defined(BOOST_HAS_MS_INT64)
66 BOOST_CHECK_TYPE(::tt::make_unsigned<unsigned __int64>::type, unsigned __int64);
67 #endif
68 // const unsigned types:
69 BOOST_CHECK_TYPE(::tt::make_unsigned<const unsigned char>::type, const unsigned char);
70 BOOST_CHECK_TYPE(::tt::make_unsigned<const unsigned short>::type, const unsigned short);
71 BOOST_CHECK_TYPE(::tt::make_unsigned<const unsigned int>::type, const unsigned int);
72 BOOST_CHECK_TYPE(::tt::make_unsigned<const unsigned long>::type, const unsigned long);
73 #ifdef BOOST_HAS_LONG_LONG
74 BOOST_CHECK_TYPE(::tt::make_unsigned<const boost::ulong_long_type>::type, const boost::ulong_long_type);
75 #elif defined(BOOST_HAS_MS_INT64)
76 BOOST_CHECK_TYPE(::tt::make_unsigned<const unsigned __int64>::type, const unsigned __int64);
77 #endif
78 // volatile unsigned types:
79 BOOST_CHECK_TYPE(::tt::make_unsigned<volatile unsigned char>::type, volatile unsigned char);
80 BOOST_CHECK_TYPE(::tt::make_unsigned<volatile unsigned short>::type, volatile unsigned short);
81 BOOST_CHECK_TYPE(::tt::make_unsigned<volatile unsigned int>::type, volatile unsigned int);
82 BOOST_CHECK_TYPE(::tt::make_unsigned<volatile unsigned long>::type, volatile unsigned long);
83 #ifdef BOOST_HAS_LONG_LONG
84 BOOST_CHECK_TYPE(::tt::make_unsigned<volatile boost::ulong_long_type>::type, volatile boost::ulong_long_type);
85 #elif defined(BOOST_HAS_MS_INT64)
86 BOOST_CHECK_TYPE(::tt::make_unsigned<volatile unsigned __int64>::type, volatile unsigned __int64);
87 #endif
88 // const volatile unsigned types:
89 BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile unsigned char>::type, const volatile unsigned char);
90 BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile unsigned short>::type, const volatile unsigned short);
91 BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile unsigned int>::type, const volatile unsigned int);
92 BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile unsigned long>::type, const volatile unsigned long);
93 #ifdef BOOST_HAS_LONG_LONG
94 BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile boost::ulong_long_type>::type, const volatile boost::ulong_long_type);
95 #elif defined(BOOST_HAS_MS_INT64)
96 BOOST_CHECK_TYPE(::tt::make_unsigned<const volatile unsigned __int64>::type, const volatile unsigned __int64);
97 #endif
98 #ifdef BOOST_HAS_INT128
99 BOOST_CHECK_TYPE(::tt::make_unsigned<boost::int128_type>::type, boost::uint128_type);
100 BOOST_CHECK_TYPE(::tt::make_unsigned<boost::uint128_type>::type, boost::uint128_type);
101 #endif
102
103 // character types:
104 BOOST_CHECK_TYPE(::tt::make_unsigned<char>::type, unsigned char);
105 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_integral< ::tt::make_unsigned<wchar_t>::type>::value, true);
106 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned< ::tt::make_unsigned<wchar_t>::type>::value, true);
107 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_integral< ::tt::make_unsigned<enum_UDT>::type>::value, true);
108 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned< ::tt::make_unsigned<enum_UDT>::type>::value, true);
109 TT_TEST_END
110
111