[bug-65606] try to fix weeknum function

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1893856 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2021-10-03 16:44:27 +00:00
parent a38706accd
commit cd31c9c275
1 changed files with 14 additions and 0 deletions

View File

@ -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;
@ -51,6 +52,19 @@ class TestWeekNumFunc {
assertEvaluateEquals(10.0, date, 21);
}
@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);