Index: src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java =================================================================== RCS file: /home/cvspublic/jakarta-poi/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java,v retrieving revision 1.30 diff -b -u -u -r1.30 TestFormulas.java --- src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java 4 May 2003 18:22:09 -0000 1.30 +++ src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java 17 Jul 2003 18:43:53 -0000 @@ -744,7 +744,7 @@ } public void testSheetFunctions() - throws java.io.IOException + throws IOException { String filename = System.getProperty("HSSF.testdata.path"); @@ -818,7 +818,7 @@ } public void testStringFormulas() - throws java.io.IOException + throws IOException { String readFilename = System.getProperty("HSSF.testdata.path"); @@ -852,7 +852,7 @@ public void testLogicalFormulas() - throws java.io.IOException + throws IOException { File file = File.createTempFile("testLogicalFormula",".xls"); @@ -880,7 +880,7 @@ } public void testDateFormulas() - throws java.io.IOException + throws IOException { String readFilename = System.getProperty("HSSF.testdata.path"); @@ -918,7 +918,7 @@ public void testIfFormulas() - throws java.io.IOException + throws IOException { String readFilename = System.getProperty("HSSF.testdata.path"); @@ -1008,7 +1008,7 @@ } public void testSumIf() - throws java.io.IOException + throws IOException { String readFilename = System.getProperty("HSSF.testdata.path"); String function ="SUMIF(A1:A5,\">4000\",B1:B5)"; @@ -1060,6 +1060,26 @@ assertTrue("sumif == 0 bytes", file.length() > 0); } + public void testSquareMacro() throws IOException { + File dir = new File(System.getProperty("HSSF.testdata.path")); + File xls = new File(dir, "SquareMacro.xls"); + FileInputStream in = new FileInputStream(xls); + HSSFWorkbook w; + try { + w = new HSSFWorkbook(in); + } finally { + in.close(); + } + HSSFSheet s0 = w.getSheetAt(0); + HSSFRow[] r = {s0.getRow(0), s0.getRow(1)}; + HSSFCell a1 = r[0].getCell((short) 0); + assertEquals("SQUARE(1)", a1.getCellFormula()); + assertEquals(1d, a1.getNumericCellValue(), 1e-9); + HSSFCell a2 = r[1].getCell((short) 0); + assertEquals("SQUARE(2)", a2.getCellFormula()); + assertEquals(4d, a2.getNumericCellValue(), 1e-9); + } + public static void main(String [] args) { System.out .println("Testing org.apache.poi.hssf.usermodel.TestFormulas");