Added a basic frequency distribution test. Note that in limited samples of
1000 across 5 bins that the distribution is not even. The highest and lowest bin seem to have about half the frequency of the other bins. This is due to the use of the round function. int would make the distribution more even (white) at the cost of not returning the limiting number.
This commit is contained in:
parent
7033959b5e
commit
2eaea55041
1 changed files with 14 additions and 1 deletions
|
|
@ -28,7 +28,7 @@ use Data::Dumper;
|
|||
##Note, testing statistical functions is kind of weird. All we really
|
||||
##need to do is make sure that the macro functions as advertised.
|
||||
|
||||
plan tests => 3;
|
||||
plan tests => 4;
|
||||
|
||||
unless ($session->config->get('macros')->{'Splat_random'}) {
|
||||
Macro_Config::insert_macro($session, '*', 'Splat_random');
|
||||
|
|
@ -64,3 +64,16 @@ WHOLE: for (my $i=0; $i<=99; $i++) {
|
|||
|
||||
ok($wholeNumber, "100 fetches were all whole numbers");
|
||||
|
||||
my @bins = ();
|
||||
WHOLE: for (my $i=0; $i<=999; $i++) {
|
||||
my $output = sprintf $macroText, 4;
|
||||
WebGUI::Macro::process($session, \$output);
|
||||
++$bins[$output];
|
||||
}
|
||||
|
||||
is(scalar(@bins), 5, "All bins have values on a sample size of 1000");
|
||||
|
||||
##Early work in analyzing a frequency distribution showed that the highest
|
||||
##and lowest bin have half the frequency of center bins. Splat_random doesn't
|
||||
##seem very random
|
||||
#diag Dumper \@bins;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue