]>
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 | /* force fallback implementation using locks */ | |
9 | #define BOOST_ATOMIC_FORCE_FALLBACK 1 | |
10 | ||
11 | #include <boost/atomic.hpp> | |
f67539c2 TL |
12 | |
13 | #include <boost/config.hpp> | |
7c673cae | 14 | #include <boost/cstdint.hpp> |
7c673cae FG |
15 | |
16 | #include "api_test_helpers.hpp" | |
17 | ||
18 | int main(int, char *[]) | |
19 | { | |
20 | test_flag_api(); | |
21 | ||
f67539c2 TL |
22 | test_integral_api< atomic_wrapper, char >(); |
23 | test_integral_api< atomic_wrapper, signed char >(); | |
24 | test_integral_api< atomic_wrapper, unsigned char >(); | |
25 | test_integral_api< atomic_wrapper, boost::uint8_t >(); | |
26 | test_integral_api< atomic_wrapper, boost::int8_t >(); | |
27 | test_integral_api< atomic_wrapper, short >(); | |
28 | test_integral_api< atomic_wrapper, unsigned short >(); | |
29 | test_integral_api< atomic_wrapper, boost::uint16_t >(); | |
30 | test_integral_api< atomic_wrapper, boost::int16_t >(); | |
31 | test_integral_api< atomic_wrapper, int >(); | |
32 | test_integral_api< atomic_wrapper, unsigned int >(); | |
33 | test_integral_api< atomic_wrapper, boost::uint32_t >(); | |
34 | test_integral_api< atomic_wrapper, boost::int32_t >(); | |
35 | test_integral_api< atomic_wrapper, long >(); | |
36 | test_integral_api< atomic_wrapper, unsigned long >(); | |
37 | test_integral_api< atomic_wrapper, boost::uint64_t >(); | |
38 | test_integral_api< atomic_wrapper, boost::int64_t >(); | |
39 | test_integral_api< atomic_wrapper, long long >(); | |
40 | test_integral_api< atomic_wrapper, unsigned long long >(); | |
41 | #if defined(BOOST_HAS_INT128) && !defined(BOOST_ATOMIC_TESTS_NO_INT128) | |
42 | test_integral_api< atomic_wrapper, boost::int128_type >(); | |
43 | test_integral_api< atomic_wrapper, boost::uint128_type >(); | |
11fdf7f2 TL |
44 | #endif |
45 | ||
92f5a8d4 | 46 | #if !defined(BOOST_ATOMIC_NO_FLOATING_POINT) |
f67539c2 TL |
47 | test_floating_point_api< atomic_wrapper, float >(); |
48 | test_floating_point_api< atomic_wrapper, double >(); | |
49 | test_floating_point_api< atomic_wrapper, long double >(); | |
50 | #if defined(BOOST_HAS_FLOAT128) && !defined(BOOST_ATOMIC_TESTS_NO_FLOAT128) | |
51 | test_floating_point_api< atomic_wrapper, boost::float128_type >(); | |
92f5a8d4 | 52 | #endif |
11fdf7f2 | 53 | #endif |
7c673cae | 54 | |
f67539c2 | 55 | test_pointer_api< atomic_wrapper, int >(); |
7c673cae | 56 | |
f67539c2 | 57 | test_enum_api< atomic_wrapper >(); |
7c673cae | 58 | |
f67539c2 TL |
59 | test_struct_api< atomic_wrapper, test_struct< boost::uint8_t > >(); |
60 | test_struct_api< atomic_wrapper, test_struct< boost::uint16_t > >(); | |
61 | test_struct_api< atomic_wrapper, test_struct< boost::uint32_t > >(); | |
62 | test_struct_api< atomic_wrapper, test_struct< boost::uint64_t > >(); | |
7c673cae FG |
63 | |
64 | // https://svn.boost.org/trac/boost/ticket/10994 | |
f67539c2 | 65 | test_struct_x2_api< atomic_wrapper, test_struct_x2< boost::uint64_t > >(); |
7c673cae FG |
66 | |
67 | // https://svn.boost.org/trac/boost/ticket/9985 | |
f67539c2 | 68 | test_struct_api< atomic_wrapper, test_struct< double > >(); |
7c673cae | 69 | |
f67539c2 | 70 | test_large_struct_api< atomic_wrapper >(); |
7c673cae FG |
71 | |
72 | // Test that boost::atomic<T> only requires T to be trivially copyable. | |
73 | // Other non-trivial constructors are allowed. | |
f67539c2 | 74 | test_struct_with_ctor_api< atomic_wrapper >(); |
7c673cae FG |
75 | |
76 | return boost::report_errors(); | |
77 | } |