1 16 package org.apache.commons.math.stat.descriptive.moment; 17 18 import junit.framework.Test; 19 import junit.framework.TestSuite; 20 21 import org.apache.commons.math.stat.descriptive.StorelessUnivariateStatisticAbstractTest; 22 import org.apache.commons.math.stat.descriptive.UnivariateStatistic; 23 24 29 public class SkewnessTest extends StorelessUnivariateStatisticAbstractTest{ 30 31 protected Skewness stat; 32 33 36 public SkewnessTest(String name) { 37 super(name); 38 } 39 40 43 public UnivariateStatistic getUnivariateStatistic() { 44 return new Skewness(); 45 } 46 47 public static Test suite() { 48 TestSuite suite = new TestSuite(SkewnessTest.class); 49 suite.setName("Skewness Tests"); 50 return suite; 51 } 52 53 56 public double expectedValue() { 57 return this.skew; 58 } 59 60 64 public void testNaN() { 65 Skewness skew = new Skewness(); 66 assertTrue(Double.isNaN(skew.getResult())); 67 skew.increment(1d); 68 assertTrue(Double.isNaN(skew.getResult())); 69 skew.increment(1d); 70 assertTrue(Double.isNaN(skew.getResult())); 71 skew.increment(1d); 72 assertFalse(Double.isNaN(skew.getResult())); 73 } 74 75 } 76 | Popular Tags |