Test non-Comparable parameters for Pct and CumPct

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1503629 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2013-07-16 09:34:38 +00:00
parent 91c5101c33
commit 43e4049d59
1 changed files with 14 additions and 0 deletions

View File

@ -199,6 +199,20 @@ public final class FrequencyTest {
Assert.assertTrue("cum pct, empty table", Double.isNaN(f.getCumPct(Integer.valueOf(0)))); Assert.assertTrue("cum pct, empty table", Double.isNaN(f.getCumPct(Integer.valueOf(0))));
} }
@Test
public void testNonComparableCumPct() {
f.addValue("a");
Assert.assertEquals("cum freq, single entry", 1.0d, f.getCumPct("a"),TOLERANCE);
Assert.assertEquals("cum freq, single entry non comparable", 0.0d, f.getCumPct(100),TOLERANCE);
}
@Test
public void testNonComparablePct() {
f.addValue("a");
Assert.assertEquals("cum freq, single entry", 1.0d, f.getPct("a"),TOLERANCE);
Assert.assertEquals("cum freq, single entry non comparable", 0.0d, f.getPct(100),TOLERANCE);
}
/** /**
* Tests toString() * Tests toString()
*/ */