Merge several bug tests into one file
[poi.git] / src / scratchpad / testcases / org / apache / poi / hssf / record / formula / eval / TestUnaryPlusEval.java
blob724c54cd903a56a8e4cf854b492ee135d63ab9d2
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 package org.apache.poi.hssf.record.formula.eval;
21 import org.apache.poi.hssf.record.formula.AreaPtg;
22 import org.apache.poi.hssf.record.formula.UnaryPlusPtg;
23 import org.apache.poi.hssf.record.formula.functions.NumericFunctionInvoker;
25 import junit.framework.TestCase;
27 /**
28 * Test for unary plus operator evaluator.
30 * @author Josh Micich
32 public final class TestUnaryPlusEval extends TestCase {
34 /**
35 * Test for bug observable at svn revision 618865 (5-Feb-2008)<br/>
36 * The code for handling column operands had been copy-pasted from the row handling code.
38 public void testColumnOperand() {
40 short firstRow = (short)8;
41 short lastRow = (short)12;
42 short colNum = (short)5;
43 AreaPtg areaPtg = new AreaPtg(firstRow, lastRow, colNum, colNum, false, false, false, false);
44 ValueEval[] values = {
45 new NumberEval(27),
46 new NumberEval(29),
47 new NumberEval(35), // value in row 10
48 new NumberEval(37),
49 new NumberEval(38),
51 Eval areaEval = new Area2DEval(areaPtg, values);
52 Eval[] args = {
53 areaEval,
56 double result = NumericFunctionInvoker.invoke(new UnaryPlusEval(new UnaryPlusPtg()), args, 10, (short)20);
58 assertEquals(35, result, 0);