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