5 // Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 // Disable autolinking for unit tests.
12 #if !defined(BOOST_ALL_NO_LIB)
13 #define BOOST_ALL_NO_LIB 1
14 #endif // !defined(BOOST_ALL_NO_LIB)
16 // Test that header file is self-contained.
17 #include <boost/asio/execution/executor.hpp>
19 #include "../unit_test.hpp"
21 struct not_an_executor
31 executor(const executor
&) BOOST_ASIO_NOEXCEPT
35 #if defined(BOOST_ASIO_HAS_MOVE)
36 executor(executor
&&) BOOST_ASIO_NOEXCEPT
39 #endif // defined(BOOST_ASIO_HAS_MOVE)
42 void execute(BOOST_ASIO_MOVE_ARG(F
) f
) const BOOST_ASIO_NOEXCEPT
47 bool operator==(const executor
&) const BOOST_ASIO_NOEXCEPT
52 bool operator!=(const executor
&) const BOOST_ASIO_NOEXCEPT
62 #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT)
65 struct execute_member
<executor
, F
>
67 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid
= true);
68 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept
= true);
69 typedef void result_type
;
72 #endif // !defined(BOOST_ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT)
73 #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT)
76 struct equality_comparable
<executor
>
78 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid
= true);
79 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept
= true);
82 #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT)
88 void is_executor_test()
91 !boost::asio::execution::is_executor
<
96 !boost::asio::execution::is_executor
<
101 boost::asio::execution::is_executor
<
106 void is_executor_of_test()
109 !boost::asio::execution::is_executor_of
<
115 !boost::asio::execution::is_executor_of
<
121 boost::asio::execution::is_executor_of
<
127 struct executor_with_other_shape_type
129 typedef double shape_type
;
132 void executor_shape_test()
135 boost::asio::is_same
<
136 boost::asio::execution::executor_shape
<executor
>::type
,
141 boost::asio::is_same
<
142 boost::asio::execution::executor_shape
<
143 executor_with_other_shape_type
149 struct executor_with_other_index_type
151 typedef unsigned char index_type
;
154 void executor_index_test()
157 boost::asio::is_same
<
158 boost::asio::execution::executor_index
<executor
>::type
,
163 boost::asio::is_same
<
164 boost::asio::execution::executor_index
<
165 executor_with_other_shape_type
171 boost::asio::is_same
<
172 boost::asio::execution::executor_index
<
173 executor_with_other_index_type
179 BOOST_ASIO_TEST_SUITE
182 BOOST_ASIO_TEST_CASE(is_executor_test
)
183 BOOST_ASIO_TEST_CASE(is_executor_of_test
)
184 BOOST_ASIO_TEST_CASE(executor_shape_test
)
185 BOOST_ASIO_TEST_CASE(executor_index_test
)