Add core errors and conditions

This commit is contained in:
Vinnie Falco
2018-12-30 12:51:34 -08:00
parent 25f144f936
commit 2d3912751b
7 changed files with 246 additions and 1 deletions
+44
View File
@@ -9,3 +9,47 @@
// Test that header file is self-contained.
#include <boost/beast/core/error.hpp>
#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);
}
};
BEAST_DEFINE_TESTSUITE(beast,websocket,error);
} // beast
} // boost