Skip Menu |

This queue is for tickets about the Statistics-Descriptive CPAN distribution.

Report information
The Basics
Id: 83723
Status: resolved
Priority: 0/
Queue: Statistics-Descriptive

People
Owner: Nobody in particular
Requestors: SLAFFAN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: patch: add test for effect of adding new data
Hello Shlomi, While poking around with Stats::Descriptive::Full::add_data I noticed that the test suite does not contain explicit tests for the effect of adding new data. The attached patch does this. I was poking around to see if I could speed up the add_data sub. I'll submit a separate RT for that, though. Regards, Shawn.
Subject: patch_test_add_data.diff
diff -r a0205d94916c Statistics-Descriptive/t/descr.t --- a/Statistics-Descriptive/t/descr.t Tue May 15 19:44:26 2012 +0300 +++ b/Statistics-Descriptive/t/descr.t Sat Mar 02 19:14:24 2013 +1100 @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 54; +use Test::More tests => 55; use lib 't/lib'; use Utils qw/is_between compare_hash_by_ranges/; @@ -452,3 +452,38 @@ ); } + + +# what happens when we add new data? +{ + my $stat1 = Statistics::Descriptive::Full->new(); + my $stat2 = Statistics::Descriptive::Full->new(); + + my @data1 = (1 .. 9, 100); + my @data2 = (100 .. 110); + + # sample of methods + my @methods = qw /mean standard_deviation count skewness kurtosis median/; + + $stat1->add_data(@data1); # initialise + foreach my $meth (@methods) { # run some methods + $stat1->$meth; + } + $stat1->add_data(@data2); # add new data + foreach my $meth (@methods) { # re-run some methods + $stat1->$meth; + } + + $stat2->add_data(@data1, @data2); # initialise with all data + foreach my $meth (@methods) { # run some methods + $stat2->$meth; + } + + #TEST + is_deeply ( + $stat1, + $stat2, + 'stats consistent after adding new data', + ); + +}
The relevant changes were included via pull request #6 - https://bitbucket.org/shlomif/perl-statistics-descriptive/pull-request/6/make-the-methods-faster/diff This ticket can be closed. Thanks, Shawn. On Sat Mar 02 03:22:22 2013, SLAFFAN wrote: Show quoted text
> Hello Shlomi, > > While poking around with Stats::Descriptive::Full::add_data I noticed > that the test suite does not contain explicit tests for the effect of > adding new data. The attached patch does this. > > I was poking around to see if I could speed up the add_data sub. I'll > submit a separate RT for that, though. > > Regards, > Shawn. > >
On Wed Mar 26 22:00:01 2014, SLAFFAN wrote: Show quoted text
> The relevant changes were included via pull request #6 - > https://bitbucket.org/shlomif/perl-statistics-descriptive/pull- > request/6/make-the-methods-faster/diff > > This ticket can be closed. > > Thanks, > Shawn. >
Closing now then - thanks. Regards, -- Shlomi Fish Show quoted text
> > On Sat Mar 02 03:22:22 2013, SLAFFAN wrote:
> > Hello Shlomi, > > > > While poking around with Stats::Descriptive::Full::add_data I noticed > > that the test suite does not contain explicit tests for the effect of > > adding new data. The attached patch does this. > > > > I was poking around to see if I could speed up the add_data sub. > > I'll > > submit a separate RT for that, though. > > > > Regards, > > Shawn. > > > >