8 #include <boost/test/unit_test.hpp> 17 BOOST_AUTO_TEST_SUITE(util_expected_tests)
49 const auto moved{std::move(no_copy).
value()};
56 const auto moved{*std::move(no_copy)};
63 const int one{*std::move(no_copy).
value_or(std::make_unique<int>(2))};
83 [&]() ->
void {
return e.value(); }();
84 [&]() ->
void {
return *e; }();
102 const auto moved{std::move(nocopy_err).
error()};
107 const auto moved{std::move(void_nocopy_err).
error()};
121 const auto moved{std::move(u).error()};
#define BOOST_CHECK_THROW(stmt, excMatch)
constexpr const T & value() const &LIFETIMEBOUND
BOOST_AUTO_TEST_CASE(expected_value)
The util::Unexpected class represents an unexpected value stored in util::Expected.
BOOST_AUTO_TEST_SUITE_END()
constexpr const E & error() const &noexcept LIFETIMEBOUND
The util::Expected class provides a standard way for low-level functions to return either error value...
#define BOOST_CHECK_EQUAL(v1, v2)
constexpr void swap(Expected &other) noexcept
T value_or(U &&default_value) const &
#define BOOST_CHECK(expr)