]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/asio/test/execution/operation_state.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / asio / test / execution / operation_state.cpp
CommitLineData
20effc67
TL
1//
2// operation_state.cpp
3// ~~~~~~~~~~~~~~~~~~~
4//
1e59de90 5// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
20effc67
TL
6//
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)
9//
10
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)
15
16// Test that header file is self-contained.
17#include <boost/asio/execution/operation_state.hpp>
18
19#include <string>
20#include <boost/system/error_code.hpp>
21#include "../unit_test.hpp"
22
23struct not_an_operation_state_1
24{
25};
26
27struct not_an_operation_state_2
28{
29 void start()
30 {
31 }
32};
33
34namespace boost {
35namespace asio {
36namespace traits {
37
38#if !defined(BOOST_ASIO_HAS_DEDUCED_START_MEMBER_TRAIT)
39
40template <>
41struct start_member<not_an_operation_state_2>
42{
43 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
44 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
45 typedef void result_type;
46};
47
48#endif // !defined(BOOST_ASIO_HAS_DEDUCED_START_MEMBER_TRAIT)
49
50} // namespace traits
51} // namespace asio
52} // namespace boost
53
54struct operation_state
55{
56 void start() BOOST_ASIO_NOEXCEPT
57 {
58 }
59};
60
61namespace boost {
62namespace asio {
63namespace traits {
64
65#if !defined(BOOST_ASIO_HAS_DEDUCED_START_MEMBER_TRAIT)
66
67template <>
68struct start_member<operation_state>
69{
70 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
71 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
72 typedef void result_type;
73};
74
75#endif // !defined(BOOST_ASIO_HAS_DEDUCED_START_MEMBER_TRAIT)
76
77} // namespace traits
78} // namespace asio
79} // namespace boost
80
81void is_operation_state_test()
82{
83 BOOST_ASIO_CHECK((
84 !boost::asio::execution::is_operation_state<
85 void
86 >::value));
87
88 BOOST_ASIO_CHECK((
89 !boost::asio::execution::is_operation_state<
90 not_an_operation_state_1
91 >::value));
92
93 BOOST_ASIO_CHECK((
94 !boost::asio::execution::is_operation_state<
95 not_an_operation_state_2
96 >::value));
97
98 BOOST_ASIO_CHECK((
99 boost::asio::execution::is_operation_state<
100 operation_state
101 >::value));
102}
103
104BOOST_ASIO_TEST_SUITE
105(
106 "operation_state",
107 BOOST_ASIO_TEST_CASE(is_operation_state_test)
108)