summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test-e2e.cpp16
-rw-r--r--test/test-misc.cpp24
-rw-r--r--test/testdb-mysql.cpp3
3 files changed, 22 insertions, 21 deletions
diff --git a/test/test-e2e.cpp b/test/test-e2e.cpp
index 768f7c9..8d9afb9 100644
--- a/test/test-e2e.cpp
+++ b/test/test-e2e.cpp
@@ -227,38 +227,38 @@ TEST_TYPE(MYSQL_TYPE_ENUM, std::string_view, std::string_view, enum('alpha', 'be
}
TEST_TYPE(MYSQL_TYPE_TINY, int8_t, int8_t, tinyint)
{
- return (int8_t)n;
+ return static_cast<int8_t>(n);
}
TEST_TYPE(MYSQL_TYPE_SHORT, int16_t, int16_t, smallint)
{
- return (int16_t)n;
+ return static_cast<int16_t>(n);
}
TEST_TYPE(MYSQL_TYPE_INT24, int32_t, int32_t, int)
{
- return (int32_t)n;
+ return static_cast<int32_t>(n);
}
TEST_TYPE(MYSQL_TYPE_YEAR, int16_t, int16_t, year)
{
if (!n) {
return 0;
}
- return (int16_t)n + 1901;
+ return static_cast<int16_t>(n + 1901);
}
TEST_TYPE(MYSQL_TYPE_LONG, int32_t, int32_t, int)
{
- return (int32_t)n;
+ return static_cast<int32_t>(n);
}
TEST_TYPE(MYSQL_TYPE_LONGLONG, int64_t, int64_t, bigint)
{
- return (int64_t)n;
+ return static_cast<int64_t>(n);
}
TEST_TYPE(MYSQL_TYPE_FLOAT, float, float, float)
{
- return (float)n;
+ return static_cast<float>(n);
}
TEST_TYPE(MYSQL_TYPE_DOUBLE, double, double, real)
{
- return (double)n;
+ return static_cast<double>(n);
}
static struct tm
test_tm(size_t n)
diff --git a/test/test-misc.cpp b/test/test-misc.cpp
index aef2694..b4eeb41 100644
--- a/test/test-misc.cpp
+++ b/test/test-misc.cpp
@@ -71,8 +71,8 @@ BOOST_AUTO_TEST_CASE(DbValueConvStrViewToStringView)
{
using namespace std::literals;
MyGrate::DbValue v {"str"};
- BOOST_CHECK_EQUAL((std::string_view)v, "str"sv);
- BOOST_CHECK_EQUAL((std::string)v, "str"s);
+ BOOST_CHECK_EQUAL(static_cast<std::string_view>(v), "str"sv);
+ BOOST_CHECK_EQUAL(static_cast<std::string>(v), "str"s);
}
static_assert(MyGrate::detail::HasToString<int>);
@@ -82,14 +82,14 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(DbValueConvIntToString, I, Ints)
{
using namespace std::literals;
MyGrate::DbValue v {I {123}};
- BOOST_CHECK_EQUAL((std::string)v, "123"s);
+ BOOST_CHECK_EQUAL(static_cast<std::string>(v), "123"s);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(DbValueConvFloatToString, F, Floats)
{
using namespace std::literals;
MyGrate::DbValue v {F {123}};
- BOOST_CHECK_EQUAL((std::string)v, "123.000000"s);
+ BOOST_CHECK_EQUAL(static_cast<std::string>(v), "123.000000"s);
}
BOOST_AUTO_TEST_CASE(create_datetime)
@@ -106,14 +106,14 @@ BOOST_AUTO_TEST_CASE(create_datetime)
BOOST_AUTO_TEST_CASE(mod100_extract)
{
long unsigned int i {1629222289};
- BOOST_CHECK_EQUAL((int)MyGrate::mod100_extract(i), 89);
- BOOST_CHECK_EQUAL((int)MyGrate::mod100_extract(i), 22);
- BOOST_CHECK_EQUAL((int)MyGrate::mod100_extract(i), 22);
- BOOST_CHECK_EQUAL((int)MyGrate::mod100_extract(i), 29);
- BOOST_CHECK_EQUAL((int)MyGrate::mod100_extract(i), 16);
- BOOST_CHECK_EQUAL((int)MyGrate::mod100_extract(i), 0);
- BOOST_CHECK_EQUAL((int)MyGrate::mod100_extract(i), 0);
- BOOST_CHECK_EQUAL((int)MyGrate::mod100_extract(i), 0);
+ BOOST_CHECK_EQUAL(MyGrate::mod100_extract(i), 89);
+ BOOST_CHECK_EQUAL(MyGrate::mod100_extract(i), 22);
+ BOOST_CHECK_EQUAL(MyGrate::mod100_extract(i), 22);
+ BOOST_CHECK_EQUAL(MyGrate::mod100_extract(i), 29);
+ BOOST_CHECK_EQUAL(MyGrate::mod100_extract(i), 16);
+ BOOST_CHECK_EQUAL(MyGrate::mod100_extract(i), 0);
+ BOOST_CHECK_EQUAL(MyGrate::mod100_extract(i), 0);
+ BOOST_CHECK_EQUAL(MyGrate::mod100_extract(i), 0);
}
using ConvertTimeData = std::tuple<uint32_t, MyGrate::Time>;
diff --git a/test/testdb-mysql.cpp b/test/testdb-mysql.cpp
index 24e41c0..a2c8885 100644
--- a/test/testdb-mysql.cpp
+++ b/test/testdb-mysql.cpp
@@ -8,7 +8,8 @@ namespace MyGrate::Testing {
const char * const MySQLDB::SERVER {MyGrate::getenv("MYGRATE_MYSQL_SERVER", "localhost")};
const char * const MySQLDB::USER {MyGrate::getenv("MYGRATE_MYSQL_USER", ::getenv("LOGNAME"))};
const char * const MySQLDB::PASSWORD {::getenv("MYGRATE_MYSQL_PASSWORD")};
- const unsigned short MySQLDB::PORT {(unsigned short)std::atoi(MyGrate::getenv("MYGRATE_MYSQL_PORT", "3306"))};
+ const unsigned short MySQLDB::PORT {
+ static_cast<unsigned short>(std::atoi(MyGrate::getenv("MYGRATE_MYSQL_PORT", "3306")))};
std::size_t MySQLDB::mocknum;
MySQLDB::MySQLDB() :