]> source.dussan.org Git - poi.git/commitdiff
[bug-65879] add tests
authorPJ Fanning <fanningpj@apache.org>
Fri, 11 Feb 2022 00:34:31 +0000 (00:34 +0000)
committerPJ Fanning <fanningpj@apache.org>
Fri, 11 Feb 2022 00:34:31 +0000 (00:34 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1897955 13f79535-47bb-0310-9956-ffa450edef68

poi/src/test/java/org/apache/poi/ss/formula/atp/TestWorkdayCalculator.java

index 5302595a70c240e42beb10ce897d3fd05eed7e29..b164c9ef0e17c63b26bf4b8a5d826b3a680eae22 100644 (file)
@@ -87,9 +87,17 @@ class TestWorkdayCalculator {
 
     @Test
     void testCalculateWorkdaysNumberOfDays() {
-        double start = 41553.0;
+        double start = DateUtil.getExcelDate(d(2013, 10, 4));
+        assertEquals(41551.0, start);
         int days = 1;
         assertEquals(d(2013, 10, 7), WorkdayCalculator.instance.calculateWorkdays(start, days, new double[0]));
+        assertEquals(d(2013, 10, 7), WorkdayCalculator.instance.calculateWorkdays(start + 1, days, new double[0]));
+        assertEquals(d(2013, 10, 7), WorkdayCalculator.instance.calculateWorkdays(start + 2, days, new double[0]));
+        assertEquals(d(2013, 10, 5),
+                WorkdayCalculator.instance.calculateWorkdays(start, days, 5, new double[0]));
+
+        assertEquals(d(2013, 10, 3), WorkdayCalculator.instance.calculateWorkdays(start, -1, new double[0]));
+
     }
 
     @Test