diff options
Diffstat (limited to '3rdparty/asio/src/tests/unit/execution/outstanding_work.cpp')
-rw-r--r-- | 3rdparty/asio/src/tests/unit/execution/outstanding_work.cpp | 146 |
1 files changed, 74 insertions, 72 deletions
diff --git a/3rdparty/asio/src/tests/unit/execution/outstanding_work.cpp b/3rdparty/asio/src/tests/unit/execution/outstanding_work.cpp index 3546a6b1d6a..cddd0b52c23 100644 --- a/3rdparty/asio/src/tests/unit/execution/outstanding_work.cpp +++ b/3rdparty/asio/src/tests/unit/execution/outstanding_work.cpp @@ -2,7 +2,7 @@ // outstanding_work.cpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -34,12 +34,12 @@ struct ex_nq_nr { } - friend bool operator==(const ex_nq_nr&, const ex_nq_nr&) ASIO_NOEXCEPT + friend bool operator==(const ex_nq_nr&, const ex_nq_nr&) noexcept { return true; } - friend bool operator!=(const ex_nq_nr&, const ex_nq_nr&) ASIO_NOEXCEPT + friend bool operator!=(const ex_nq_nr&, const ex_nq_nr&) noexcept { return false; } @@ -63,7 +63,7 @@ struct is_executor<ex_nq_nr> : asio::true_type template <typename ResultType, typename ParamType, typename Result> struct ex_cq_nr { - static ASIO_CONSTEXPR ResultType query(ParamType) ASIO_NOEXCEPT + static constexpr ResultType query(ParamType) noexcept { return Result(); } @@ -73,12 +73,12 @@ struct ex_cq_nr { } - friend bool operator==(const ex_cq_nr&, const ex_cq_nr&) ASIO_NOEXCEPT + friend bool operator==(const ex_cq_nr&, const ex_cq_nr&) noexcept { return true; } - friend bool operator!=(const ex_cq_nr&, const ex_cq_nr&) ASIO_NOEXCEPT + friend bool operator!=(const ex_cq_nr&, const ex_cq_nr&) noexcept { return false; } @@ -113,12 +113,12 @@ struct query_static_constexpr_member< asio::is_convertible<Param, ParamType>::value >::type> { - ASIO_STATIC_CONSTEXPR(bool, is_valid = true); - ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true); + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; typedef Result result_type; // Must return raw result type. - static ASIO_CONSTEXPR result_type value() + static constexpr result_type value() { return Result(); } @@ -132,7 +132,7 @@ struct query_static_constexpr_member< template <typename ResultType, typename ParamType, typename Result> struct ex_mq_nr { - ResultType query(ParamType) const ASIO_NOEXCEPT + ResultType query(ParamType) const noexcept { return Result(); } @@ -142,12 +142,12 @@ struct ex_mq_nr { } - friend bool operator==(const ex_mq_nr&, const ex_mq_nr&) ASIO_NOEXCEPT + friend bool operator==(const ex_mq_nr&, const ex_mq_nr&) noexcept { return true; } - friend bool operator!=(const ex_mq_nr&, const ex_mq_nr&) ASIO_NOEXCEPT + friend bool operator!=(const ex_mq_nr&, const ex_mq_nr&) noexcept { return false; } @@ -182,8 +182,8 @@ struct query_member< asio::is_convertible<Param, ParamType>::value >::type> { - ASIO_STATIC_CONSTEXPR(bool, is_valid = true); - ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true); + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; typedef ResultType result_type; }; @@ -196,7 +196,7 @@ struct query_member< template <typename ResultType, typename ParamType, typename Result> struct ex_fq_nr { - friend ResultType query(const ex_fq_nr&, ParamType) ASIO_NOEXCEPT + friend ResultType query(const ex_fq_nr&, ParamType) noexcept { return Result(); } @@ -206,12 +206,12 @@ struct ex_fq_nr { } - friend bool operator==(const ex_fq_nr&, const ex_fq_nr&) ASIO_NOEXCEPT + friend bool operator==(const ex_fq_nr&, const ex_fq_nr&) noexcept { return true; } - friend bool operator!=(const ex_fq_nr&, const ex_fq_nr&) ASIO_NOEXCEPT + friend bool operator!=(const ex_fq_nr&, const ex_fq_nr&) noexcept { return false; } @@ -246,8 +246,8 @@ struct query_free< asio::is_convertible<Param, ParamType>::value >::type> { - ASIO_STATIC_CONSTEXPR(bool, is_valid = true); - ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true); + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; typedef ResultType result_type; }; @@ -260,24 +260,24 @@ struct query_free< template <typename CurrentType, typename OtherType> struct ex_mq_mr { - CurrentType query(CurrentType) const ASIO_NOEXCEPT + CurrentType query(CurrentType) const noexcept { return CurrentType(); } - CurrentType query(OtherType) const ASIO_NOEXCEPT + CurrentType query(OtherType) const noexcept { return CurrentType(); } ex_mq_mr<CurrentType, OtherType> require( - CurrentType) const ASIO_NOEXCEPT + CurrentType) const noexcept { return ex_mq_mr<CurrentType, OtherType>(); } ex_mq_mr<OtherType, CurrentType> require( - OtherType) const ASIO_NOEXCEPT + OtherType) const noexcept { return ex_mq_mr<OtherType, CurrentType>(); } @@ -287,12 +287,12 @@ struct ex_mq_mr { } - friend bool operator==(const ex_mq_mr&, const ex_mq_mr&) ASIO_NOEXCEPT + friend bool operator==(const ex_mq_mr&, const ex_mq_mr&) noexcept { return true; } - friend bool operator!=(const ex_mq_mr&, const ex_mq_mr&) ASIO_NOEXCEPT + friend bool operator!=(const ex_mq_mr&, const ex_mq_mr&) noexcept { return false; } @@ -301,13 +301,13 @@ struct ex_mq_mr template <typename CurrentType> struct ex_mq_mr<CurrentType, CurrentType> { - CurrentType query(CurrentType) const ASIO_NOEXCEPT + CurrentType query(CurrentType) const noexcept { return CurrentType(); } ex_mq_mr<CurrentType, CurrentType> require( - CurrentType) const ASIO_NOEXCEPT + CurrentType) const noexcept { return ex_mq_mr<CurrentType, CurrentType>(); } @@ -317,12 +317,12 @@ struct ex_mq_mr<CurrentType, CurrentType> { } - friend bool operator==(const ex_mq_mr&, const ex_mq_mr&) ASIO_NOEXCEPT + friend bool operator==(const ex_mq_mr&, const ex_mq_mr&) noexcept { return true; } - friend bool operator!=(const ex_mq_mr&, const ex_mq_mr&) ASIO_NOEXCEPT + friend bool operator!=(const ex_mq_mr&, const ex_mq_mr&) noexcept { return false; } @@ -357,8 +357,8 @@ struct query_member< || asio::is_convertible<Param, OtherType>::value >::type> { - ASIO_STATIC_CONSTEXPR(bool, is_valid = true); - ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true); + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; typedef CurrentType result_type; }; @@ -374,8 +374,8 @@ struct require_member< asio::is_convertible<Param, CurrentType>::value >::type> { - ASIO_STATIC_CONSTEXPR(bool, is_valid = true); - ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true); + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; typedef ex_mq_mr<CurrentType, OtherType> result_type; }; @@ -388,8 +388,8 @@ struct require_member< && !asio::is_same<CurrentType, OtherType>::value >::type> { - ASIO_STATIC_CONSTEXPR(bool, is_valid = true); - ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true); + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; typedef ex_mq_mr<OtherType, CurrentType> result_type; }; @@ -402,36 +402,36 @@ struct require_member< template <typename CurrentType, typename OtherType> struct ex_fq_fr { - friend CurrentType query(const ex_fq_fr&, CurrentType) ASIO_NOEXCEPT + friend CurrentType query(const ex_fq_fr&, CurrentType) noexcept { return CurrentType(); } - friend CurrentType query(const ex_fq_fr&, OtherType) ASIO_NOEXCEPT + friend CurrentType query(const ex_fq_fr&, OtherType) noexcept { return CurrentType(); } friend ex_fq_fr<CurrentType, OtherType> require( - const ex_fq_fr&, CurrentType) ASIO_NOEXCEPT + const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, OtherType>(); } friend ex_fq_fr<OtherType, CurrentType> require( - const ex_fq_fr&, OtherType) ASIO_NOEXCEPT + const ex_fq_fr&, OtherType) noexcept { return ex_fq_fr<OtherType, CurrentType>(); } friend ex_fq_fr<CurrentType, OtherType> prefer( - const ex_fq_fr&, CurrentType) ASIO_NOEXCEPT + const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, OtherType>(); } friend ex_fq_fr<OtherType, CurrentType> prefer( - const ex_fq_fr&, OtherType) ASIO_NOEXCEPT + const ex_fq_fr&, OtherType) noexcept { return ex_fq_fr<OtherType, CurrentType>(); } @@ -441,12 +441,12 @@ struct ex_fq_fr { } - friend bool operator==(const ex_fq_fr&, const ex_fq_fr&) ASIO_NOEXCEPT + friend bool operator==(const ex_fq_fr&, const ex_fq_fr&) noexcept { return true; } - friend bool operator!=(const ex_fq_fr&, const ex_fq_fr&) ASIO_NOEXCEPT + friend bool operator!=(const ex_fq_fr&, const ex_fq_fr&) noexcept { return false; } @@ -455,19 +455,19 @@ struct ex_fq_fr template <typename CurrentType> struct ex_fq_fr<CurrentType, CurrentType> { - friend CurrentType query(const ex_fq_fr&, CurrentType) ASIO_NOEXCEPT + friend CurrentType query(const ex_fq_fr&, CurrentType) noexcept { return CurrentType(); } friend ex_fq_fr<CurrentType, CurrentType> require( - const ex_fq_fr&, CurrentType) ASIO_NOEXCEPT + const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, CurrentType>(); } friend ex_fq_fr<CurrentType, CurrentType> prefer( - const ex_fq_fr&, CurrentType) ASIO_NOEXCEPT + const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, CurrentType>(); } @@ -477,12 +477,12 @@ struct ex_fq_fr<CurrentType, CurrentType> { } - friend bool operator==(const ex_fq_fr&, const ex_fq_fr&) ASIO_NOEXCEPT + friend bool operator==(const ex_fq_fr&, const ex_fq_fr&) noexcept { return true; } - friend bool operator!=(const ex_fq_fr&, const ex_fq_fr&) ASIO_NOEXCEPT + friend bool operator!=(const ex_fq_fr&, const ex_fq_fr&) noexcept { return false; } @@ -517,8 +517,8 @@ struct query_free< || asio::is_convertible<Param, OtherType>::value >::type> { - ASIO_STATIC_CONSTEXPR(bool, is_valid = true); - ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true); + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; typedef CurrentType result_type; }; @@ -534,8 +534,8 @@ struct require_free< asio::is_convertible<Param, CurrentType>::value >::type> { - ASIO_STATIC_CONSTEXPR(bool, is_valid = true); - ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true); + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; typedef ex_fq_fr<CurrentType, OtherType> result_type; }; @@ -548,8 +548,8 @@ struct require_free< && !asio::is_same<CurrentType, OtherType>::value >::type> { - ASIO_STATIC_CONSTEXPR(bool, is_valid = true); - ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true); + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; typedef ex_fq_fr<OtherType, CurrentType> result_type; }; @@ -565,8 +565,8 @@ struct prefer_free< asio::is_convertible<Param, CurrentType>::value >::type> { - ASIO_STATIC_CONSTEXPR(bool, is_valid = true); - ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true); + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; typedef ex_fq_fr<CurrentType, OtherType> result_type; }; @@ -579,8 +579,8 @@ struct prefer_free< && !asio::is_same<CurrentType, OtherType>::value >::type> { - ASIO_STATIC_CONSTEXPR(bool, is_valid = true); - ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true); + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; typedef ex_fq_fr<OtherType, CurrentType> result_type; }; @@ -593,19 +593,19 @@ struct prefer_free< template <typename Executor, typename Param, bool ExpectedResult> void test_can_query() { - ASIO_CONSTEXPR bool b1 = + constexpr bool b1 = asio::can_query<Executor, Param>::value; ASIO_CHECK(b1 == ExpectedResult); - ASIO_CONSTEXPR bool b2 = + constexpr bool b2 = asio::can_query<const Executor, Param>::value; ASIO_CHECK(b2 == ExpectedResult); - ASIO_CONSTEXPR bool b3 = + constexpr bool b3 = asio::can_query<Executor&, Param>::value; ASIO_CHECK(b3 == ExpectedResult); - ASIO_CONSTEXPR bool b4 = + constexpr bool b4 = asio::can_query<const Executor&, Param>::value; ASIO_CHECK(b4 == ExpectedResult); } @@ -628,29 +628,27 @@ void test_query() template <typename Executor, typename Param, typename ExpectedResult> void test_constexpr_query() { -#if defined(ASIO_HAS_CONSTEXPR) constexpr Executor ex1 = {}; constexpr exec::outstanding_work_t result1 = asio::query(ex1, Param()); ASIO_CHECK(result1 == ExpectedResult()); -#endif // defined(ASIO_HAS_CONSTEXPR) } template <typename Executor, typename Param, bool ExpectedResult> void test_can_require() { - ASIO_CONSTEXPR bool b1 = + constexpr bool b1 = asio::can_require<Executor, Param>::value; ASIO_CHECK(b1 == ExpectedResult); - ASIO_CONSTEXPR bool b2 = + constexpr bool b2 = asio::can_require<const Executor, Param>::value; ASIO_CHECK(b2 == ExpectedResult); - ASIO_CONSTEXPR bool b3 = + constexpr bool b3 = asio::can_require<Executor&, Param>::value; ASIO_CHECK(b3 == ExpectedResult); - ASIO_CONSTEXPR bool b4 = + constexpr bool b4 = asio::can_require<const Executor&, Param>::value; ASIO_CHECK(b4 == ExpectedResult); } @@ -679,19 +677,19 @@ void test_require() template <typename Executor, typename Param, bool ExpectedResult> void test_can_prefer() { - ASIO_CONSTEXPR bool b1 = + constexpr bool b1 = asio::can_prefer<Executor, Param>::value; ASIO_CHECK(b1 == ExpectedResult); - ASIO_CONSTEXPR bool b2 = + constexpr bool b2 = asio::can_prefer<const Executor, Param>::value; ASIO_CHECK(b2 == ExpectedResult); - ASIO_CONSTEXPR bool b3 = + constexpr bool b3 = asio::can_prefer<Executor&, Param>::value; ASIO_CHECK(b3 == ExpectedResult); - ASIO_CONSTEXPR bool b4 = + constexpr bool b4 = asio::can_prefer<const Executor&, Param>::value; ASIO_CHECK(b4 == ExpectedResult); } @@ -720,8 +718,12 @@ void test_prefer() void test_vars() { ASIO_CHECK(s() == exec::outstanding_work); + ASIO_CHECK(s() != exec::outstanding_work.untracked); + ASIO_CHECK(s() != exec::outstanding_work.tracked); ASIO_CHECK(n1() == exec::outstanding_work.untracked); + ASIO_CHECK(n1() != exec::outstanding_work.tracked); ASIO_CHECK(n2() == exec::outstanding_work.tracked); + ASIO_CHECK(n2() != exec::outstanding_work.untracked); } ASIO_TEST_SUITE |