From 7953b0007a47fe25a463d5e27b50e3c50981f2e2 Mon Sep 17 00:00:00 2001 From: Luc Maisonobe Date: Sun, 10 Feb 2008 16:28:50 +0000 Subject: [PATCH] removed references to the StatisticalMultivariateSummaryValues class git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@620290 13f79535-47bb-0310-9956-ffa450edef68 --- .../MultivariateSummaryStatisticsTest.java | 43 +------------------ 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/src/test/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatisticsTest.java b/src/test/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatisticsTest.java index 2f3d15190..b2b3d5e6e 100644 --- a/src/test/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatisticsTest.java +++ b/src/test/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatisticsTest.java @@ -190,28 +190,12 @@ public class MultivariateSummaryStatisticsTest extends TestCase { } - public void testGetSummary() throws DimensionMismatchException { - MultivariateSummaryStatistics u = new MultivariateSummaryStatistics(2, true); - StatisticalMultivariateSummary summary = u.getSummary(); - verifySummary(u, summary); - u.addValue(new double[] { 1, 2 }); - summary = u.getSummary(); - verifySummary(u, summary); - u.addValue(new double[] { 2, 5 }); - summary = u.getSummary(); - verifySummary(u, summary); - u.addValue(new double[] { 2, 2 }); - summary = u.getSummary(); - verifySummary(u, summary); - } - public void testSerialization() throws DimensionMismatchException { MultivariateSummaryStatistics u = new MultivariateSummaryStatistics(2, true); // Empty test TestUtils.checkSerializedEquality(u); MultivariateSummaryStatistics s = (MultivariateSummaryStatistics) TestUtils.serializeAndRecover(u); - StatisticalMultivariateSummary summary = s.getSummary(); - verifySummary(u, summary); + assertEquals(u, s); // Add some data u.addValue(new double[] { 2d, 1d }); @@ -223,8 +207,7 @@ public class MultivariateSummaryStatisticsTest extends TestCase { // Test again TestUtils.checkSerializedEquality(u); s = (MultivariateSummaryStatistics) TestUtils.serializeAndRecover(u); - summary = s.getSummary(); - verifySummary(u, summary); + assertEquals(u, s); } @@ -269,26 +252,4 @@ public class MultivariateSummaryStatisticsTest extends TestCase { assertEquals(emptyHash, u.hashCode()); } - private void verifySummary(MultivariateSummaryStatistics u, StatisticalMultivariateSummary s) { - assertEquals(s.getN(), u.getN()); - for (int i = 0; i < u.getDimension(); ++i) { - checkValue(s.getSum()[i], u.getSum()[i], 1.0e-10); - checkValue(s.getStandardDeviation()[i], u.getStandardDeviation()[i], 1.0e-10); - checkValue(s.getMean()[i], u.getMean()[i], 1.0e-10); - checkValue(s.getMin()[i], u.getMin()[i], 1.0e-10); - checkValue(s.getMax()[i], u.getMax()[i], 1.0e-10); - checkValue(s.getSumSq()[i], u.getSumSq()[i], 1.0e-10); - checkValue(s.getSumLog()[i], u.getSumLog()[i], 1.0e-10); - checkValue(s.getMax()[i], u.getMax()[i], 1.0e-10); - } - } - - private void checkValue(double expected, double actual, double tolerance) { - if (Double.isNaN(expected)) { - assertTrue(Double.isNaN(actual)); - } else { - assertEquals(expected, actual, tolerance); - } - } - }