aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/ss/formula
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2018-12-25 09:59:58 +0000
committerDominik Stadler <centic@apache.org>2018-12-25 09:59:58 +0000
commit19884d0ca33018d1e417fafd253ec63cf8c31ccd (patch)
tree4d62b20301f3c4cb1c5995742d27fa6a6068dd34 /src/testcases/org/apache/poi/ss/formula
parent7421bc9a17d6f3803d2d9e44e6535d6004a6090b (diff)
downloadpoi-19884d0ca33018d1e417fafd253ec63cf8c31ccd.tar.gz
poi-19884d0ca33018d1e417fafd253ec63cf8c31ccd.zip
Code-style: Unify how arrays are specified from C-style to normal Java-style
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1849716 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ss/formula')
-rw-r--r--src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java40
-rw-r--r--src/testcases/org/apache/poi/ss/formula/functions/TestEOMonth.java14
-rw-r--r--src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java7
-rw-r--r--src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java2
4 files changed, 33 insertions, 30 deletions
diff --git a/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java b/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java
index 365d1352cc..aba965bbf6 100644
--- a/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java
+++ b/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java
@@ -50,25 +50,25 @@ public class TestWorkdayFunction {
@Test
public void testFailWhenNoArguments() {
- ValueEval ve[] = new ValueEval[0];
+ ValueEval[] ve = new ValueEval[0];
assertEquals(VALUE_INVALID, WorkdayFunction.instance.evaluate(ve, null));
}
@Test
public void testFailWhenLessThan2Arguments() {
- ValueEval ve[] = new ValueEval[1];
+ ValueEval[] ve = new ValueEval[1];
assertEquals(VALUE_INVALID, WorkdayFunction.instance.evaluate(ve, null));
}
@Test
public void testFailWhenMoreThan3Arguments() {
- ValueEval ve[] = new ValueEval[4];
+ ValueEval[] ve = new ValueEval[4];
assertEquals(VALUE_INVALID, WorkdayFunction.instance.evaluate(ve, null));
}
@Test
public void testFailWhenArgumentsAreNotDatesNorNumbers() {
- ValueEval ve[] = { new StringEval("Potato"), new StringEval("Cucumber") };
+ ValueEval[] ve = {new StringEval("Potato"), new StringEval("Cucumber")};
assertEquals(VALUE_INVALID, WorkdayFunction.instance.evaluate(ve, EC));
}
@@ -76,7 +76,7 @@ public class TestWorkdayFunction {
public void testReturnWorkdays() {
Calendar expCal = LocaleUtil.getLocaleCalendar(2009, 3, 30);
Date expDate = expCal.getTime();
- ValueEval ve[] = { new StringEval(STARTING_DATE), new NumberEval(151) };
+ ValueEval[] ve = {new StringEval(STARTING_DATE), new NumberEval(151)};
Date actDate = DateUtil.getJavaDate(((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue());
assertEquals(expDate, actDate);
}
@@ -86,7 +86,7 @@ public class TestWorkdayFunction {
Calendar expCal = LocaleUtil.getLocaleCalendar(2013, 8, 27);
Date expDate = expCal.getTime();
- ValueEval ve[] = { new StringEval("2013/09/30"), new NumberEval(-1) };
+ ValueEval[] ve = {new StringEval("2013/09/30"), new NumberEval(-1)};
double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue();
assertEquals(41544.0, numberValue, 0);
@@ -98,8 +98,8 @@ public class TestWorkdayFunction {
public void testReturnWorkdaysSpanningAWeekendAddingDays() {
Calendar expCal = LocaleUtil.getLocaleCalendar(2013, 8, 30);
Date expDate = expCal.getTime();
-
- ValueEval ve[] = { new StringEval("2013/09/27"), new NumberEval(1) };
+
+ ValueEval[] ve = {new StringEval("2013/09/27"), new NumberEval(1)};
double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue();
assertEquals(41547.0, numberValue, 0);
@@ -111,8 +111,8 @@ public class TestWorkdayFunction {
public void testReturnWorkdaysWhenStartIsWeekendAddingDays() {
Calendar expCal = LocaleUtil.getLocaleCalendar(2013, 9, 7);
Date expDate = expCal.getTime();
-
- ValueEval ve[] = { new StringEval("2013/10/06"), new NumberEval(1) };
+
+ ValueEval[] ve = {new StringEval("2013/10/06"), new NumberEval(1)};
double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue();
assertEquals(41554.0, numberValue, 0);
@@ -124,8 +124,8 @@ public class TestWorkdayFunction {
public void testReturnWorkdaysWhenStartIsWeekendSubtractingDays() {
Calendar expCal = LocaleUtil.getLocaleCalendar(2013, 9, 4);
Date expDate = expCal.getTime();
-
- ValueEval ve[] = { new StringEval("2013/10/06"), new NumberEval(-1) };
+
+ ValueEval[] ve = {new StringEval("2013/10/06"), new NumberEval(-1)};
double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue();
assertEquals(41551.0, numberValue, 0);
@@ -137,8 +137,8 @@ public class TestWorkdayFunction {
public void testReturnWorkdaysWithDaysTruncated() {
Calendar expCal = LocaleUtil.getLocaleCalendar(2009, 3, 30);
Date expDate = expCal.getTime();
-
- ValueEval ve[] = { new StringEval(STARTING_DATE), new NumberEval(151.99999) };
+
+ ValueEval[] ve = {new StringEval(STARTING_DATE), new NumberEval(151.99999)};
double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue();
Date actDate = DateUtil.getJavaDate(numberValue);
@@ -149,8 +149,8 @@ public class TestWorkdayFunction {
public void testReturnRetroativeWorkday() {
Calendar expCal = LocaleUtil.getLocaleCalendar(2008, 8, 23);
Date expDate = expCal.getTime();
-
- ValueEval ve[] = { new StringEval(STARTING_DATE), new NumberEval(-5), new StringEval(RETROATIVE_HOLIDAY) };
+
+ ValueEval[] ve = {new StringEval(STARTING_DATE), new NumberEval(-5), new StringEval(RETROATIVE_HOLIDAY)};
double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue();
Date actDate = DateUtil.getJavaDate(numberValue);
@@ -161,10 +161,10 @@ public class TestWorkdayFunction {
public void testReturnNetworkdaysWithManyHolidays() {
Calendar expCal = LocaleUtil.getLocaleCalendar(2009, 4, 5);
Date expDate = expCal.getTime();
-
- ValueEval ve[] = {
- new StringEval(STARTING_DATE), new NumberEval(151),
- new MockAreaEval(FIRST_HOLIDAY, SECOND_HOLIDAY, THIRD_HOLIDAY) };
+
+ ValueEval[] ve = {
+ new StringEval(STARTING_DATE), new NumberEval(151),
+ new MockAreaEval(FIRST_HOLIDAY, SECOND_HOLIDAY, THIRD_HOLIDAY)};
double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue();
Date actDate = DateUtil.getJavaDate(numberValue);
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestEOMonth.java b/src/testcases/org/apache/poi/ss/formula/functions/TestEOMonth.java
index 71c49cf753..8fbfa69961 100644
--- a/src/testcases/org/apache/poi/ss/formula/functions/TestEOMonth.java
+++ b/src/testcases/org/apache/poi/ss/formula/functions/TestEOMonth.java
@@ -68,7 +68,7 @@ public class TestEOMonth {
}
private void checkValue(double startDate, int monthInc, double expectedResult) {
- ValueEval ve[] = {new NumberEval(startDate), new NumberEval(monthInc)};
+ ValueEval[] ve = {new NumberEval(startDate), new NumberEval(monthInc)};
NumberEval result = (NumberEval) eOMonth.evaluate(ve, ec);
assertEquals(expectedResult, result.getNumberValue(), 0);
}
@@ -107,10 +107,10 @@ public class TestEOMonth {
cal.clear(Calendar.SECOND);
cal.clear(Calendar.MILLISECOND);
Date expDate = cal.getTime();
-
- ValueEval ve[] = {
- new NumberEval(DateUtil.getExcelDate(startDate)),
- new NumberEval(offset)
+
+ ValueEval[] ve = {
+ new NumberEval(DateUtil.getExcelDate(startDate)),
+ new NumberEval(offset)
};
NumberEval result = (NumberEval) eOMonth.evaluate(ve, ec);
Date actDate = DateUtil.getJavaDate(result.getNumberValue());
@@ -121,14 +121,14 @@ public class TestEOMonth {
@Test
public void testBug56688() {
- ValueEval ve[] = {new NumberEval(DATE_1902_09_26), new RefEvalImplementation(new NumberEval(0))};
+ ValueEval[] ve = {new NumberEval(DATE_1902_09_26), new RefEvalImplementation(new NumberEval(0))};
NumberEval result = (NumberEval) eOMonth.evaluate(ve, ec);
assertEquals(DATE_1902_09_30, result.getNumberValue(), 0);
}
@Test
public void testRefEvalStartDate() {
- ValueEval ve[] = {new RefEvalImplementation(new NumberEval(DATE_1902_09_26)), new NumberEval(0)};
+ ValueEval[] ve = {new RefEvalImplementation(new NumberEval(DATE_1902_09_26)), new NumberEval(0)};
NumberEval result = (NumberEval) eOMonth.evaluate(ve, ec);
assertEquals(DATE_1902_09_30, result.getNumberValue(), 0);
}
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java b/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java
index 90300bf240..dc47830727 100644
--- a/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java
+++ b/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java
@@ -70,8 +70,11 @@ public class TestFinanceLib extends AbstractNumericTestCase {
}
public void testNpv() {
- double r, v[], npv, x;
-
+ double r;
+ double[] v;
+ double npv;
+ double x;
+
r = 1; v = new double[]{100, 200, 300, 400};
npv = FinanceLib.npv(r, v);
x = 162.5;
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java b/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java
index 9054c6b0ae..41ca4b8e98 100644
--- a/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java
+++ b/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java
@@ -66,7 +66,7 @@ public final class TestSubtotal {
}
AreaEval arg1 = EvalFactory.createAreaEval("C1:D5", values);
- ValueEval args[] = { new NumberEval(function), arg1 };
+ ValueEval[] args = {new NumberEval(function), arg1};
ValueEval result = new Subtotal().evaluate(args, 0, 0);