2017-07-20 08:01:46 -07:00
|
|
|
//
|
2019-02-21 07:00:31 -08:00
|
|
|
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
2017-07-20 08:01:46 -07:00
|
|
|
//
|
|
|
|
|
// 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)
|
|
|
|
|
//
|
2017-07-20 13:40:34 -07:00
|
|
|
// Official repository: https://github.com/boostorg/beast
|
|
|
|
|
//
|
2017-07-20 08:01:46 -07:00
|
|
|
|
|
|
|
|
// Test that header file is self-contained.
|
2017-07-20 13:40:34 -07:00
|
|
|
#include <boost/beast/core/error.hpp>
|
2018-12-30 12:38:35 -08:00
|
|
|
|
|
|
|
|
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
namespace boost {
|
|
|
|
|
namespace beast {
|
|
|
|
|
|
|
|
|
|
class error_test : public unit_test::suite
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
// no condition
|
|
|
|
|
void check(error e)
|
|
|
|
|
{
|
|
|
|
|
auto const ec = make_error_code(e);
|
|
|
|
|
ec.category().name();
|
|
|
|
|
BEAST_EXPECT(! ec.message().empty());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void check(condition c, error e)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
auto const ec = make_error_code(e);
|
|
|
|
|
BEAST_EXPECT(ec.category().name() != nullptr);
|
|
|
|
|
BEAST_EXPECT(! ec.message().empty());
|
|
|
|
|
BEAST_EXPECT(ec == c);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
auto ec = make_error_condition(c);
|
|
|
|
|
BEAST_EXPECT(ec.category().name() != nullptr);
|
|
|
|
|
BEAST_EXPECT(! ec.message().empty());
|
|
|
|
|
BEAST_EXPECT(ec == c);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void run() override
|
|
|
|
|
{
|
|
|
|
|
check(condition::timeout, error::timeout);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2019-02-19 09:01:45 -08:00
|
|
|
BEAST_DEFINE_TESTSUITE(beast,core,error);
|
2018-12-30 12:38:35 -08:00
|
|
|
|
|
|
|
|
} // beast
|
|
|
|
|
} // boost
|