poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject cvs commit: jakarta-poi/src/testcases/org/apache/poi/hssf/model TestFormulaParser.java
Date Wed, 18 May 2005 18:58:57 GMT
avik        2005/05/18 11:58:57

  Modified:    src/java/org/apache/poi/hssf/model FormulaParser.java
               src/testcases/org/apache/poi/hssf/model
                        TestFormulaParser.java
  Log:
  unary plus: patch by Amol Deshmukh, test added
  
  Revision  Changes    Path
  1.20      +6 -1      jakarta-poi/src/java/org/apache/poi/hssf/model/FormulaParser.java
  
  Index: FormulaParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hssf/model/FormulaParser.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- FormulaParser.java	21 Apr 2005 13:43:51 -0000	1.19
  +++ FormulaParser.java	18 May 2005 18:58:57 -0000	1.20
  @@ -115,7 +115,7 @@
       private void Abort(String s) {
           Error(s);
           //System.exit(1);  //throw exception??
  -        throw new RuntimeException("Cannot Parse, sorry : "+s);
  +        throw new RuntimeException("Cannot Parse, sorry : "+s + " [Formula String was:
'"+formulaString+"']");
       }
       
       
  @@ -466,6 +466,11 @@
       		Factor();
       		tokens.add(new UnaryMinusPtg());
       	}
  +        else if (look == '+') {
  +            Match('+');
  +            Factor();
  +            tokens.add(new UnaryPlusPtg());
  +        }
           else if (look == '(' ) {
               Match('(');
               Expression();
  
  
  
  1.16      +12 -1     jakarta-poi/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java
  
  Index: TestFormulaParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TestFormulaParser.java	21 Apr 2005 13:01:29 -0000	1.15
  +++ TestFormulaParser.java	18 May 2005 18:58:57 -0000	1.16
  @@ -36,6 +36,7 @@
   import org.apache.poi.hssf.record.formula.ReferencePtg;
   import org.apache.poi.hssf.record.formula.StringPtg;
   import org.apache.poi.hssf.record.formula.UnaryMinusPtg;
  +import org.apache.poi.hssf.record.formula.UnaryPlusPtg;
   import org.apache.poi.hssf.usermodel.HSSFCell;
   import org.apache.poi.hssf.usermodel.HSSFRow;
   import org.apache.poi.hssf.usermodel.HSSFSheet;
  @@ -323,7 +324,17 @@
   		Ptg[] ptg = fp.getRPNPtg();
   		assertTrue("got 2 ptgs", ptg.length == 2);
   		assertTrue("first ptg is reference",ptg[0] instanceof ReferencePtg);
  -		assertTrue("second ptg is string",ptg[1] instanceof UnaryMinusPtg);
  +		assertTrue("second ptg is Minus",ptg[1] instanceof UnaryMinusPtg);
  +     }
  +    
  +    public void testUnaryPlus()
  +    {
  +		FormulaParser fp = new FormulaParser("+A1", null);
  +		fp.parse();
  +		Ptg[] ptg = fp.getRPNPtg();
  +		assertTrue("got 2 ptgs", ptg.length == 2);
  +		assertTrue("first ptg is reference",ptg[0] instanceof ReferencePtg);
  +		assertTrue("second ptg is Plus",ptg[1] instanceof UnaryPlusPtg);
        }
       
   	public void testLeadingSpaceInString()
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


Mime
View raw message