8#include <boost/test/unit_test.hpp>
17BOOST_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()};
The util::Expected class provides a standard way for low-level functions to return either error value...
T value_or(U &&default_value) const &
constexpr const T & value() const &LIFETIMEBOUND
constexpr void swap(Expected &other) noexcept
The util::Unexpected class represents an unexpected value stored in util::Expected.
constexpr const E & error() const &noexcept LIFETIMEBOUND
BOOST_AUTO_TEST_SUITE_END()
#define BOOST_CHECK_THROW(stmt, excMatch)
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
BOOST_AUTO_TEST_CASE(expected_value)