diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-08-28 21:17:40 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-08-28 21:17:40 +0100 |
commit | 13f4fef87d0b8c90385463c3af95e54ec8ad0f4c (patch) | |
tree | 068c4d9974878cfe55347e202a2c8a9b8933ef54 /test | |
parent | Add -Wunused (diff) | |
download | mygrate-13f4fef87d0b8c90385463c3af95e54ec8ad0f4c.tar.bz2 mygrate-13f4fef87d0b8c90385463c3af95e54ec8ad0f4c.tar.xz mygrate-13f4fef87d0b8c90385463c3af95e54ec8ad0f4c.zip |
Add -Wsign-conversion
Diffstat (limited to 'test')
-rw-r--r-- | test/test-e2e.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
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> |