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
;
28 * Test for unary plus operator evaluator.
32 public final class TestUnaryPlusEval
extends TestCase
{
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
= {
47 new NumberEval(35), // value in row 10
51 Eval areaEval
= new Area2DEval(areaPtg
, values
);
56 double result
= NumericFunctionInvoker
.invoke(new UnaryPlusEval(new UnaryPlusPtg()), args
, 10, (short)20);
58 assertEquals(35, result
, 0);