From 4303967e2a031bd18841fcd7d02e4c80f8759fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Wed, 19 Nov 2014 12:43:25 +0100 Subject: [PATCH] add test for #560 --- Foundation/testsuite/src/DateTimeTest.cpp | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Foundation/testsuite/src/DateTimeTest.cpp b/Foundation/testsuite/src/DateTimeTest.cpp index 67f24764d..55146f780 100644 --- a/Foundation/testsuite/src/DateTimeTest.cpp +++ b/Foundation/testsuite/src/DateTimeTest.cpp @@ -18,8 +18,10 @@ #include "Poco/Timespan.h" #include "Poco/Exception.h" + GCC_DIAG_OFF(unused-variable) + using Poco::Timestamp; using Poco::DateTime; using Poco::Timespan; @@ -443,6 +445,28 @@ void DateTimeTest::testArithmetics() loop_1_assert(line, data[di].month2 == X.month()); loop_1_assert(line, data[di].day2 == X.day()); } + + DateTime edgeTime(2014, 9, 16, 0, 0, 0, 0, 10); + edgeTime -= Poco::Timespan(11); + assert (edgeTime.year() == 2014); + assert (edgeTime.month() == 9); + assert (edgeTime.day() == 15); + assert (edgeTime.hour() == 23); + assert (edgeTime.minute() == 59); + assert (edgeTime.second() == 59); + assert (edgeTime.millisecond() == 999); + assert (edgeTime.microsecond() == 999); + + edgeTime.assign(2014, 9, 15, 23, 59, 59, 999, 968); + edgeTime += Poco::Timespan(11); + assert (edgeTime.year() == 2014); + assert (edgeTime.month() == 9); + assert (edgeTime.day() == 15); + assert (edgeTime.hour() == 23); + assert (edgeTime.minute() == 59); + assert (edgeTime.second() == 59); + assert (edgeTime.millisecond() == 999); + assert (edgeTime.microsecond() == 979); } void DateTimeTest::testIncrementDecrement()