2
0
mirror of https://github.com/boostorg/mysql.git synced 2026-02-14 12:52:17 +00:00
Files
mysql/test/unit/connection.cpp
2020-06-18 22:54:01 +01:00

44 lines
1.3 KiB
C++

//
// Copyright (c) 2019-2020 Ruben Perez Hidalgo (rubenperez038 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)
//
#include "boost/mysql/connection.hpp"
#include <boost/asio/strand.hpp>
#include <gtest/gtest.h>
namespace
{
using other_executor = boost::asio::strand<boost::asio::io_context::executor_type>;
TEST(ConnectionTest, RebindExecutor_Trivial_ReturnsCorrectType)
{
using original_type = boost::mysql::connection<boost::asio::ip::tcp::socket>;
using rebound_type = original_type::rebind_executor<other_executor>::other;
using expected_type = boost::mysql::connection<
boost::asio::basic_stream_socket<
boost::asio::ip::tcp,
other_executor
>
>;
EXPECT_TRUE((std::is_same<rebound_type, expected_type>::value));
}
TEST(SocketConnectionTest, RebindExecutor_Trivial_ReturnsCorrectType)
{
using rebound_type = boost::mysql::tcp_connection::rebind_executor<other_executor>::other;
using expected_type = boost::mysql::socket_connection<
boost::asio::basic_stream_socket<
boost::asio::ip::tcp,
other_executor
>
>;
EXPECT_TRUE((std::is_same<rebound_type, expected_type>::value));
}
}