diff options
author | Yegor Kozlov <yegor@apache.org> | 2011-02-19 06:12:10 +0000 |
---|---|---|
committer | Yegor Kozlov <yegor@apache.org> | 2011-02-19 06:12:10 +0000 |
commit | 2a6b01d5a18e1c6425e85ae7720d3e800170d957 (patch) | |
tree | f3dfd6a305ba914652d92b76954a295b4e3d3c22 | |
parent | b6aaf36b5cef63a874607a4195a4741387ffa08f (diff) | |
download | poi-2a6b01d5a18e1c6425e85ae7720d3e800170d957.tar.gz poi-2a6b01d5a18e1c6425e85ae7720d3e800170d957.zip |
test Ant file with ExcelAnt targetsexcelant
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/excelant@1072260 13f79535-47bb-0310-9956-ffa450edef68
-rwxr-xr-x | src/excelant/testcases/org/apache/poi/ss/excelant/tests.xml | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/src/excelant/testcases/org/apache/poi/ss/excelant/tests.xml b/src/excelant/testcases/org/apache/poi/ss/excelant/tests.xml new file mode 100755 index 0000000000..dd9b007729 --- /dev/null +++ b/src/excelant/testcases/org/apache/poi/ss/excelant/tests.xml @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<project name="excelant-tests" basedir="." xmlns:poi="antlib:org.apache.poi.ss.excelant"> + + <path id="excelant.classpath"> + <pathelement location="build/classes"/> + <pathelement location="build/ooxml-classes"/> + <pathelement location="build/excelant-classes"/> + <pathelement location="build/excelant-test-classes"/> <!-- test udf is in the test classes --> + </path> + + <typedef resource="org/apache/poi/ss/excelant/antlib.xml" + classpathref="excelant.classpath" + uri="antlib:org.apache.poi.ss.excelant"/> + + <!-- Should fail because the fileName attribute is missing --> + <target name="test-nofile"> + <poi:excelant> + + </poi:excelant> + </target> + + <!-- Should fail because the specified file is invalid --> + <target name="test-filenotfound"> + <poi:excelant fileName="invalid.xls"> + + </poi:excelant> + </target> + + <!-- basic evaluation test --> + <target name="test-evaluate"> + <poi:excelant fileName="test-data/spreadsheet/excelant.xls"> + <poi:test showSuccessDetails="true"> + <poi:setDouble cell="'MortgageCalculator'!$B$1" value="240000"/> + <poi:setDouble cell="'MortgageCalculator'!$B$2" value ="0.11"/> + <poi:setDouble cell="'MortgageCalculator'!$B$3" value ="30"/> + <poi:evaluate showDelta="true" cell="'MortgageCalculator'!$B$4" + expectedValue="2285.576149" precision="1.0E-4" /> + </poi:test> + </poi:excelant> + </target> + + <target name="test-precision"> + <poi:excelant fileName="test-data/spreadsheet/excelant.xls"> + <poi:precision value="1.0E-4"/> + + <poi:test name="global-precision" showFailureDetail="true" showSuccessDetails="true"> + <poi:setDouble cell="'MortgageCalculator'!$B$1" value="240000"/> + <poi:setDouble cell="'MortgageCalculator'!$B$2" value ="0.11"/> + <poi:setDouble cell="'MortgageCalculator'!$B$3" value ="30"/> + <poi:evaluate showDelta="true" cell="'MortgageCalculator'!$B$4" + expectedValue="2285.576149"/> + </poi:test> + + <poi:test name="custom-precision" showFailureDetail="true" showSuccessDetails="true"> + <poi:setDouble cell="'MortgageCalculator'!$B$1" value="240000"/> + <poi:setDouble cell="'MortgageCalculator'!$B$2" value ="0.11"/> + <poi:setDouble cell="'MortgageCalculator'!$B$3" value ="30"/> + <poi:evaluate showDelta="true" cell="'MortgageCalculator'!$B$4" + expectedValue="2285.576149" precision="1.0E-5"/> + </poi:test> + + <poi:test name="tiny-precision" showFailureDetail="true" showSuccessDetails="true"> + <poi:setDouble cell="'MortgageCalculator'!$B$1" value="240000"/> + <poi:setDouble cell="'MortgageCalculator'!$B$2" value ="0.11"/> + <poi:setDouble cell="'MortgageCalculator'!$B$3" value ="30"/> + <poi:evaluate showDelta="true" cell="'MortgageCalculator'!$B$4" + expectedValue="2285.576149" precision="1.0E-10"/> + </poi:test> + + </poi:excelant> + </target> + + <!-- + By default ExcelAnt does not terminate execution if an error occurs + --> + <target name="test-passonerror"> + <poi:excelant fileName="test-data/spreadsheet/excelant.xls"> + + <poi:test name="failonerror" showFailureDetail="true" showSuccessDetails="true"> + <poi:setDouble cell="'MortageCalculatorFunction'!$D$1" value="1"/> + <poi:setDouble cell="'MortageCalculatorFunction'!$D$2" value="2"/> + <poi:setFormula cell="'MortageCalculatorFunction'!$D$3" value ="SUM(D1:D2)"/> + <poi:evaluate showDelta="true" cell="'MortageCalculatorFunction'!$D$3" expectedValue="2"/> + </poi:test> + + </poi:excelant> + </target> + + <!-- + failOnError="true" forces ExcelAnt tot terminate execution if an error occurs + --> + <target name="test-failonerror"> + <poi:excelant fileName="test-data/spreadsheet/excelant.xls" failOnError="true"> + + <poi:test name="failonerror" showFailureDetail="true" showSuccessDetails="true"> + <poi:setDouble cell="'MortageCalculatorFunction'!$D$1" value="1"/> + <poi:setDouble cell="'MortageCalculatorFunction'!$D$2" value="2"/> + <poi:setFormula cell="'MortageCalculatorFunction'!$D$3" value ="SUM(D1:D2)"/> + <poi:evaluate showDelta="true" cell="'MortageCalculatorFunction'!$D$3" expectedValue="2"/> + </poi:test> + + </poi:excelant> + </target> + + <!-- Evaluation of user-defined functions --> + <target name="test-udf"> + <poi:excelant fileName="test-data/spreadsheet/excelant.xls"> + <poi:udf functionAlias="calculatePayment" + className="org.apache.poi.ss.examples.formula.CalculateMortgage"/> + <poi:test> + <poi:setDouble cell="'MortageCalculatorFunction'!$B$1" value="240000"/> + <poi:setDouble cell="'MortageCalculatorFunction'!$B$2" value ="0.11"/> + <poi:setDouble cell="'MortageCalculatorFunction'!$B$3" value ="30"/> + <poi:evaluate showDelta="true" cell="'MortageCalculatorFunction'!$B$4" + expectedValue="2285.576149" precision="1.0E-4" /> + </poi:test> + </poi:excelant> + </target> + +</project> |