2
0
mirror of https://github.com/boostorg/mysql.git synced 2026-02-14 00:42:53 +00:00

Recovered full netfuns coverage

This commit is contained in:
Ruben Perez
2022-10-16 23:32:28 +02:00
parent af339d03b6
commit c9bd127f94
20 changed files with 174 additions and 140 deletions

View File

@@ -25,27 +25,16 @@ using boost::mysql::make_execute_params;
namespace {
auto net_samples = create_network_samples(
{"tcp_sync_errc", "tcp_sync_exc", "tcp_async_callback", "tcp_async_callback_noerrinfo"}
);
auto net_samples = create_network_samples({
"tcp_sync_errc",
"tcp_async_callback",
});
BOOST_AUTO_TEST_SUITE(test_execute_statement)
BOOST_AUTO_TEST_SUITE(iterator)
BOOST_MYSQL_NETWORK_TEST(ok_no_params, network_fixture, net_samples)
{
setup_and_connect(sample.net);
// Prepare
conn->prepare_statement("SELECT * FROM empty_table", *stmt).validate_no_error();
// Execute
std::forward_list<field_view> params;
stmt->execute_params(make_execute_params(params), *result).validate_no_error();
BOOST_TEST(result->base().valid());
}
BOOST_MYSQL_NETWORK_TEST(ok_with_params, network_fixture, net_samples)
BOOST_MYSQL_NETWORK_TEST(success, network_fixture, all_network_samples())
{
setup_and_connect(sample.net);
@@ -59,6 +48,7 @@ BOOST_MYSQL_NETWORK_TEST(ok_with_params, network_fixture, net_samples)
BOOST_TEST(result->base().valid());
}
// TODO: this should be a unit test
BOOST_MYSQL_NETWORK_TEST(mismatched_num_params, network_fixture, net_samples)
{
setup_and_connect(sample.net);
@@ -73,7 +63,7 @@ BOOST_MYSQL_NETWORK_TEST(mismatched_num_params, network_fixture, net_samples)
.validate_error(errc::wrong_num_params, {"param", "2", "1", "statement", "execute"});
}
BOOST_MYSQL_NETWORK_TEST(server_error, network_fixture, net_samples)
BOOST_MYSQL_NETWORK_TEST(server_error, network_fixture, all_network_samples())
{
setup_and_connect(sample.net);
start_transaction();
@@ -98,7 +88,7 @@ BOOST_AUTO_TEST_SUITE_END()
// collection is a wrapper around execute_params, so only
// a subset of tests are run here
BOOST_AUTO_TEST_SUITE(collection)
BOOST_MYSQL_NETWORK_TEST(ok, network_fixture, net_samples)
BOOST_MYSQL_NETWORK_TEST(ok, network_fixture, all_network_samples())
{
setup_and_connect(sample.net);
@@ -111,7 +101,7 @@ BOOST_MYSQL_NETWORK_TEST(ok, network_fixture, net_samples)
BOOST_TEST(result->base().valid());
}
BOOST_MYSQL_NETWORK_TEST(error, network_fixture, net_samples)
BOOST_MYSQL_NETWORK_TEST(error, network_fixture, all_network_samples())
{
setup_and_connect(sample.net);
start_transaction();
@@ -131,7 +121,7 @@ BOOST_MYSQL_NETWORK_TEST(error, network_fixture, net_samples)
);
}
// Other containers. We can't use the type-erased functions here
// Other containers
BOOST_FIXTURE_TEST_CASE(no_statement_params_variable, tcp_network_fixture)
{
boost::mysql::tcp_statement stmt;