summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-10-03 16:44:27 +0000
committerPJ Fanning <fanningpj@apache.org>2021-10-03 16:44:27 +0000
commitcd31c9c275f339b08e7f2f9240ba47b1b29b0d1c (patch)
tree6a22ca6a54a39159546a27214329937a692691a6
parenta38706accd0687c59c93867839c3af9b175cace2 (diff)
downloadpoi-cd31c9c275f339b08e7f2f9240ba47b1b29b0d1c.tar.gz
poi-cd31c9c275f339b08e7f2f9240ba47b1b29b0d1c.zip
[bug-65606] try to fix weeknum function
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1893856 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi/src/test/java/org/apache/poi/ss/formula/functions/TestWeekNumFunc.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestWeekNumFunc.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestWeekNumFunc.java
index 9ccd18dc9d..4e801a657c 100644
--- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestWeekNumFunc.java
+++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestWeekNumFunc.java
@@ -24,6 +24,7 @@ import org.apache.poi.util.StringUtil;
import org.junit.jupiter.api.Test;
import java.time.LocalDate;
+import java.time.LocalDateTime;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
@@ -52,6 +53,19 @@ class TestWeekNumFunc {
}
@Test
+ void testBug65606() {
+ double date = DateUtil.getExcelDate(LocalDate.parse("2021-09-27"));
+ assertEvaluateEquals(40.0, date);
+ assertEvaluateEquals(39.0, date, 21);
+ }
+
+ @Test
+ void testDateTime() {
+ double date = DateUtil.getExcelDate(LocalDateTime.parse("2021-09-27T09:45:00"));
+ assertEvaluateEquals(40.0, date);
+ }
+
+ @Test
void testEvaluateInvalid() {
assertEvaluateEquals("no args", ErrorEval.VALUE_INVALID);
assertEvaluateEquals("too many args", ErrorEval.VALUE_INVALID, new NumberEval(1.0), new NumberEval(1.0), new NumberEval(1.0));