View Javadoc
1 /*** 2 * Created on Aug 28, 2002 3 */ 4 package test.net.sourceforge.pmd.stat; 5 6 import junit.framework.TestCase; 7 import net.sourceforge.pmd.stat.Metric; 8 9 import java.util.Random; 10 11 /*** 12 * @author David Dixon-Peugh 13 */ 14 public class MetricTest extends TestCase { 15 private String testName = null; 16 private Random random = new Random(); 17 18 /*** 19 * Constructor for MetricTest. 20 * @param arg0 21 */ 22 public MetricTest(String arg0) { 23 super(arg0); 24 this.testName = arg0; 25 } 26 27 public void testGetMetricName() { 28 Metric IUT = new Metric(testName, 0, 0.0, 0.0, 0.0, 0.0, 0.0); 29 30 assertEquals(testName, IUT.getMetricName()); 31 } 32 33 public void testGetCount() { 34 int count = random.nextInt(); 35 Metric IUT = new Metric(testName, count, 0.0, 0.0, 0.0, 0.0, 0.0); 36 assertEquals(count, IUT.getCount()); 37 } 38 39 public void testGetTotal() { 40 double total = random.nextDouble(); 41 Metric IUT = new Metric(testName, 0, total, 0.0, 0.0, 0.0, 0.0); 42 assertEquals(total, IUT.getTotal(), 0.05); 43 } 44 45 public void testGetLowValue() { 46 double low = random.nextDouble(); 47 Metric IUT = new Metric(testName, 0, 0.0, low, 0.0, 0.0, 0.0); 48 assertEquals(low, IUT.getLowValue(), 0.05); 49 } 50 51 public void testGetHighValue() { 52 double high = random.nextDouble(); 53 Metric IUT = new Metric(testName, 0, 0.0, 0.0, high, 0.0, 0.0); 54 assertEquals(high, IUT.getHighValue(), 0.05); 55 } 56 57 public void testGetAverage() { 58 double mean = random.nextDouble(); 59 Metric IUT = new Metric(testName, 0, 0.0, 0.0, 0.0, mean, 0.0); 60 assertEquals(mean, IUT.getAverage(), 0.05); 61 } 62 63 public void testGetStandardDeviation() { 64 double stdev = random.nextDouble(); 65 Metric IUT = new Metric(testName, 0, 0.0, 0.0, 0.0, 0.0, stdev); 66 assertEquals(stdev, IUT.getStandardDeviation(), 0.05); 67 } 68 69 }

This page was automatically generated by Maven