summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-08-28 21:17:40 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-08-28 21:17:40 +0100
commit13f4fef87d0b8c90385463c3af95e54ec8ad0f4c (patch)
tree068c4d9974878cfe55347e202a2c8a9b8933ef54
parentAdd -Wunused (diff)
downloadmygrate-13f4fef87d0b8c90385463c3af95e54ec8ad0f4c.tar.bz2
mygrate-13f4fef87d0b8c90385463c3af95e54ec8ad0f4c.tar.xz
mygrate-13f4fef87d0b8c90385463c3af95e54ec8ad0f4c.zip
Add -Wsign-conversion
-rw-r--r--Jamroot.jam1
-rw-r--r--test/test-e2e.cpp27
2 files changed, 11 insertions, 17 deletions
diff --git a/Jamroot.jam b/Jamroot.jam
index 7a628d3..26d36aa 100644
--- a/Jamroot.jam
+++ b/Jamroot.jam
@@ -24,6 +24,7 @@ project : requirements
<variant>debug:<cflags>-Wcast-align
<variant>debug:<cflags>-Wunused
<variant>debug:<cflags>-Wconversion
+ <variant>debug:<cflags>-Wsign-conversion
<variant>coverage:<coverage>on
<toolset>tidy:<checkxx>boost-*
<toolset>tidy:<checkxx>bugprone-*
diff --git a/test/test-e2e.cpp b/test/test-e2e.cpp
index 4434995..768f7c9 100644
--- a/test/test-e2e.cpp
+++ b/test/test-e2e.cpp
@@ -260,34 +260,27 @@ TEST_TYPE(MYSQL_TYPE_DOUBLE, double, double, real)
{
return (double)n;
}
-TEST_TYPE(MYSQL_TYPE_DATETIME, MyGrate::DateTime, MyGrate::DateTime, datetime)
+static struct tm
+test_tm(size_t n)
{
time_t t = time(nullptr);
- t -= (n * 12345679);
+ t -= static_cast<time_t>(n * 12345679);
struct tm tm {
};
gmtime_r(&t, &tm);
- return MyGrate::DateTime {tm};
+ return tm;
+}
+TEST_TYPE(MYSQL_TYPE_DATETIME, MyGrate::DateTime, MyGrate::DateTime, datetime)
+{
+ return MyGrate::DateTime {test_tm(n)};
}
TEST_TYPE(MYSQL_TYPE_DATE, MyGrate::Date, MyGrate::Date, date)
{
- time_t t = time(nullptr);
- t -= (n * 12345679);
- struct tm tm {
- };
- gmtime_r(&t, &tm);
- return MyGrate::Date {tm};
+ return MyGrate::Date {test_tm(n)};
}
TEST_TYPE(MYSQL_TYPE_TIME, MyGrate::Time, MyGrate::Time, time)
{
- time_t t = time(nullptr);
- t -= (n * 12345679);
- struct tm tm {
- };
- gmtime_r(&t, &tm);
- auto r = MyGrate::Time {tm};
- std::cerr << r << "\n";
- return r;
+ return MyGrate::Time {test_tm(n)};
}
template<int MYSQL_TYPE, typename Test>