fallback_api.cpp 2.3 KB

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