commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject cvs commit: jakarta-commons/math/src/test/org/apache/commons/math/stat FrequencyTest.java
Date Sun, 07 Mar 2004 00:57:11 GMT
psteitz     2004/03/06 16:57:11

  Modified:    math/src/test/org/apache/commons/math/stat
                        FrequencyTest.java
  Log:
  Added test cases corresponding to examples in the User Guide.
  
  Revision  Changes    Path
  1.12      +25 -3     jakarta-commons/math/src/test/org/apache/commons/math/stat/FrequencyTest.java
  
  Index: FrequencyTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/FrequencyTest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- FrequencyTest.java	21 Feb 2004 21:35:17 -0000	1.11
  +++ FrequencyTest.java	7 Mar 2004 00:57:11 -0000	1.12
  @@ -69,10 +69,32 @@
           assertEquals("zero cumulative frequency", 0, f.getCumFreq(0));
           assertEquals("one cumulative frequency", 3,  f.getCumFreq(1));
           assertEquals("two cumulative frequency", 4,  f.getCumFreq(2));
  -        assertEquals("two cumulative frequency", 4,  f.getCumFreq(5));
  -        assertEquals("two cumulative frequency", 0,  f.getCumFreq("foo"));
  +        assertEquals("five cumulative frequency", 4,  f.getCumFreq(5));
  +        assertEquals("foo cumulative frequency", 0,  f.getCumFreq("foo"));
  +        
           f.clear();
           assertEquals("total count",0,f.getSumFreq());
  +        
  +        // userguide examples -------------------------------------------------------------------
  +        f.addValue("one");
  +        f.addValue("One");
  +        f.addValue("oNe");
  +        f.addValue("Z");
  +        assertEquals("one cumulative frequency", 1 ,  f.getCount("one"));
  +        assertEquals("Z cumulative pct", 0.5,  f.getCumPct("Z"), tolerance);
  +        assertEquals("z cumulative pct", 1.0,  f.getCumPct("z"), tolerance);
  +        assertEquals("Ot cumulative pct", 0.25,  f.getCumPct("Ot"), tolerance);
  +        f.clear();
  +        
  +        f = null;
  +        f = new Frequency(String.CASE_INSENSITIVE_ORDER);
  +        f.addValue("one");
  +        f.addValue("One");
  +        f.addValue("oNe");
  +        f.addValue("Z");
  +        assertEquals("one count", 3 ,  f.getCount("one"));
  +        assertEquals("Z cumulative pct -- case insensitive", 1 ,  f.getCumPct("Z"), tolerance);
  +        assertEquals("z cumulative pct -- case insensitive", 1 ,  f.getCumPct("z"), tolerance);
       }     
       
       /** test pcts */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message