You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2008/09/07 19:34:38 UTC

svn commit: r692907 [4/4] - in /poi/branches/ooxml: ./ src/documentation/content/xdocs/ src/documentation/content/xdocs/hpbf/ src/java/org/apache/poi/hssf/record/ src/java/org/apache/poi/hssf/record/formula/ src/java/org/apache/poi/hssf/record/formula/...

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMatch.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMatch.java?rev=692907&r1=692906&r2=692907&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMatch.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMatch.java Sun Sep  7 10:34:36 2008
@@ -19,8 +19,6 @@
 
 import junit.framework.TestCase;
 
-import org.apache.poi.hssf.record.formula.AreaPtg;
-import org.apache.poi.hssf.record.formula.eval.Area2DEval;
 import org.apache.poi.hssf.record.formula.eval.AreaEval;
 import org.apache.poi.hssf.record.formula.eval.BoolEval;
 import org.apache.poi.hssf.record.formula.eval.ErrorEval;
@@ -32,7 +30,7 @@
 
 /**
  * Test cases for MATCH()
- * 
+ *
  * @author Josh Micich
  */
 public final class TestMatch extends TestCase {
@@ -41,8 +39,8 @@
 	private static final NumberEval MATCH_EXACT = new NumberEval(0);
 	/** greater than or equal to */
 	private static final NumberEval MATCH_SMALLEST_GTE = new NumberEval(-1);
-	
-	
+
+
 	private static Eval invokeMatch(Eval lookup_value, Eval lookup_array, Eval match_type) {
 		Eval[] args = { lookup_value, lookup_array, match_type, };
 		return new Match().evaluate(args, -1, (short)-1);
@@ -54,26 +52,19 @@
 		NumericValueEval nve = (NumericValueEval)actualEval;
 		assertEquals(expected, nve.getNumberValue(), 0);
 	}
-	/**
-	 * Convenience method
-	 * @return <code>new Area2DEval(new AreaPtg(ref), values)</code>
-	 */
-	private static AreaEval createAreaEval(String ref, ValueEval[] values) {
-		return new Area2DEval(new AreaPtg(ref), values);
-	}
-	
+
 	public void testSimpleNumber() {
-		
+
 		ValueEval[] values = {
-			new NumberEval(4),	
-			new NumberEval(5),	
-			new NumberEval(10),	
-			new NumberEval(10),	
-			new NumberEval(25),	
-		};
-		
-		AreaEval ae = createAreaEval("A1:A5", values);
-		
+			new NumberEval(4),
+			new NumberEval(5),
+			new NumberEval(10),
+			new NumberEval(10),
+			new NumberEval(25),
+		};
+
+		AreaEval ae = EvalFactory.createAreaEval("A1:A5", values);
+
 		confirmInt(2, invokeMatch(new NumberEval(5), ae, MATCH_LARGEST_LTE));
 		confirmInt(2, invokeMatch(new NumberEval(5), ae, MATCH_EXACT));
 		confirmInt(4, invokeMatch(new NumberEval(10), ae, MATCH_LARGEST_LTE));
@@ -81,19 +72,19 @@
 		confirmInt(4, invokeMatch(new NumberEval(20), ae, MATCH_LARGEST_LTE));
 		assertEquals(ErrorEval.NA, invokeMatch(new NumberEval(20), ae, MATCH_EXACT));
 	}
-	
+
 	public void testReversedNumber() {
-		
+
 		ValueEval[] values = {
-			new NumberEval(25),	
-			new NumberEval(10),	
-			new NumberEval(10),	
-			new NumberEval(10),	
-			new NumberEval(4),	
-		};
-		
-		AreaEval ae = createAreaEval("A1:A5", values);
-		
+			new NumberEval(25),
+			new NumberEval(10),
+			new NumberEval(10),
+			new NumberEval(10),
+			new NumberEval(4),
+		};
+
+		AreaEval ae = EvalFactory.createAreaEval("A1:A5", values);
+
 		confirmInt(2, invokeMatch(new NumberEval(10), ae, MATCH_SMALLEST_GTE));
 		confirmInt(2, invokeMatch(new NumberEval(10), ae, MATCH_EXACT));
 		confirmInt(4, invokeMatch(new NumberEval(9), ae, MATCH_SMALLEST_GTE));
@@ -101,19 +92,19 @@
 		assertEquals(ErrorEval.NA, invokeMatch(new NumberEval(20), ae, MATCH_EXACT));
 		assertEquals(ErrorEval.NA, invokeMatch(new NumberEval(26), ae, MATCH_SMALLEST_GTE));
 	}
-	
+
 	public void testSimpleString() {
-		
+
 		ValueEval[] values = {
-			new StringEval("Albert"),	
-			new StringEval("Charles"),	
-			new StringEval("Ed"),	
-			new StringEval("Greg"),	
-			new StringEval("Ian"),	
-		};
-		
-		AreaEval ae = createAreaEval("A1:A5", values);
-		
+			new StringEval("Albert"),
+			new StringEval("Charles"),
+			new StringEval("Ed"),
+			new StringEval("Greg"),
+			new StringEval("Ian"),
+		};
+
+		AreaEval ae = EvalFactory.createAreaEval("A1:A5", values);
+
 		// Note String comparisons are case insensitive
 		confirmInt(3, invokeMatch(new StringEval("Ed"), ae, MATCH_LARGEST_LTE));
 		confirmInt(3, invokeMatch(new StringEval("eD"), ae, MATCH_LARGEST_LTE));
@@ -122,90 +113,90 @@
 		confirmInt(4, invokeMatch(new StringEval("Hugh"), ae, MATCH_LARGEST_LTE));
 		assertEquals(ErrorEval.NA, invokeMatch(new StringEval("Hugh"), ae, MATCH_EXACT));
 	}
-	
+
 	public void testSimpleBoolean() {
-		
+
 		ValueEval[] values = {
-				BoolEval.FALSE,	
-				BoolEval.FALSE,	
-				BoolEval.TRUE,	
-				BoolEval.TRUE,	
-		};
-		
-		AreaEval ae = createAreaEval("A1:A4", values);
-		
+				BoolEval.FALSE,
+				BoolEval.FALSE,
+				BoolEval.TRUE,
+				BoolEval.TRUE,
+		};
+
+		AreaEval ae = EvalFactory.createAreaEval("A1:A4", values);
+
 		// Note String comparisons are case insensitive
 		confirmInt(2, invokeMatch(BoolEval.FALSE, ae, MATCH_LARGEST_LTE));
 		confirmInt(1, invokeMatch(BoolEval.FALSE, ae, MATCH_EXACT));
 		confirmInt(4, invokeMatch(BoolEval.TRUE, ae, MATCH_LARGEST_LTE));
 		confirmInt(3, invokeMatch(BoolEval.TRUE, ae, MATCH_EXACT));
 	}
-	
+
 	public void testHeterogeneous() {
-		
+
 		ValueEval[] values = {
-				new NumberEval(4),	
-				BoolEval.FALSE,	
+				new NumberEval(4),
+				BoolEval.FALSE,
 				new NumberEval(5),
-				new StringEval("Albert"),	
-				BoolEval.FALSE,	
-				BoolEval.TRUE,	
-				new NumberEval(10),	
-				new StringEval("Charles"),	
-				new StringEval("Ed"),	
-				new NumberEval(10),	
-				new NumberEval(25),	
-				BoolEval.TRUE,	
-				new StringEval("Ed"),	
-		};
-		
-		AreaEval ae = createAreaEval("A1:A13", values);
-		
+				new StringEval("Albert"),
+				BoolEval.FALSE,
+				BoolEval.TRUE,
+				new NumberEval(10),
+				new StringEval("Charles"),
+				new StringEval("Ed"),
+				new NumberEval(10),
+				new NumberEval(25),
+				BoolEval.TRUE,
+				new StringEval("Ed"),
+		};
+
+		AreaEval ae = EvalFactory.createAreaEval("A1:A13", values);
+
 		assertEquals(ErrorEval.NA, invokeMatch(new StringEval("Aaron"), ae, MATCH_LARGEST_LTE));
-		
+
 		confirmInt(5, invokeMatch(BoolEval.FALSE, ae, MATCH_LARGEST_LTE));
 		confirmInt(2, invokeMatch(BoolEval.FALSE, ae, MATCH_EXACT));
 		confirmInt(3, invokeMatch(new NumberEval(5), ae, MATCH_LARGEST_LTE));
 		confirmInt(3, invokeMatch(new NumberEval(5), ae, MATCH_EXACT));
-		
+
 		confirmInt(8, invokeMatch(new StringEval("CHARLES"), ae, MATCH_EXACT));
-		
+
 		confirmInt(4, invokeMatch(new StringEval("Ben"), ae, MATCH_LARGEST_LTE));
-		
+
 		confirmInt(13, invokeMatch(new StringEval("ED"), ae, MATCH_LARGEST_LTE));
 		confirmInt(9, invokeMatch(new StringEval("ED"), ae, MATCH_EXACT));
-			
+
 		confirmInt(13, invokeMatch(new StringEval("Hugh"), ae, MATCH_LARGEST_LTE));
 		assertEquals(ErrorEval.NA, invokeMatch(new StringEval("Hugh"), ae, MATCH_EXACT));
-		
+
 		confirmInt(11, invokeMatch(new NumberEval(30), ae, MATCH_LARGEST_LTE));
 		confirmInt(12, invokeMatch(BoolEval.TRUE, ae, MATCH_LARGEST_LTE));
 	}
-	
+
 
 	/**
 	 * Ensures that the match_type argument can be an <tt>AreaEval</tt>.<br/>
 	 * Bugzilla 44421
 	 */
 	public void testMatchArgTypeArea() {
-		
+
 		ValueEval[] values = {
-			new NumberEval(4),	
-			new NumberEval(5),	
-			new NumberEval(10),	
-			new NumberEval(10),	
-			new NumberEval(25),	
+			new NumberEval(4),
+			new NumberEval(5),
+			new NumberEval(10),
+			new NumberEval(10),
+			new NumberEval(25),
 		};
-		
-		AreaEval ae = createAreaEval("A1:A5", values);
 
-		AreaEval matchAE = createAreaEval("C1:C1", new ValueEval[] { MATCH_LARGEST_LTE, });
-		
+		AreaEval ae = EvalFactory.createAreaEval("A1:A5", values);
+
+		AreaEval matchAE = EvalFactory.createAreaEval("C1:C1", new ValueEval[] { MATCH_LARGEST_LTE, });
+
 		try {
 			confirmInt(4, invokeMatch(new NumberEval(10), ae, matchAE));
 		} catch (RuntimeException e) {
 			if(e.getMessage().startsWith("Unexpected match_type type")) {
-				// identified bug 44421 
+				// identified bug 44421
 				fail(e.getMessage());
 			}
 			// some other error ??

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java?rev=692907&r1=692906&r2=692907&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java Sun Sep  7 10:34:36 2008
@@ -20,6 +20,8 @@
  */
 package org.apache.poi.hssf.record.formula.functions;
 
+import org.apache.poi.hssf.record.formula.functions.XYNumericFunction.Accumulator;
+
 
 /**
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
@@ -566,99 +568,99 @@
     }
 
     public void testSumx2my2() {
-        double d = 0;
         double[] xarr = null;
         double[] yarr = null;
         
         xarr = new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
         yarr = new double[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
-        d = MathX.sumx2my2(xarr, yarr);
-        assertEquals("sumx2my2 ", 100, d);
+        confirmSumx2my2(xarr, yarr, 100);
         
         xarr = new double[]{-1, -2, -3, -4, -5, -6, -7, -8, -9, -10};
         yarr = new double[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
-        d = MathX.sumx2my2(xarr, yarr);
-        assertEquals("sumx2my2 ", 100, d);
+        confirmSumx2my2(xarr, yarr, 100);
         
         xarr = new double[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
         yarr = new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
-        d = MathX.sumx2my2(xarr, yarr);
-        assertEquals("sumx2my2 ", -100, d);
+        confirmSumx2my2(xarr, yarr, -100);
         
         xarr = new double[]{10};
         yarr = new double[]{9};
-        d = MathX.sumx2my2(xarr, yarr);
-        assertEquals("sumx2my2 ", 19, d);
+        confirmSumx2my2(xarr, yarr, 19);
         
         xarr = new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
         yarr = new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
-        d = MathX.sumx2my2(xarr, yarr);
-        assertEquals("sumx2my2 ", 0, d);
-        
+        confirmSumx2my2(xarr, yarr, 0);
     }
 
     public void testSumx2py2() {
-        double d = 0;
         double[] xarr = null;
         double[] yarr = null;
         
         xarr = new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
         yarr = new double[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
-        d = MathX.sumx2py2(xarr, yarr);
-        assertEquals("sumx2py2 ", 670, d);
+        confirmSumx2py2(xarr, yarr, 670);
         
         xarr = new double[]{-1, -2, -3, -4, -5, -6, -7, -8, -9, -10};
         yarr = new double[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
-        d = MathX.sumx2py2(xarr, yarr);
-        assertEquals("sumx2py2 ", 670, d);
+        confirmSumx2py2(xarr, yarr, 670);
         
         xarr = new double[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
         yarr = new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
-        d = MathX.sumx2py2(xarr, yarr);
-        assertEquals("sumx2py2 ", 670, d);
+        confirmSumx2py2(xarr, yarr, 670);
         
         xarr = new double[]{10};
         yarr = new double[]{9};
-        d = MathX.sumx2py2(xarr, yarr);
-        assertEquals("sumx2py2 ", 181, d);
+        confirmSumx2py2(xarr, yarr, 181);
         
         xarr = new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
         yarr = new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
-        d = MathX.sumx2py2(xarr, yarr);
-        assertEquals("sumx2py2 ", 770, d);
+        confirmSumx2py2(xarr, yarr, 770);
     }
 
     public void testSumxmy2() {
-        double d = 0;
         double[] xarr = null;
         double[] yarr = null;
         
         xarr = new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
         yarr = new double[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
-        d = MathX.sumxmy2(xarr, yarr);
-        assertEquals("sumxmy2 ", 10, d);
+        confirmSumxmy2(xarr, yarr, 10);
         
         xarr = new double[]{-1, -2, -3, -4, -5, -6, -7, -8, -9, -10};
         yarr = new double[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
-        d = MathX.sumxmy2(xarr, yarr);
-        assertEquals("sumxmy2 ", 1330, d);
+        confirmSumxmy2(xarr, yarr, 1330);
         
         xarr = new double[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
         yarr = new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
-        d = MathX.sumxmy2(xarr, yarr);
-        assertEquals("sumxmy2 ", 10, d);
+        confirmSumxmy2(xarr, yarr, 10);
         
         xarr = new double[]{10};
         yarr = new double[]{9};
-        d = MathX.sumxmy2(xarr, yarr);
-        assertEquals("sumxmy2 ", 1, d);
+        confirmSumxmy2(xarr, yarr, 1);
         
         xarr = new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
         yarr = new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
-        d = MathX.sumxmy2(xarr, yarr);
-        assertEquals("sumxmy2 ", 0, d);
+        confirmSumxmy2(xarr, yarr, 0);
     }
 
+    private static void confirmSumx2my2(double[] xarr, double[] yarr, double expectedResult) {
+        confirmXY(new Sumx2my2().createAccumulator(), xarr, yarr, expectedResult);
+    }
+    private static void confirmSumx2py2(double[] xarr, double[] yarr, double expectedResult) {
+        confirmXY(new Sumx2py2().createAccumulator(), xarr, yarr, expectedResult);
+    }
+    private static void confirmSumxmy2(double[] xarr, double[] yarr, double expectedResult) {
+        confirmXY(new Sumxmy2().createAccumulator(), xarr, yarr, expectedResult);
+    }
+
+    private static void confirmXY(Accumulator acc, double[] xarr, double[] yarr,
+            double expectedResult) {
+        double result = 0.0;
+        for (int i = 0; i < xarr.length; i++) {
+            result += acc.accumulate(xarr[i], yarr[i]);
+        }
+        assertEquals(expectedResult, result, 0.0);
+    }
+    
     public void testRound() {
         double d = 0;
         int p = 0;

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMid.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMid.java?rev=692907&r1=692906&r2=692907&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMid.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMid.java Sun Sep  7 10:34:36 2008
@@ -17,29 +17,25 @@
 
 package org.apache.poi.hssf.record.formula.functions;
 
-import org.apache.poi.hssf.record.formula.AreaPtg;
-import org.apache.poi.hssf.record.formula.RefPtg;
-import org.apache.poi.hssf.record.formula.eval.Area2DEval;
+import junit.framework.TestCase;
+
 import org.apache.poi.hssf.record.formula.eval.AreaEval;
 import org.apache.poi.hssf.record.formula.eval.BlankEval;
 import org.apache.poi.hssf.record.formula.eval.BoolEval;
 import org.apache.poi.hssf.record.formula.eval.ErrorEval;
 import org.apache.poi.hssf.record.formula.eval.Eval;
 import org.apache.poi.hssf.record.formula.eval.NumberEval;
-import org.apache.poi.hssf.record.formula.eval.Ref2DEval;
 import org.apache.poi.hssf.record.formula.eval.RefEval;
 import org.apache.poi.hssf.record.formula.eval.StringEval;
 import org.apache.poi.hssf.record.formula.eval.ValueEval;
-
-import junit.framework.TestCase;
 /**
  * Tests for Excel function MID()
- * 
+ *
  * @author Josh Micich
  */
 public final class TestMid extends TestCase {
 
-	
+
 	private static Eval invokeMid(Eval text, Eval startPos, Eval numChars) {
 		Eval[] args = new Eval[] { text, startPos, numChars, };
 		return new Mid().evaluate(args, -1, (short)-1);
@@ -56,28 +52,28 @@
 		assertEquals(ErrorEval.class, result.getClass());
 		assertEquals(expectedError.getErrorCode(), ((ErrorEval)result).getErrorCode());
 	}
-	
+
 	public void testBasic() {
-		
+
 		confirmMid(new StringEval("galactic"), new NumberEval(3), new NumberEval(4), "lact");
 	}
-	
+
 	/**
 	 * Valid cases where args are not precisely (string, int, int) but can be resolved OK.
 	 */
 	public void testUnusualArgs() {
 		// startPos with fractional digits
 		confirmMid(new StringEval("galactic"), new NumberEval(3.1), new NumberEval(4), "lact");
-		
+
 		// string startPos
 		confirmMid(new StringEval("galactic"), new StringEval("3"), new NumberEval(4), "lact");
-		
-		// text (first) arg type is number, other args are strings with fractional digits 
+
+		// text (first) arg type is number, other args are strings with fractional digits
 		confirmMid(new NumberEval(123456), new StringEval("3.1"), new StringEval("2.9"), "34");
-		
+
 		// startPos is 1x1 area ref, numChars is cell ref
-		AreaEval aeStart = new Area2DEval(new AreaPtg("A1:A1"), new ValueEval[] { new NumberEval(2), } );
-		RefEval reNumChars = new Ref2DEval(new RefPtg("B1"), new NumberEval(3));
+		AreaEval aeStart = EvalFactory.createAreaEval("A1:A1", new ValueEval[] { new NumberEval(2), } );
+		RefEval reNumChars = EvalFactory.createRefEval("B1", new NumberEval(3));
 		confirmMid(new StringEval("galactic"), aeStart, reNumChars, "ala");
 
 		confirmMid(new StringEval("galactic"), new NumberEval(3.1), BlankEval.INSTANCE, "");
@@ -85,7 +81,7 @@
 		confirmMid(new StringEval("galactic"), new NumberEval(3), BoolEval.FALSE, "");
 		confirmMid(new StringEval("galactic"), new NumberEval(3), BoolEval.TRUE, "l");
 		confirmMid(BlankEval.INSTANCE, new NumberEval(3), BoolEval.TRUE, "");
-	
+
 	}
 
 	/**
@@ -93,7 +89,7 @@
 	 */
 	public void testExtremes() {
 		confirmMid(new StringEval("galactic"), new NumberEval(4), new NumberEval(400), "actic");
-		
+
 		confirmMid(new StringEval("galactic"), new NumberEval(30), new NumberEval(4), "");
 		confirmMid(new StringEval("galactic"), new NumberEval(3), new NumberEval(0), "");
 	}
@@ -106,9 +102,9 @@
 		confirmMid(new StringEval("galactic"), ErrorEval.NAME_INVALID, new NumberEval(4), ErrorEval.NAME_INVALID);
 		confirmMid(new StringEval("galactic"), new NumberEval(3), ErrorEval.NAME_INVALID, ErrorEval.NAME_INVALID);
 		confirmMid(new StringEval("galactic"), ErrorEval.DIV_ZERO, ErrorEval.NAME_INVALID, ErrorEval.DIV_ZERO);
-		
+
 		confirmMid(new StringEval("galactic"), BlankEval.INSTANCE, new NumberEval(3.1), ErrorEval.VALUE_INVALID);
-		
+
 		confirmMid(new StringEval("galactic"), new NumberEval(0), new NumberEval(4), ErrorEval.VALUE_INVALID);
 		confirmMid(new StringEval("galactic"), new NumberEval(1), new NumberEval(-1), ErrorEval.VALUE_INVALID);
 	}

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestSumproduct.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestSumproduct.java?rev=692907&r1=692906&r2=692907&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestSumproduct.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestSumproduct.java Sun Sep  7 10:34:36 2008
@@ -17,18 +17,16 @@
 
 package org.apache.poi.hssf.record.formula.functions;
 
-import org.apache.poi.hssf.record.formula.RefPtg;
+import junit.framework.TestCase;
+
 import org.apache.poi.hssf.record.formula.eval.AreaEval;
 import org.apache.poi.hssf.record.formula.eval.ErrorEval;
 import org.apache.poi.hssf.record.formula.eval.Eval;
 import org.apache.poi.hssf.record.formula.eval.NumberEval;
 import org.apache.poi.hssf.record.formula.eval.NumericValueEval;
-import org.apache.poi.hssf.record.formula.eval.Ref2DEval;
 import org.apache.poi.hssf.record.formula.eval.RefEval;
 import org.apache.poi.hssf.record.formula.eval.ValueEval;
 
-import junit.framework.TestCase;
-
 /**
  * Test cases for SUMPRODUCT()
  * 
@@ -50,7 +48,7 @@
 
 	public void testScalarSimple() {
 
-		RefEval refEval = new Ref2DEval(new RefPtg("A1"), new NumberEval(3));
+		RefEval refEval = EvalFactory.createRefEval("A1", new NumberEval(3));
 		Eval[] args = {
 			refEval, 
 			new NumberEval(2),
@@ -113,7 +111,6 @@
 		};
 		AreaEval aeA = EvalFactory.createAreaEval("A1:A2", aValues);
 		AreaEval aeB = EvalFactory.createAreaEval("B1:B2", new ValueEval[2]);
-		aeB.getValues()[1] = ErrorEval.REF_INVALID;
 
 		Eval[] args = { aeA, aeB, };
 		assertEquals(ErrorEval.REF_INVALID, invokeSumproduct(args));

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestTFunc.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestTFunc.java?rev=692907&r1=692906&r2=692907&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestTFunc.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestTFunc.java Sun Sep  7 10:34:36 2008
@@ -17,18 +17,16 @@
 
 package org.apache.poi.hssf.record.formula.functions;
 
-import org.apache.poi.hssf.record.formula.RefPtg;
+import junit.framework.TestCase;
+
 import org.apache.poi.hssf.record.formula.eval.BlankEval;
 import org.apache.poi.hssf.record.formula.eval.BoolEval;
 import org.apache.poi.hssf.record.formula.eval.ErrorEval;
 import org.apache.poi.hssf.record.formula.eval.Eval;
 import org.apache.poi.hssf.record.formula.eval.NumberEval;
-import org.apache.poi.hssf.record.formula.eval.Ref2DEval;
 import org.apache.poi.hssf.record.formula.eval.StringEval;
 import org.apache.poi.hssf.record.formula.eval.ValueEval;
 
-import junit.framework.TestCase;
-
 /**
  * Test cases for Excel function T()
  * 
@@ -50,7 +48,7 @@
 	 * where cell A1 has the specified innerValue
 	 */
 	private Eval invokeTWithReference(ValueEval innerValue) {
-		Eval arg = new Ref2DEval(new RefPtg((short)1, (short)1, false, false), innerValue);
+		Eval arg = EvalFactory.createRefEval("$B$2", innerValue);
 		return invokeT(arg);
 	}
 	

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestXYNumericFunction.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestXYNumericFunction.java?rev=692907&r1=692906&r2=692907&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestXYNumericFunction.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestXYNumericFunction.java Sun Sep  7 10:34:36 2008
@@ -19,8 +19,6 @@
 
 import junit.framework.TestCase;
 
-import org.apache.poi.hssf.record.formula.AreaPtg;
-import org.apache.poi.hssf.record.formula.eval.Area2DEval;
 import org.apache.poi.hssf.record.formula.eval.ErrorEval;
 import org.apache.poi.hssf.record.formula.eval.Eval;
 import org.apache.poi.hssf.record.formula.eval.NumberEval;
@@ -100,7 +98,7 @@
 
 	private static ValueEval createAreaEval(ValueEval[] values) {
 		String refStr = "A1:A" + values.length;
-		return new Area2DEval(new AreaPtg(refStr), values);
+		return EvalFactory.createAreaEval(refStr, values);
 	}
 
 	public void testErrors() {

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestNamedRange.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestNamedRange.java?rev=692907&r1=692906&r2=692907&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestNamedRange.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestNamedRange.java Sun Sep  7 10:34:36 2008
@@ -24,8 +24,8 @@
 import junit.framework.TestCase;
 
 import org.apache.poi.hssf.HSSFTestDataSamples;
-import org.apache.poi.hssf.util.AreaReference;
-import org.apache.poi.hssf.util.CellReference;
+import org.apache.poi.ss.util.AreaReference;
+import org.apache.poi.ss.util.CellReference;
 
 /**
  * 

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/util/TestAreaReference.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/util/TestAreaReference.java?rev=692907&r1=692906&r2=692907&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/util/TestAreaReference.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/util/TestAreaReference.java Sun Sep  7 10:34:36 2008
@@ -34,6 +34,8 @@
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.util.AreaReference;
+import org.apache.poi.ss.util.CellReference;
 /**
  * 
  */

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/util/TestCellReference.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/util/TestCellReference.java?rev=692907&r1=692906&r2=692907&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/util/TestCellReference.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/util/TestCellReference.java Sun Sep  7 10:34:36 2008
@@ -20,7 +20,8 @@
 
 import junit.framework.TestCase;
 
-import org.apache.poi.hssf.util.CellReference.NameType;
+import org.apache.poi.ss.util.CellReference;
+import org.apache.poi.ss.util.CellReference.NameType;
 
 
 public final class TestCellReference extends TestCase {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org