aboutsummaryrefslogtreecommitdiffstats
path: root/poi
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2022-05-27 11:54:12 +0000
committerPJ Fanning <fanningpj@apache.org>2022-05-27 11:54:12 +0000
commit2679fd8b6e217a33bb579997b661fcaf8ea3ea3f (patch)
tree2b7c32b5ff88463240de9afe263910108cdecc9b /poi
parent8d76de41aff415718aeb3e8658407576723f8b71 (diff)
downloadpoi-2679fd8b6e217a33bb579997b661fcaf8ea3ea3f.tar.gz
poi-2679fd8b6e217a33bb579997b661fcaf8ea3ea3f.zip
add AVERAGEA boolean test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1901322 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r--poi/src/test/java/org/apache/poi/ss/formula/functions/TestAverageA.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestAverageA.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestAverageA.java
index e5940cb7e5..75bf4718af 100644
--- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestAverageA.java
+++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestAverageA.java
@@ -45,6 +45,16 @@ public class TestAverageA {
}
}
+ @Test
+ void testBooleans() throws IOException {
+ try (HSSFWorkbook wb = initWorkbook2()) {
+ HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb);
+ HSSFCell cell = wb.getSheetAt(0).getRow(0).createCell(12);
+ assertDouble(fe, cell, "AVERAGEA(A2:A7)", 4.833333333333333, 0.00000000001);
+ assertDouble(fe, cell, "AVERAGE(A2:A7)", 7, 0.00000000001);
+ }
+ }
+
private HSSFWorkbook initWorkbook1() {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet();
@@ -57,4 +67,17 @@ public class TestAverageA {
addRow(sheet, 6, "Formula");
return wb;
}
+
+ private HSSFWorkbook initWorkbook2() {
+ HSSFWorkbook wb = new HSSFWorkbook();
+ HSSFSheet sheet = wb.createSheet();
+ addRow(sheet, 0, "Data");
+ addRow(sheet, 1, 10);
+ addRow(sheet, 2, 7);
+ addRow(sheet, 3, 9);
+ addRow(sheet, 4, 2);
+ addRow(sheet, 5, true);
+ addRow(sheet, 6, false);
+ return wb;
+ }
}