r35090 - in /branches/upstream/libstatistics-descriptive-perl/current: Build.PL Changes MANIFEST META.yml Makefile.PL inc/ inc/Test/ inc/Test/Run/ inc/Test/Run/Builder.pm lib/Statistics/Descriptive.pm t/descr.t

ryan52-guest at users.alioth.debian.org ryan52-guest at users.alioth.debian.org
Sat May 9 22:26:33 UTC 2009


Author: ryan52-guest
Date: Sat May  9 22:26:24 2009
New Revision: 35090

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=35090
Log:
[svn-upgrade] Integrating new upstream version, libstatistics-descriptive-perl (2.8)

Added:
    branches/upstream/libstatistics-descriptive-perl/current/inc/
    branches/upstream/libstatistics-descriptive-perl/current/inc/Test/
    branches/upstream/libstatistics-descriptive-perl/current/inc/Test/Run/
    branches/upstream/libstatistics-descriptive-perl/current/inc/Test/Run/Builder.pm
Modified:
    branches/upstream/libstatistics-descriptive-perl/current/Build.PL
    branches/upstream/libstatistics-descriptive-perl/current/Changes
    branches/upstream/libstatistics-descriptive-perl/current/MANIFEST
    branches/upstream/libstatistics-descriptive-perl/current/META.yml
    branches/upstream/libstatistics-descriptive-perl/current/Makefile.PL
    branches/upstream/libstatistics-descriptive-perl/current/lib/Statistics/Descriptive.pm
    branches/upstream/libstatistics-descriptive-perl/current/t/descr.t

Modified: branches/upstream/libstatistics-descriptive-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstatistics-descriptive-perl/current/Build.PL?rev=35090&op=diff
==============================================================================
--- branches/upstream/libstatistics-descriptive-perl/current/Build.PL (original)
+++ branches/upstream/libstatistics-descriptive-perl/current/Build.PL Sat May  9 22:26:24 2009
@@ -1,14 +1,18 @@
 use strict;
 use warnings;
-use Module::Build;
 
-my $builder = Module::Build->new(
+use lib "./inc";
+
+use Test::Run::Builder;
+
+my $builder = Test::Run::Builder->new(
     module_name         => 'Statistics::Descriptive',
     license             => 'perl',
     dist_author         => 'Shlomi Fish <shlomif at iglu.org.il>',
     dist_version_from   => 'lib/Statistics/Descriptive.pm',
     build_requires => {
         'Benchmark' => 0,
+        'lib' => 0,
         'Test::More' => 0,
     },
     requires => {

Modified: branches/upstream/libstatistics-descriptive-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstatistics-descriptive-perl/current/Changes?rev=35090&op=diff
==============================================================================
--- branches/upstream/libstatistics-descriptive-perl/current/Changes (original)
+++ branches/upstream/libstatistics-descriptive-perl/current/Changes Sat May  9 22:26:24 2009
@@ -1,4 +1,11 @@
 Revision history for Perl extension Statistics::Descriptive.
+
+2.8   May 09, 2009
+
+    - Enabled "./Build runtest" and "./Build distruntest" (using Test::Run)
+    in the distribution.
+
+    - Fixed incomplete/broken tests in t/descr.t.
 
 2.7   May 03, 2009
 

Modified: branches/upstream/libstatistics-descriptive-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstatistics-descriptive-perl/current/MANIFEST?rev=35090&op=diff
==============================================================================
--- branches/upstream/libstatistics-descriptive-perl/current/MANIFEST (original)
+++ branches/upstream/libstatistics-descriptive-perl/current/MANIFEST Sat May  9 22:26:24 2009
@@ -1,5 +1,6 @@
 Build.PL
 Changes
+inc/Test/Run/Builder.pm
 lib/Statistics/Descriptive.pm
 Makefile.PL
 MANIFEST

Modified: branches/upstream/libstatistics-descriptive-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstatistics-descriptive-perl/current/META.yml?rev=35090&op=diff
==============================================================================
--- branches/upstream/libstatistics-descriptive-perl/current/META.yml (original)
+++ branches/upstream/libstatistics-descriptive-perl/current/META.yml Sat May  9 22:26:24 2009
@@ -1,6 +1,6 @@
 ---
 name: Statistics-Descriptive
-version: 2.7
+version: 2.8
 author:
   - 'Shlomi Fish <shlomif at iglu.org.il>'
 abstract: Module of basic descriptive statistical functions.
@@ -18,10 +18,11 @@
 build_requires:
   Benchmark: 0
   Test::More: 0
+  lib: 0
 provides:
   Statistics::Descriptive:
     file: lib/Statistics/Descriptive.pm
-    version: 2.7
+    version: 2.8
   Statistics::Descriptive::Full:
     file: lib/Statistics/Descriptive.pm
   Statistics::Descriptive::Sparse:

Modified: branches/upstream/libstatistics-descriptive-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstatistics-descriptive-perl/current/Makefile.PL?rev=35090&op=diff
==============================================================================
--- branches/upstream/libstatistics-descriptive-perl/current/Makefile.PL (original)
+++ branches/upstream/libstatistics-descriptive-perl/current/Makefile.PL Sat May  9 22:26:24 2009
@@ -9,6 +9,7 @@
                            'Carp' => 0,
                            'POSIX' => 0,
                            'Test::More' => 0,
+                           'lib' => 0,
                            'strict' => 0,
                            'vars' => 0,
                            'warnings' => 0

Added: branches/upstream/libstatistics-descriptive-perl/current/inc/Test/Run/Builder.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstatistics-descriptive-perl/current/inc/Test/Run/Builder.pm?rev=35090&op=file
==============================================================================
--- branches/upstream/libstatistics-descriptive-perl/current/inc/Test/Run/Builder.pm (added)
+++ branches/upstream/libstatistics-descriptive-perl/current/inc/Test/Run/Builder.pm Sat May  9 22:26:24 2009
@@ -1,0 +1,76 @@
+package Test::Run::Builder;
+
+use strict;
+use warnings;
+
+use Module::Build;
+
+use vars qw(@ISA);
+
+ at ISA = (qw(Module::Build));
+
+sub ACTION_runtest
+{
+    my ($self) = @_;
+    my $p = $self->{properties};
+
+    $self->depends_on('code');
+
+    local @INC = @INC;
+
+    # Make sure we test the module in blib/
+    unshift @INC, (File::Spec->catdir($p->{base_dir}, $self->blib, 'lib'),
+		 File::Spec->catdir($p->{base_dir}, $self->blib, 'arch'));
+
+    $self->do_test_run_tests;
+}
+
+sub ACTION_distruntest {
+  my ($self) = @_;
+
+  $self->depends_on('distdir');
+
+  my $start_dir = $self->cwd;
+  my $dist_dir = $self->dist_dir;
+  chdir $dist_dir or die "Cannot chdir to $dist_dir: $!";
+  # XXX could be different names for scripts
+
+  $self->run_perl_script('Build.PL') # XXX Should this be run w/ --nouse-rcfile
+      or die "Error executing 'Build.PL' in dist directory: $!";
+  $self->run_perl_script('Build')
+      or die "Error executing 'Build' in dist directory: $!";
+  $self->run_perl_script('Build', [], ['runtest'])
+      or die "Error executing 'Build test' in dist directory";
+  chdir $start_dir;
+}
+
+sub do_test_run_tests
+{
+    my $self = shift;
+
+    require Test::Run::CmdLine::Iface;
+
+    my $test_run =
+        Test::Run::CmdLine::Iface->new(
+            {
+                'test_files' => [glob("t/*.t")],
+            }   
+            # 'backend_params' => $self->_get_backend_params(),
+        );
+
+    return $test_run->run();
+}
+
+sub ACTION_tags
+{
+    return 
+        system(qw(
+            ctags -f tags --recurse --totals
+    		--exclude=blib/ --exclude=t/lib
+    		--exclude=.svn --exclude='*~'
+    		--languages=Perl --langmap=Perl:+.t
+    ));
+}
+
+1;
+

Modified: branches/upstream/libstatistics-descriptive-perl/current/lib/Statistics/Descriptive.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstatistics-descriptive-perl/current/lib/Statistics/Descriptive.pm?rev=35090&op=diff
==============================================================================
--- branches/upstream/libstatistics-descriptive-perl/current/lib/Statistics/Descriptive.pm (original)
+++ branches/upstream/libstatistics-descriptive-perl/current/lib/Statistics/Descriptive.pm Sat May  9 22:26:24 2009
@@ -10,7 +10,7 @@
 		  ##Perl5.  01-03 weren't bug free.
 use vars (qw($VERSION $Tolerance));
 
-$VERSION = '2.7';
+$VERSION = '2.8';
 
 $Tolerance = 0.0;
 

Modified: branches/upstream/libstatistics-descriptive-perl/current/t/descr.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstatistics-descriptive-perl/current/t/descr.t?rev=35090&op=diff
==============================================================================
--- branches/upstream/libstatistics-descriptive-perl/current/t/descr.t (original)
+++ branches/upstream/libstatistics-descriptive-perl/current/t/descr.t Sat May  9 22:26:24 2009
@@ -9,6 +9,58 @@
 use Benchmark;
 use Statistics::Descriptive;
 
+sub compare_hash_by_ranges
+{
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
+    
+    my $got_hash_ref = shift;
+    my $expected = shift;
+    my $blurb = shift;
+
+    my $got = 
+        [
+            map { [$_, $got_hash_ref->{$_} ] }
+            sort { $a <=> $b }
+            keys(%$got_hash_ref)
+        ]
+        ;
+
+    my $success = 1;
+
+    if (scalar(@$expected) != scalar(@$got))
+    {
+        $success = 0;
+        diag("Number of keys differ in hashes.");
+    }
+    else
+    {
+        COMPARE_KEYS:
+        for my $idx (0 .. $#$got)
+        {
+            my ($got_key, $got_val) = @{$got->[$idx]};
+            my ($expected_bottom, $expected_top, $expected_val)
+                = @{$expected->[$idx]};
+            
+            if (! (    ($got_key >= $expected_bottom)
+                    && ($got_key <= $expected_top)
+                    && ($got_val == $expected_val)
+                )
+            )
+            {
+                $success = 0;
+                diag(<<"EOF");
+Key/Val pair No. $idx is out of range or wrong:
+Got: [$got_key, $got_val]
+Expected: [$expected_bottom, $expected_top, $expected_val]
+EOF
+                
+                last COMPARE_KEYS;
+            }
+        }
+    }
+
+    ok($success, $blurb);
+}
 # print "1..14\n";
 
 # test #1
@@ -73,6 +125,8 @@
 ok (scalar(abs( $single_result - 1.6363 ) < 0.001),
     "test normal function of harmonic mean",
 );
+
+
 
 # test #7
 # test stringification of hash keys in frequency distribution
@@ -84,9 +138,10 @@
 my %f = $stat->frequency_distribution(2);
 
 # TEST
-ok ((($f{0.216666666666667} == 3) &&
-      ($f{0.333333333333333} == 1)),
-    "test stringification of hash keys in frequency distribution"
+compare_hash_by_ranges(
+    \%f,
+    [[0.216666,0.216667,3],[0.3333,0.3334,1]],
+    "Test stringification of hash keys in frequency distribution",
 );
 
 # test #8
@@ -116,14 +171,16 @@
 %f = $stat->frequency_distribution(\@freq_bins);
 
 # TEST
-ok (
-    (($f{20} == 3) &&
-      ($f{40} == 5) &&
-      ($f{60} == 1) &&
-      ($f{80} == 1) &&
-      ($f{100} == 0)
-    ),
-    "test the frequency distribution with specified bins"
+is_deeply(
+    \%f,
+    {
+        20 => 3,
+        40 => 5,
+        60 => 1,
+        80 => 1,
+        100 => 0,
+    },
+    "Test the frequency distribution with specified bins"
 );
 
 # test #10 and #11




More information about the Pkg-perl-cvs-commits mailing list