mirror of
https://github.com/apache/commons-math.git
synced 2025-02-06 10:09:26 +00:00
Added test to verify that all statistics evaluate on array segments correctly. JIRA: MATH-704.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1206668 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
118f0cc085
commit
f4e3854e2f
@ -17,6 +17,7 @@ s * Unless required by applicable law or agreed to in writing, software
|
||||
package org.apache.commons.math.stat.descriptive;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@ -99,6 +100,17 @@ public abstract class UnivariateStatisticAbstractTest {
|
||||
getUnivariateStatistic().evaluate(testArray),
|
||||
getTolerance());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvaluateArraySegment() {
|
||||
final UnivariateStatistic stat = getUnivariateStatistic();
|
||||
final double[] arrayZero = Arrays.copyOfRange(testArray, 0, 5);
|
||||
Assert.assertEquals(stat.evaluate(arrayZero), stat.evaluate(testArray, 0, 5), 0);
|
||||
final double[] arrayOne = Arrays.copyOfRange(testArray, 5, 10);
|
||||
Assert.assertEquals(stat.evaluate(arrayOne), stat.evaluate(testArray, 5, 5), 0);
|
||||
final double[] arrayEnd = Arrays.copyOfRange(testArray, testArray.length - 5, testArray.length);
|
||||
Assert.assertEquals(stat.evaluate(arrayEnd), stat.evaluate(testArray, testArray.length - 5, 5), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCopy() throws Exception {
|
||||
|
Loading…
x
Reference in New Issue
Block a user