2
0
mirror of https://github.com/boostorg/cobalt.git synced 2026-01-19 16:12:15 +00:00
Files
cobalt/test/run.cpp
Klemens Morgenstern a0ca8a497f switched to boost.test
2023-10-19 01:57:50 +08:00

26 lines
700 B
C++

// Copyright (c) 2022 Klemens D. Morgenstern
//
// 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)
#include <boost/cobalt/run.hpp>
#include <boost/test/unit_test.hpp>
using namespace boost;
BOOST_AUTO_TEST_SUITE(run);
BOOST_AUTO_TEST_CASE(run)
{
BOOST_CHECK(42 == cobalt::run([]() -> cobalt::task<int> {co_return 42;}()));
asio::io_context ctx;
cobalt::this_thread::set_executor(ctx.get_executor());
BOOST_CHECK(42 == cobalt::run([]() -> cobalt::task<int> {co_return 42;}()));
BOOST_CHECK(ctx.get_executor() == cobalt::this_thread::get_executor());
}
BOOST_AUTO_TEST_SUITE_END();