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

Completed serializ tests for ComStmtExecute

Now serialization tests provide better diagnostics
This commit is contained in:
ruben
2020-01-30 15:16:53 +00:00
parent 59adbf8d89
commit 0345991059
5 changed files with 171 additions and 33 deletions

View File

@@ -649,23 +649,128 @@ INSTANTIATE_TEST_SUITE_P(ComStmtExecute, SerializeTest, testing::Values(
0xab, 0x00
},
"uint32_t"
),
make_stmt_execute_test(1, 0, 1, 1, // stmt ID, flags, itercount, new params
{ std::int32_t(-0xabffff) }, {
0x17, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x01, 0x00,
0x54, 0xff
},
"int32_t"
),
make_stmt_execute_test(1, 0x80, 1, 1, // stmt ID, flags, itercount, new params
{ std::uint64_t(0xabffffabacadae) }, {
0x17, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
0x00, 0x00, 0x00, 0x01, 0x08, 0x80, 0xae, 0xad,
0xac, 0xab, 0xff, 0xff, 0xab, 0x00
},
"uint64_t"
),
make_stmt_execute_test(1, 0, 1, 1, // stmt ID, flags, itercount, new params
{ std::int64_t(-0xabffffabacadae) }, {
0x17, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x52, 0x52,
0x53, 0x54, 0x00, 0x00, 0x54, 0xff
},
"int64_t"
),
make_stmt_execute_test(1, 0, 1, 1, // stmt ID, flags, itercount, new params
{ std::string_view("test") }, {
0x17, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x01, 0x0f, 0x00, 0x04, 0x74,
0x65, 0x73, 0x74
},
"string_view"
),
make_stmt_execute_test(1, 0, 1, 1, // stmt ID, flags, itercount, new params
{ 3.14e20f }, {
0x17, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x01, 0x2d,
0x88, 0x61
},
"float"
),
make_stmt_execute_test(1, 0, 1, 1, // stmt ID, flags, itercount, new params
{ 2.1e214 }, {
0x17, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x01, 0x05, 0x00, 0x56, 0xc0,
0xee, 0xa6, 0x95, 0x30, 0x6f, 0x6c
},
"double"
),
make_stmt_execute_test(1, 0, 1, 1, // stmt ID, flags, itercount, new params
{ makedate(2010, 9, 3) }, {
0x17, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x04, 0xda,
0x07, 0x09, 0x03
},
"date"
),
make_stmt_execute_test(1, 0, 1, 1, // stmt ID, flags, itercount, new params
{ makedt(2010, 9, 3, 10, 30, 59, 231800) }, {
0x17, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x01, 0x0c, 0x00, 0x0b, 0xda,
0x07, 0x09, 0x03, 0x0a, 0x1e, 0x3b, 0x78, 0x89,
0x03, 0x00
},
"datetime"
),
make_stmt_execute_test(1, 0, 1, 1, // stmt ID, flags, itercount, new params
{ maket(230, 30, 59, 231800) }, {
0x17, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x01, 0x0b, 0x00, 0x0c, 0x00,
0x09, 0x00, 0x00, 0x00, 0x0e, 0x1e, 0x3b, 0x78,
0x89, 0x03, 0x00
},
"time"
),
make_stmt_execute_test(1, 0, 1, 1, // stmt ID, flags, itercount, new params
{ mysql::year(2010) }, {
0x17, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x01, 0x02, 0x80, 0xda, 0x07
},
"year"
),
make_stmt_execute_test(1, 0, 1, 1, // stmt ID, flags, itercount, new params
{ nullptr }, {
0x17, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x01, 0x06, 0x00
},
"null"
),
make_stmt_execute_test(2, 0, 1, 1, makevalues(
std::uint32_t(0xabffff),
std::int32_t(-0xabffff),
std::uint64_t(0xabffffabacadae),
std::int64_t(-0xabffffabacadae),
std::string_view("test"),
nullptr,
2.1e214,
mysql::year(2010),
makedate(2010, 9, 3),
makedt(2010, 9, 3, 10, 30, 59, 231800),
maket(230, 30, 59, 231800),
nullptr,
mysql::year(2010)
), {
0x17, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x20, 0x08, 0x01, 0x03, 0x80, 0x03,
0x00, 0x08, 0x80, 0x08, 0x00, 0x0f, 0x00, 0x06,
0x00, 0x05, 0x00, 0x02, 0x80, 0x0a, 0x00, 0x0c,
0x00, 0x0b, 0x00, 0x06, 0x00, 0x02, 0x80, 0xff,
0xff, 0xab, 0x00, 0x01, 0x00, 0x54, 0xff, 0xae,
0xad, 0xac, 0xab, 0xff, 0xff, 0xab, 0x00, 0x52,
0x52, 0x53, 0x54, 0x00, 0x00, 0x54, 0xff, 0x04,
0x74, 0x65, 0x73, 0x74, 0x56, 0xc0, 0xee, 0xa6,
0x95, 0x30, 0x6f, 0x6c, 0xda, 0x07, 0x04, 0xda,
0x07, 0x09, 0x03, 0x0b, 0xda, 0x07, 0x09, 0x03,
0x0a, 0x1e, 0x3b, 0x78, 0x89, 0x03, 0x00, 0x0c,
0x00, 0x09, 0x00, 0x00, 0x00, 0x0e, 0x1e, 0x3b,
0x78, 0x89, 0x03, 0x00, 0xda, 0x07
},
"several_params"
)
));
/*
* std::int32_t, // signed TINYINT, SMALLINT, MEDIUMINT, INT
std::int64_t, // signed BIGINT
std::uint32_t, // unsigned TINYINT, SMALLINT, MEDIUMINT, INT
std::uint64_t, // unsigned BIGINT
std::string_view, // CHAR, VARCHAR, BINARY, VARBINARY, TEXT (all sizes), BLOB (all sizes), ENUM, SET, DECIMAL, BIT, GEOMTRY
float, // FLOAT
double, // DOUBLE
date, // DATE
datetime, // DATETIME, TIMESTAMP
time, // TIME
year, // YEAR
std::nullptr_t // Any of the above when the value is NULL
*/
} // anon namespace