Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/type_traits/test/has_nothrow_assign_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: 11.7 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_integral_constant.hpp"
9#ifdef TEST_STD
10#  include <type_traits>
11#else
12#  include <boost/type_traits/has_nothrow_assign.hpp>
13#endif
14
15TT_TEST_BEGIN(has_nothrow_assign)
16
17BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<bool>::value, true);
18#ifndef TEST_STD
19// unspecified behaviour:
20BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<bool const>::value, false);
21BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<bool volatile>::value, false);
22BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<bool const volatile>::value, false);
23#endif
24
25BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<signed char>::value, true);
26#ifndef TEST_STD
27// unspecified behaviour:
28BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<signed char const>::value, false);
29BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<signed char volatile>::value, false);
30BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<signed char const volatile>::value, false);
31#endif
32BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned char>::value, true);
33BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<char>::value, true);
34#ifndef TEST_STD
35// unspecified behaviour:
36BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned char const>::value, false);
37BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<char const>::value, false);
38BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned char volatile>::value, false);
39BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<char volatile>::value, false);
40BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned char const volatile>::value, false);
41BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<char const volatile>::value, false);
42#endif
43
44BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned short>::value, true);
45BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<short>::value, true);
46#ifndef TEST_STD
47// unspecified behaviour:
48BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned short const>::value, false);
49BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<short const>::value, false);
50BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned short volatile>::value, false);
51BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<short volatile>::value, false);
52BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned short const volatile>::value, false);
53BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<short const volatile>::value, false);
54#endif
55
56BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned int>::value, true);
57BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<int>::value, true);
58#ifndef TEST_STD
59// unspecified behaviour:
60BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned int const>::value, false);
61BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<int const>::value, false);
62BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned int volatile>::value, false);
63BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<int volatile>::value, false);
64BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned int const volatile>::value, false);
65BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<int const volatile>::value, false);
66#endif
67
68BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned long>::value, true);
69BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<long>::value, true);
70#ifndef TEST_STD
71// unspecified behaviour:
72BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned long const>::value, false);
73BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<long const>::value, false);
74BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned long volatile>::value, false);
75BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<long volatile>::value, false);
76BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned long const volatile>::value, false);
77BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<long const volatile>::value, false);
78#endif
79
80#ifdef BOOST_HAS_LONG_LONG
81
82BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign< ::boost::ulong_long_type>::value, true);
83BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign< ::boost::long_long_type>::value, true);
84#ifndef TEST_STD
85// unspecified behaviour:
86BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign< ::boost::ulong_long_type const>::value, false);
87BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign< ::boost::long_long_type const>::value, false);
88BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign< ::boost::ulong_long_type volatile>::value, false);
89BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign< ::boost::long_long_type volatile>::value, false);
90BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign< ::boost::ulong_long_type const volatile>::value, false);
91BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign< ::boost::long_long_type const volatile>::value, false);
92#endif
93#endif
94
95#ifdef BOOST_HAS_MS_INT64
96
97BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int8>::value, true);
98BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int8>::value, true);
99#ifndef TEST_STD
100// unspecified behaviour:
101BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int8 const>::value, false);
102BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int8 const>::value, false);
103BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int8 volatile>::value, false);
104BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int8 volatile>::value, false);
105BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int8 const volatile>::value, false);
106BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int8 const volatile>::value, false);
107#endif
108
109BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int16>::value, true);
110BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int16>::value, true);
111#ifndef TEST_STD
112// unspecified behaviour:
113BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int16 const>::value, false);
114BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int16 const>::value, false);
115BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int16 volatile>::value, false);
116BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int16 volatile>::value, false);
117BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int16 const volatile>::value, false);
118BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int16 const volatile>::value, false);
119#endif
120
121BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int32>::value, true);
122BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int32>::value, true);
123#ifndef TEST_STD
124// unspecified behaviour:
125BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int32 const>::value, false);
126BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int32 const>::value, false);
127BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int32 volatile>::value, false);
128BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int32 volatile>::value, false);
129BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int32 const volatile>::value, false);
130BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int32 const volatile>::value, false);
131#endif
132
133BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int64>::value, true);
134BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int64>::value, true);
135#ifndef TEST_STD
136// unspecified behaviour:
137BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int64 const>::value, false);
138BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int64 const>::value, false);
139BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int64 volatile>::value, false);
140BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int64 volatile>::value, false);
141BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<unsigned __int64 const volatile>::value, false);
142BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<__int64 const volatile>::value, false);
143#endif
144#endif
145
146BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<float>::value, true);
147#ifndef TEST_STD
148// unspecified behaviour:
149BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<float const>::value, false);
150BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<float volatile>::value, false);
151BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<float const volatile>::value, false);
152#endif
153
154BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<double>::value, true);
155#ifndef TEST_STD
156// unspecified behaviour:
157BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<double const>::value, false);
158BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<double volatile>::value, false);
159BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<double const volatile>::value, false);
160#endif
161
162BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<long double>::value, true);
163#ifndef TEST_STD
164// unspecified behaviour:
165BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<long double const>::value, false);
166BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<long double volatile>::value, false);
167BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<long double const volatile>::value, false);
168#endif
169
170BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<int>::value, true);
171BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<void*>::value, true);
172#ifndef TEST_STD
173// unspecified behaviour:
174BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<int*const>::value, false);
175#endif
176BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<f1>::value, true);
177BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<f2>::value, true);
178BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<f3>::value, true);
179BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<mf1>::value, true);
180BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<mf2>::value, true);
181BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<mf3>::value, true);
182BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<mp>::value, true);
183BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<cmf>::value, true);
184BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<enum_UDT>::value, true);
185
186BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<int&>::value, false);
187BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<const int&>::value, false);
188BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<int[2]>::value, true);
189BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<int[3][2]>::value, true);
190BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<int[2][4][5][6][3]>::value, true);
191BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<UDT>::value, false);
192BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<empty_UDT>::value, false);
193BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<void>::value, true);
194// cases we would like to succeed but can't implement in the language:
195BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<empty_POD_UDT>::value, true, false);
196BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<POD_UDT>::value, true, false);
197BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<POD_union_UDT>::value, true, false);
198BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<empty_POD_union_UDT>::value, true, false);
199BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<nothrow_assign_UDT>::value, true, false);
200BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<nothrow_copy_UDT>::value, false);
201BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<nothrow_construct_UDT>::value, false);
202
203BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<test_abc1>::value, false);
204
205TT_TEST_END
206
207
208
Note: See TracBrowser for help on using the repository browser.