Skip to content

Use boost-ext::ut #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ copyable
pullrequest
snd
statics
mut
nd
4 changes: 2 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ incomplete list of starting points for contributions:
created.
* The [issues page](https://github.com/bemanproject/execution/issues) lists
known issues.
* The implememtation of a component may be missing.
* The implementation of a component may be missing.
* The layout of some pages related to the project can be improved.
* Some behaviour of a component isn't tested or documented.
* Some behavior of a component isn't tested or documented.
* You found something which should be linked from the
[resources](https://github.com/bemanproject/execution/blob/main/docs/contributing.md) page.
* There are [pull requests](https://github.com/bemanproject/execution/pulls)
Expand Down
2 changes: 1 addition & 1 deletion docs/intro-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ synchronously produce the result. The intention is to show a basic
use of some involved components to build up a feeling of how things
work.

The componentes for `std::execution` are declared in the header
The components for `std::execution` are declared in the header
`<execution>`. This particular implementation implements the
cmponents in namespace `beman::execution` declared in the header
`<beman/execution/execution.hpp>`:
Expand Down
2 changes: 1 addition & 1 deletion include/beman/execution/detail/forwarding_query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace beman::execution {
*/
using forwarding_query_t = beman::execution::detail::forwarding_query_t;
/*!
* \brief The customizatoin point object to determine whether queries should be forwarded
* \brief The customization point object to determine whether queries should be forwarded
* \headerfile beman/execution/execution.hpp <beman/execution/execution.hpp>
*
* \details
Expand Down
18 changes: 9 additions & 9 deletions tests/beman/execution/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ list(
exec-starts-on.test
exec-split.test
exec-sync-wait.test
exec-then.test
exec-utils-cmplsigs.test
exec-when-all.test
exec-with-awaitable-senders.test
# exec-then.test
# exec-utils-cmplsigs.test
# exec-when-all.test
# exec-with-awaitable-senders.test
execution-queryable-concept.test
exec-bulk.test
execution-syn.test
Expand All @@ -75,23 +75,23 @@ list(
stopcallback-inplace.test
stopcallback.test
stopsource-cons.test
stopsource-general.test
# stopsource-general.test
stopsource-inplace-cons.test
stopsource-inplace-general.test
# stopsource-inplace-general.test
stopsource-inplace-mem.test
stopsource-inplace.test
stopsource-mem.test
stopsource.test
stoptoken-concepts.test
stoptoken-general.test
# stoptoken-general.test
stoptoken-inplace-general.test
stoptoken-inplace-members.test
stoptoken-inplace.test
stoptoken-mem.test
# stoptoken-mem.test
stoptoken-never-general.test
stoptoken-never.test
stoptoken.test
thread-stoptoken-intro.test
# thread-stoptoken-intro.test
thread-stoptoken-syn.compile.test
thread-stoptoken.test
thread.test
Expand Down
6 changes: 3 additions & 3 deletions tests/beman/execution/exec-split.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void test_completion_sigs_and_sync_wait_on_split() {
static_assert(std::same_as<value_completions, expected_value_completions>);

auto eat_completion = beman::execution::then(split, [&](const NonCopyable&) {});
ASSERT(beman::execution::sync_wait(eat_completion));
ASSERT(beman::execution::sync_wait(eat_completion).has_value());
}

void test_two_sync_waits_on_one_split() {
Expand All @@ -161,8 +161,8 @@ void test_two_sync_waits_on_one_split() {
beman::execution::then(split, [&](const NonCopyable& obj) { pointer = static_cast<const void*>(&obj); });
auto assert_pointer = beman::execution::then(
split, [&](const NonCopyable& obj) { ASSERT(pointer == static_cast<const void*>(&obj)); });
ASSERT(beman::execution::sync_wait(save_pointer));
ASSERT(beman::execution::sync_wait(assert_pointer));
ASSERT(beman::execution::sync_wait(save_pointer).has_value());
ASSERT(beman::execution::sync_wait(assert_pointer).has_value());
}

void test_completion_from_another_thread() {
Expand Down
16 changes: 10 additions & 6 deletions tests/beman/execution/exec-sync-wait.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ auto test_sync_wait_receiver() -> void {
ASSERT(not state.result);
ASSERT(not state.error);
test_std::set_value(test_detail::sync_wait_receiver<local_sender>{&state}, arg<0>{2}, arg<1>{3}, arg<2>{5});
ASSERT(state.result);
ASSERT(state.result.has_value());
ASSERT(not state.error);
ASSERT(*state.result == (std::tuple{arg<0>{2}, arg<1>{3}, arg<2>{5}}));
}
Expand All @@ -156,7 +156,8 @@ auto test_sync_wait_receiver() -> void {
ASSERT(not state.error);
test_std::set_error(test_detail::sync_wait_receiver<local_sender>{&state}, error{17});
ASSERT(not state.result);
ASSERT(state.error);
// FIXME: ASSERT(state.error);
ASSERT(state.error != nullptr);
try {
std::rethrow_exception(state.error);
} catch (const error& e) {
Expand All @@ -173,7 +174,8 @@ auto test_sync_wait_receiver() -> void {
ASSERT(not state.error);
test_std::set_error(test_detail::sync_wait_receiver<local_sender>{&state}, std::make_exception_ptr(error{17}));
ASSERT(not state.result);
ASSERT(state.error);
// FIXME: ASSERT(state.error);
ASSERT(state.error != nullptr);
try {
std::rethrow_exception(state.error);
} catch (const error& e) {
Expand All @@ -197,7 +199,7 @@ auto test_sync_wait_receiver() -> void {
auto test_sync_wait() -> void {
try {
auto value{test_std::sync_wait(test_std::just(arg<0>{7}, arg<1>{11}))};
ASSERT(value);
ASSERT(value.has_value());
ASSERT(*value == (std::tuple{arg<0>{7}, arg<1>{11}}));
} catch (...) {
// NOLINTBEGIN(cert-dcl03-c,hicpp-static-assert,misc-static-assert)
Expand Down Expand Up @@ -228,12 +230,14 @@ auto test_sync_wait() -> void {
}

auto test_provides_scheduler() -> void {
ASSERT(test_std::sync_wait(test_std::then(test_std::read_env(test_std::get_scheduler), [](auto&&) noexcept {})));
ASSERT(test_std::sync_wait(test_std::then(test_std::read_env(test_std::get_scheduler), [](auto&&) noexcept {
})).has_value());
}

auto test_provides_delegation_scheduler() -> void {
ASSERT(test_std::sync_wait(
test_std::then(test_std::read_env(test_std::get_delegation_scheduler), [](auto&&) noexcept {})));
test_std::then(test_std::read_env(test_std::get_delegation_scheduler), [](auto&&) noexcept {}))
.has_value());
}
} // namespace

Expand Down
5 changes: 3 additions & 2 deletions tests/beman/execution/include/test/execution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@

#undef NDEBUG
#include <cassert>
#include "ut.hpp"

#define ASSERT(condition) assert(condition)
#define ASSERT_UNREACHABLE() assert(::test::unreachable_helper())
#define ASSERT(condition) boost::ut::expect(condition)
#define ASSERT_UNREACHABLE() boost::ut::expect(::test::unreachable_helper())
#define TEST(name) auto main() -> int

namespace beman::execution {}
Expand Down
Loading
Loading