|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.pmd.stat.StatisticalRuleTest
public class StatisticalRuleTest
This class tests the Statistical Rules in PMD.
The idea is, that we fill up 999 datapoints into the Stat Rule, and then throw random parameters at it. The three parameters which are checked are: sigma - # Sigmas over the mean. topscore - Only the top 5 or so items. minimum - Only things of score 10 or better When more than one parameter is lumped together, then we expect the one which would return the fewest to determine what gets sent back. So, we throw each collection of parameters, where each one is a different order into the system. We check the results off of what the smallest value should be. If you are going to work with StatisticalRule any, please bump the "NUM_TESTS" number up to something like 128. That way you are more likely to identify problems. It is set low now to make building and running tests easier (when we aren't touching the file.) Note also, that when verifying the Sigma, I wasn't quite able to determine how many results it would return (it would vary from -2 to 2 of what I expected.) That is what the delta parameter on the verify method takes. If you can figure it out exactly, (without stealing code from the StatRule) then feel free to change it and tighten the deltas.
Field Summary | |
---|---|
static double |
DELTA
|
static double |
MAX_MINIMUM
|
static double |
MAX_SIGMA
|
static double |
MEAN
|
static int |
MIN_TOPSCORE
|
static double |
NO_MINIMUM
|
static double |
NO_SIGMA
|
static int |
NO_TOPSCORE
|
static int |
NUM_TESTS
|
static double |
SIGMA
|
Constructor Summary | |
---|---|
StatisticalRuleTest()
|
Method Summary | |
---|---|
int |
expectedMinimum(double minimum)
This returns the expected number of reports. |
int |
expectedSigma(double sigma)
This returns the expected number of results when the Sigma rating is the smallest. |
int |
expectedTopScore(int target)
This will return the expected number of results with the given Top Score. |
Report |
makeReport(Rule IUT)
|
double |
randomMinimum()
This generates a random minimum value for testing. |
double |
randomMinimum(int minimum)
This generates a random minimum value for which fewer results would be returned. |
double |
randomSigma()
This returns a Random value for Sigma which will return some values. |
double |
randomSigma(int minimum)
This returns a Random value for Sigma which value is greater than the parameter. |
int |
randomTopScore()
This returns a random value for Top Score. |
int |
randomTopScore(double target)
This will return a random value for the Top Score which will return more than the minimum provided. |
void |
setUp()
|
static junit.framework.Test |
suite()
|
void |
testExpectedMinimum()
|
void |
testM()
|
void |
testM1()
|
void |
testM2()
|
void |
testM3()
|
void |
testM4()
|
void |
testM5()
|
void |
testMetrics()
This test verifies that the Stat rule creates a Metric, with the proper values. |
void |
testMS()
|
void |
testMS1()
|
void |
testMS2()
|
void |
testMS3()
|
void |
testMS4()
|
void |
testMS5()
|
void |
testMT()
|
void |
testMT1()
|
void |
testMT2()
|
void |
testMT3()
|
void |
testMT4()
|
void |
testMT5()
|
void |
testS()
|
void |
testS1()
|
void |
testS2()
|
void |
testS3()
|
void |
testS4()
|
void |
testS5()
|
void |
testSingleDatapoint()
|
void |
testSM()
|
void |
testSM1()
|
void |
testSM2()
|
void |
testSM3()
|
void |
testSM4()
|
void |
testSM5()
|
void |
testSMT()
|
void |
testSMT1()
|
void |
testSMT2()
|
void |
testSMT3()
|
void |
testSMT4()
|
void |
testSMT5()
|
void |
testST()
|
void |
testST1()
|
void |
testST2()
|
void |
testST3()
|
void |
testST4()
|
void |
testST5()
|
void |
testSTM()
|
void |
testSTM1()
|
void |
testSTM2()
|
void |
testSTM3()
|
void |
testSTM4()
|
void |
testSTM5()
|
void |
testT()
|
void |
testT1()
|
void |
testT2()
|
void |
testT3()
|
void |
testT4()
|
void |
testT5()
|
void |
testTM()
|
void |
testTM1()
|
void |
testTM2()
|
void |
testTM3()
|
void |
testTM4()
|
void |
testTM5()
|
void |
testTMS()
|
void |
testTMS1()
|
void |
testTMS2()
|
void |
testTMS3()
|
void |
testTMS4()
|
void |
testTMS5()
|
void |
testTS()
|
void |
testTS1()
|
void |
testTS2()
|
void |
testTS3()
|
void |
testTS4()
|
void |
testTS5()
|
void |
testTSM()
|
void |
testTSM1()
|
void |
testTSM2()
|
void |
testTSM3()
|
void |
testTSM4()
|
void |
testTSM5()
|
void |
verifyResults(double sigma,
double minimum,
int topScore,
int expected,
int delta)
Verifies what happens when you pass these parameters into the thing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double MAX_MINIMUM
public static final double NO_MINIMUM
public static final double MAX_SIGMA
public static final double NO_SIGMA
public static final int MIN_TOPSCORE
public static final int NO_TOPSCORE
public static final double MEAN
public static final double SIGMA
public static final int NUM_TESTS
public static final double DELTA
Constructor Detail |
---|
public StatisticalRuleTest()
Method Detail |
---|
public void setUp()
public void testMetrics() throws Throwable
Throwable
public double randomSigma()
public double randomSigma(int minimum)
public int expectedSigma(double sigma)
public double randomMinimum()
public double randomMinimum(int minimum)
public int expectedMinimum(double minimum)
public void testExpectedMinimum()
public int randomTopScore()
public int randomTopScore(double target)
public int expectedTopScore(int target)
public void testSingleDatapoint()
public void testS() throws Throwable
Throwable
public void testS1() throws Throwable
Throwable
public void testS2() throws Throwable
Throwable
public void testS3() throws Throwable
Throwable
public void testS4() throws Throwable
Throwable
public void testS5() throws Throwable
Throwable
public void testT() throws Throwable
Throwable
public void testT1() throws Throwable
Throwable
public void testT2() throws Throwable
Throwable
public void testT3() throws Throwable
Throwable
public void testT4() throws Throwable
Throwable
public void testT5() throws Throwable
Throwable
public void testM() throws Throwable
Throwable
public void testM1() throws Throwable
Throwable
public void testM2() throws Throwable
Throwable
public void testM3() throws Throwable
Throwable
public void testM4() throws Throwable
Throwable
public void testM5() throws Throwable
Throwable
public void testST() throws Throwable
Throwable
public void testST1() throws Throwable
Throwable
public void testST2() throws Throwable
Throwable
public void testST3() throws Throwable
Throwable
public void testST4() throws Throwable
Throwable
public void testST5() throws Throwable
Throwable
public void testTS() throws Throwable
Throwable
public void testTS1() throws Throwable
Throwable
public void testTS2() throws Throwable
Throwable
public void testTS3() throws Throwable
Throwable
public void testTS4() throws Throwable
Throwable
public void testTS5() throws Throwable
Throwable
public void testSM() throws Throwable
Throwable
public void testSM1() throws Throwable
Throwable
public void testSM2() throws Throwable
Throwable
public void testSM3() throws Throwable
Throwable
public void testSM4() throws Throwable
Throwable
public void testSM5() throws Throwable
Throwable
public void testMS() throws Throwable
Throwable
public void testMS1() throws Throwable
Throwable
public void testMS2() throws Throwable
Throwable
public void testMS3() throws Throwable
Throwable
public void testMS4() throws Throwable
Throwable
public void testMS5() throws Throwable
Throwable
public void testTM() throws Throwable
Throwable
public void testTM1() throws Throwable
Throwable
public void testTM2() throws Throwable
Throwable
public void testTM3() throws Throwable
Throwable
public void testTM4() throws Throwable
Throwable
public void testTM5() throws Throwable
Throwable
public void testMT() throws Throwable
Throwable
public void testMT1() throws Throwable
Throwable
public void testMT2() throws Throwable
Throwable
public void testMT3() throws Throwable
Throwable
public void testMT4() throws Throwable
Throwable
public void testMT5() throws Throwable
Throwable
public void testSTM() throws Throwable
Throwable
public void testSTM1() throws Throwable
Throwable
public void testSTM2() throws Throwable
Throwable
public void testSTM3() throws Throwable
Throwable
public void testSTM4() throws Throwable
Throwable
public void testSTM5() throws Throwable
Throwable
public void testSMT() throws Throwable
Throwable
public void testSMT1() throws Throwable
Throwable
public void testSMT2() throws Throwable
Throwable
public void testSMT3() throws Throwable
Throwable
public void testSMT4() throws Throwable
Throwable
public void testSMT5() throws Throwable
Throwable
public void testTSM() throws Throwable
Throwable
public void testTSM1() throws Throwable
Throwable
public void testTSM2() throws Throwable
Throwable
public void testTSM3() throws Throwable
Throwable
public void testTSM4() throws Throwable
Throwable
public void testTSM5() throws Throwable
Throwable
public void testTMS() throws Throwable
Throwable
public void testTMS1() throws Throwable
Throwable
public void testTMS2() throws Throwable
Throwable
public void testTMS3() throws Throwable
Throwable
public void testTMS4() throws Throwable
Throwable
public void testTMS5() throws Throwable
Throwable
public void verifyResults(double sigma, double minimum, int topScore, int expected, int delta)
public Report makeReport(Rule IUT)
public static junit.framework.Test suite()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |