diff options
author | Yegor Kozlov <yegor@apache.org> | 2012-08-11 16:14:49 +0000 |
---|---|---|
committer | Yegor Kozlov <yegor@apache.org> | 2012-08-11 16:14:49 +0000 |
commit | 3f23441a94d49c8db19571f9438f666ab1e3c4f5 (patch) | |
tree | 19793106f72df748eefca833ce9f91dcff3f5524 /src/testcases | |
parent | 1f2381967a0a9fd2725abf2915eb9ff0a9ce8ab9 (diff) | |
download | poi-3f23441a94d49c8db19571f9438f666ab1e3c4f5.tar.gz poi-3f23441a94d49c8db19571f9438f666ab1e3c4f5.zip |
Bugzilla 53644: XLS formula bugfix (CalFieldFunc) + WeekDay addon
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1371969 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r-- | src/testcases/org/apache/poi/ss/formula/functions/TestAddress.java | 3 | ||||
-rw-r--r-- | src/testcases/org/apache/poi/ss/formula/functions/TestCalendarFieldFunction.java | 27 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestAddress.java b/src/testcases/org/apache/poi/ss/formula/functions/TestAddress.java index 07fb6aa895..013b15806c 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestAddress.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestAddress.java @@ -33,6 +33,9 @@ public final class TestAddress extends TestCase { String formulaText = "ADDRESS(1,2)";
confirmResult(fe, cell, formulaText, "$B$1");
+ formulaText = "ADDRESS(1,2,)"; // with explicitly empty third parameter
+ confirmResult(fe, cell, formulaText, "$B$1");
+
formulaText = "ADDRESS(22,44)";
confirmResult(fe, cell, formulaText, "$AR$22");
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestCalendarFieldFunction.java b/src/testcases/org/apache/poi/ss/formula/functions/TestCalendarFieldFunction.java index ede20de393..636c72a427 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestCalendarFieldFunction.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestCalendarFieldFunction.java @@ -59,6 +59,33 @@ public final class TestCalendarFieldFunction extends TestCase { confirm("SECOND(40627.4860417)", 54); } + public void testRounding() { + // 41484.999994200 = 23:59:59,499 + // 41484.9999942129 = 23:59:59,500 (but sub-milliseconds are below 0.5 (0.49999453965575), XLS-second results in 59) + // 41484.9999942130 = 23:59:59,500 (sub-milliseconds are 0.50000334065408, XLS-second results in 00) + + confirm("DAY(41484.999994200)", 29); + confirm("SECOND(41484.999994200)", 59); + + confirm("DAY(41484.9999942129)", 29); + confirm("HOUR(41484.9999942129)", 23); + confirm("MINUTE(41484.9999942129)", 59); + confirm("SECOND(41484.9999942129)", 59); + + confirm("DAY(41484.9999942130)", 30); + confirm("HOUR(41484.9999942130)", 0); + confirm("MINUTE(41484.9999942130)", 0); + confirm("SECOND(41484.9999942130)", 0); + } + + public void testDaylightSaving() { + confirm("HOUR(41364.08263888890000)", 1); // 31.03.2013 01:59:00,000 + confirm("HOUR(41364.08333333330000)", 2); // 31.03.2013 02:00:00,000 (this time does not exist in TZ CET, but EXCEL does not care) + confirm("HOUR(41364.08402777780000)", 2); // 31.03.2013 02:01:00,000 + confirm("HOUR(41364.12430555560000)", 2); // 31.03.2013 02:59:00,000 + confirm("HOUR(41364.12500000000000)", 3); // 31.03.2013 03:00:00,000 + } + public void testBugDate() { confirm("YEAR(0.0)", 1900); confirm("MONTH(0.0)", 1); |