From 13f4fef87d0b8c90385463c3af95e54ec8ad0f4c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 28 Aug 2021 21:17:40 +0100 Subject: Add -Wsign-conversion --- Jamroot.jam | 1 + test/test-e2e.cpp | 27 ++++++++++----------------- 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 debug:-Wcast-align debug:-Wunused debug:-Wconversion + debug:-Wsign-conversion coverage:on tidy:boost-* tidy: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(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 -- cgit v1.2.3