add AVERAGEA boolean test

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1901322 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2022-05-27 11:54:12 +00:00
parent 8d76de41af
commit 2679fd8b6e
1 changed files with 23 additions and 0 deletions

View File

@ -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;
}
}