1 // Copyright (c) 2020 Andrey Semashev
3 // Distributed under the Boost Software License, Version 1.0.
4 // See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 #include <boost/atomic/atomic_ref.hpp>
9 #include <boost/config.hpp>
10 #include <boost/cstdint.hpp>
12 #include "api_test_helpers.hpp"
14 int main(int, char *[])
16 test_integral_api
< atomic_ref_wrapper
, char >();
17 test_integral_api
< atomic_ref_wrapper
, signed char >();
18 test_integral_api
< atomic_ref_wrapper
, unsigned char >();
19 test_integral_api
< atomic_ref_wrapper
, boost::uint8_t >();
20 test_integral_api
< atomic_ref_wrapper
, boost::int8_t >();
21 test_integral_api
< atomic_ref_wrapper
, short >();
22 test_integral_api
< atomic_ref_wrapper
, unsigned short >();
23 test_integral_api
< atomic_ref_wrapper
, boost::uint16_t >();
24 test_integral_api
< atomic_ref_wrapper
, boost::int16_t >();
25 test_integral_api
< atomic_ref_wrapper
, int >();
26 test_integral_api
< atomic_ref_wrapper
, unsigned int >();
27 test_integral_api
< atomic_ref_wrapper
, boost::uint32_t >();
28 test_integral_api
< atomic_ref_wrapper
, boost::int32_t >();
29 test_integral_api
< atomic_ref_wrapper
, long >();
30 test_integral_api
< atomic_ref_wrapper
, unsigned long >();
31 test_integral_api
< atomic_ref_wrapper
, boost::uint64_t >();
32 test_integral_api
< atomic_ref_wrapper
, boost::int64_t >();
33 test_integral_api
< atomic_ref_wrapper
, long long >();
34 test_integral_api
< atomic_ref_wrapper
, unsigned long long >();
35 #if defined(BOOST_HAS_INT128) && !defined(BOOST_ATOMIC_TESTS_NO_INT128)
36 test_integral_api
< atomic_ref_wrapper
, boost::int128_type
>();
37 test_integral_api
< atomic_ref_wrapper
, boost::uint128_type
>();
40 #if !defined(BOOST_ATOMIC_NO_FLOATING_POINT)
41 test_floating_point_api
< atomic_ref_wrapper
, float >();
42 test_floating_point_api
< atomic_ref_wrapper
, double >();
43 test_floating_point_api
< atomic_ref_wrapper
, long double >();
44 #if defined(BOOST_HAS_FLOAT128) && !defined(BOOST_ATOMIC_TESTS_NO_FLOAT128)
45 test_floating_point_api
< atomic_ref_wrapper
, boost::float128_type
>();
49 test_pointer_api
< atomic_ref_wrapper
, int >();
51 test_enum_api
< atomic_ref_wrapper
>();
53 test_struct_api
< atomic_ref_wrapper
, test_struct
< boost::uint8_t > >();
54 test_struct_api
< atomic_ref_wrapper
, test_struct
< boost::uint16_t > >();
55 test_struct_api
< atomic_ref_wrapper
, test_struct
< boost::uint32_t > >();
56 test_struct_api
< atomic_ref_wrapper
, test_struct
< boost::uint64_t > >();
57 #if defined(BOOST_HAS_INT128)
58 test_struct_api
< atomic_ref_wrapper
, test_struct
< boost::uint128_type
> >();
61 // https://svn.boost.org/trac/boost/ticket/10994
62 test_struct_x2_api
< atomic_ref_wrapper
, test_struct_x2
< boost::uint64_t > >();
64 // https://svn.boost.org/trac/boost/ticket/9985
65 test_struct_api
< atomic_ref_wrapper
, test_struct
< double > >();
67 test_large_struct_api
< atomic_ref_wrapper
>();
69 // Test that boost::atomic_ref<T> only requires T to be trivially copyable.
70 // Other non-trivial constructors are allowed.
71 test_struct_with_ctor_api
< atomic_ref_wrapper
>();
73 return boost::report_errors();