]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | // Copyright (c) 2011 Helge Bahmann |
f67539c2 | 2 | // Copyright (c) 2020 Andrey Semashev |
7c673cae FG |
3 | // |
4 | // Distributed under the Boost Software License, Version 1.0. | |
5 | // See accompanying file LICENSE_1_0.txt or copy at | |
6 | // http://www.boost.org/LICENSE_1_0.txt) | |
7 | ||
8 | #include <boost/atomic.hpp> | |
9 | ||
10 | #include <boost/config.hpp> | |
11 | #include <boost/cstdint.hpp> | |
7c673cae FG |
12 | |
13 | #include "api_test_helpers.hpp" | |
14 | ||
15 | int main(int, char *[]) | |
16 | { | |
17 | test_flag_api(); | |
18 | ||
f67539c2 TL |
19 | test_integral_api< atomic_wrapper, char >(); |
20 | test_integral_api< atomic_wrapper, signed char >(); | |
21 | test_integral_api< atomic_wrapper, unsigned char >(); | |
22 | test_integral_api< atomic_wrapper, boost::uint8_t >(); | |
23 | test_integral_api< atomic_wrapper, boost::int8_t >(); | |
24 | test_integral_api< atomic_wrapper, short >(); | |
25 | test_integral_api< atomic_wrapper, unsigned short >(); | |
26 | test_integral_api< atomic_wrapper, boost::uint16_t >(); | |
27 | test_integral_api< atomic_wrapper, boost::int16_t >(); | |
28 | test_integral_api< atomic_wrapper, int >(); | |
29 | test_integral_api< atomic_wrapper, unsigned int >(); | |
30 | test_integral_api< atomic_wrapper, boost::uint32_t >(); | |
31 | test_integral_api< atomic_wrapper, boost::int32_t >(); | |
32 | test_integral_api< atomic_wrapper, long >(); | |
33 | test_integral_api< atomic_wrapper, unsigned long >(); | |
34 | test_integral_api< atomic_wrapper, boost::uint64_t >(); | |
35 | test_integral_api< atomic_wrapper, boost::int64_t >(); | |
36 | test_integral_api< atomic_wrapper, long long >(); | |
37 | test_integral_api< atomic_wrapper, unsigned long long >(); | |
38 | #if defined(BOOST_HAS_INT128) && !defined(BOOST_ATOMIC_TESTS_NO_INT128) | |
39 | test_integral_api< atomic_wrapper, boost::int128_type >(); | |
40 | test_integral_api< atomic_wrapper, boost::uint128_type >(); | |
7c673cae FG |
41 | #endif |
42 | ||
f67539c2 TL |
43 | test_constexpr_ctor< char >(); |
44 | test_constexpr_ctor< short >(); | |
45 | test_constexpr_ctor< int >(); | |
46 | test_constexpr_ctor< long >(); | |
47 | // test_constexpr_ctor< int* >(); // for pointers we're not offering a constexpr constructor because of bitwise_cast | |
7c673cae | 48 | |
92f5a8d4 | 49 | #if !defined(BOOST_ATOMIC_NO_FLOATING_POINT) |
f67539c2 TL |
50 | test_floating_point_api< atomic_wrapper, float >(); |
51 | test_floating_point_api< atomic_wrapper, double >(); | |
52 | test_floating_point_api< atomic_wrapper, long double >(); | |
53 | #if defined(BOOST_HAS_FLOAT128) && !defined(BOOST_ATOMIC_TESTS_NO_FLOAT128) | |
54 | test_floating_point_api< atomic_wrapper, boost::float128_type >(); | |
92f5a8d4 | 55 | #endif |
11fdf7f2 TL |
56 | #endif |
57 | ||
f67539c2 | 58 | test_pointer_api< atomic_wrapper, int >(); |
7c673cae | 59 | |
f67539c2 | 60 | test_enum_api< atomic_wrapper >(); |
7c673cae | 61 | |
f67539c2 TL |
62 | test_struct_api< atomic_wrapper, test_struct< boost::uint8_t > >(); |
63 | test_struct_api< atomic_wrapper, test_struct< boost::uint16_t > >(); | |
64 | test_struct_api< atomic_wrapper, test_struct< boost::uint32_t > >(); | |
65 | test_struct_api< atomic_wrapper, test_struct< boost::uint64_t > >(); | |
7c673cae | 66 | #if defined(BOOST_HAS_INT128) |
f67539c2 | 67 | test_struct_api< atomic_wrapper, test_struct< boost::uint128_type > >(); |
7c673cae FG |
68 | #endif |
69 | ||
70 | // https://svn.boost.org/trac/boost/ticket/10994 | |
f67539c2 | 71 | test_struct_x2_api< atomic_wrapper, test_struct_x2< boost::uint64_t > >(); |
7c673cae FG |
72 | |
73 | // https://svn.boost.org/trac/boost/ticket/9985 | |
f67539c2 | 74 | test_struct_api< atomic_wrapper, test_struct< double > >(); |
7c673cae | 75 | |
f67539c2 | 76 | test_large_struct_api< atomic_wrapper >(); |
7c673cae FG |
77 | |
78 | // Test that boost::atomic<T> only requires T to be trivially copyable. | |
79 | // Other non-trivial constructors are allowed. | |
f67539c2 | 80 | test_struct_with_ctor_api< atomic_wrapper >(); |
7c673cae FG |
81 | |
82 | return boost::report_errors(); | |
83 | } |