test first...glen will love it.. . test for concat operator... also added some dumb order of operations
checking git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352526 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1bfafdbd21
commit
cf24bbd7c6
@ -153,12 +153,69 @@ extends TestCase {
|
|||||||
/**
|
/**
|
||||||
* Exponentialize various integers;
|
* Exponentialize various integers;
|
||||||
*/
|
*/
|
||||||
public void testExponentIntegers()
|
public void testPowerIntegers()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
binomialOperator("^");
|
binomialOperator("^");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Concatinate two numbers 1&2 = 12
|
||||||
|
*/
|
||||||
|
public void testConcatIntegers()
|
||||||
|
throws Exception {
|
||||||
|
binomialOperator("&");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tests 1*2+3*4
|
||||||
|
*/
|
||||||
|
public void testOrderOfOperationsMultiply()
|
||||||
|
throws Exception {
|
||||||
|
orderTest("1*2+3*4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tests 1*2+3^4
|
||||||
|
*/
|
||||||
|
public void testOrderOfOperationsPower()
|
||||||
|
throws Exception {
|
||||||
|
orderTest("1*2+3^4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tests order wrting out == order writing in for a given formula
|
||||||
|
*/
|
||||||
|
private void orderTest(String formula)
|
||||||
|
throws Exception {
|
||||||
|
File file = File.createTempFile("testFormula",".xls");
|
||||||
|
FileOutputStream out = new FileOutputStream(file);
|
||||||
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
|
HSSFSheet s = wb.createSheet();
|
||||||
|
HSSFRow r = null;
|
||||||
|
HSSFCell c = null;
|
||||||
|
|
||||||
|
//get our minimum values
|
||||||
|
r = s.createRow((short)0);
|
||||||
|
c = r.createCell((short)1);
|
||||||
|
c.setCellFormula(formula);
|
||||||
|
|
||||||
|
wb.write(out);
|
||||||
|
out.close();
|
||||||
|
assertTrue("file exists",file.exists());
|
||||||
|
|
||||||
|
FileInputStream in = new FileInputStream(file);
|
||||||
|
wb = new HSSFWorkbook(in);
|
||||||
|
s = wb.getSheetAt(0);
|
||||||
|
|
||||||
|
//get our minimum values
|
||||||
|
r = s.getRow((short)0);
|
||||||
|
c = r.getCell((short)1);
|
||||||
|
assertTrue("minval Formula is as expected",
|
||||||
|
formula.equals(c.getCellFormula())
|
||||||
|
);
|
||||||
|
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All multi-binomial operator tests use this to create a worksheet with a
|
* All multi-binomial operator tests use this to create a worksheet with a
|
||||||
|
Loading…
Reference in New Issue
Block a user