]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/beast/test/beast/core/error.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / beast / test / beast / core / error.cpp
index b41fd52dea6e61b2ccc2a899fa94c0ee1f53e875..40d9de9f3781bd52dc563636950709abddff51f4 100644 (file)
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
+// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
 //
 // 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)
@@ -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,core,error);
+
+} // beast
+} // boost