summaryrefslogtreecommitdiff
path: root/tools/qa/cppunit
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2021-03-23 10:54:14 +0100
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2021-03-25 09:42:40 +0100
commitea61644abe9e7cd35cdb54452dac327782bbc402 (patch)
tree0bec03e2b405c54060d3c4425bad7e6428f83559 /tools/qa/cppunit
parent89af24074e9adac4d005dcc322d81db09fc19f54 (diff)
tdf#58745 - Detect end of month when extending a date list
Change-Id: Icaa64a493598dc4bb8f2d6d076ad4300e2e4dde6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112976 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'tools/qa/cppunit')
-rw-r--r--tools/qa/cppunit/test_date.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/qa/cppunit/test_date.cxx b/tools/qa/cppunit/test_date.cxx
index 9a243cce504c..e11270e6a299 100644
--- a/tools/qa/cppunit/test_date.cxx
+++ b/tools/qa/cppunit/test_date.cxx
@@ -26,6 +26,7 @@ public:
void testGetDayOfWeek();
void testGetDaysInMonth();
void testIsBetween();
+ void testIsEndOfMonth();
CPPUNIT_TEST_SUITE(DateTest);
CPPUNIT_TEST(testDate);
@@ -37,6 +38,7 @@ public:
CPPUNIT_TEST(testGetDayOfWeek);
CPPUNIT_TEST(testGetDaysInMonth);
CPPUNIT_TEST(testIsBetween);
+ CPPUNIT_TEST(testIsEndOfMonth);
CPPUNIT_TEST_SUITE_END();
};
@@ -533,6 +535,29 @@ void DateTest::testIsBetween()
CPPUNIT_ASSERT(aDate.IsBetween(Date(1, 1, 2018), Date(1, 12, 2018)));
}
+void DateTest::testIsEndOfMonth()
+{
+ {
+ Date aDate(31, 12, 2000);
+ CPPUNIT_ASSERT(aDate.IsEndOfMonth());
+ }
+
+ {
+ Date aDate(30, 12, 2000);
+ CPPUNIT_ASSERT(!aDate.IsEndOfMonth());
+ }
+
+ {
+ Date aDate(29, 2, 2000);
+ CPPUNIT_ASSERT(aDate.IsEndOfMonth());
+ }
+
+ {
+ Date aDate(28, 2, 2000);
+ CPPUNIT_ASSERT(!aDate.IsEndOfMonth());
+ }
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(DateTest);
}