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