// // Copyright (c) 2021 Kasper Laudrup (laudrup at stacktrace dot dk) // // 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) // #ifndef BOOST_WINTLS_UNITTEST_HPP #define BOOST_WINTLS_UNITTEST_HPP #include // Workaround missing include in boost 1.76 and 1.77 in beast::test::stream #if (BOOST_VERSION / 100 % 1000) == 77 || (BOOST_VERSION / 100 % 1000) == 76 #include #endif #include #include #include #include #include #include #include namespace Catch { template<> struct StringMaker { static std::string convert(const boost::system::error_code& ec) { std::ostringstream oss; oss << ec.message() << " (0x" << std::hex << ec.value() << ")"; return oss.str(); } }; } inline std::vector bytes_from_file(const std::string& path) { std::ifstream ifs{path}; if (ifs.fail()) { throw std::runtime_error("Failed to open file " + path); } return {std::istreambuf_iterator{ifs}, {}}; } namespace net = boost::wintls::net; namespace asio_ssl = boost::asio::ssl; using test_stream = boost::beast::test::stream; #endif // BOOST_WINTLS_UNITTEST_HPP