This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.33
in repository libmath-prime-util-perl.

commit 6190da43f645cb419df7117d2e3e07de7a16fbe5
Author: Dana Jacobsen <d...@acm.org>
Date:   Mon Oct 21 15:02:24 2013 -0700

    Tests for partition()
---
 MANIFEST          |  1 +
 TODO              |  5 +---
 t/24-partitions.t | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 90 insertions(+), 4 deletions(-)

diff --git a/MANIFEST b/MANIFEST
index 98e0a38..07f5c07 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -82,6 +82,7 @@ t/20-primorial.t
 t/21-conseq-lcm.t
 t/22-aks-prime.t
 t/23-primality-proofs.t
+t/24-partitions.t
 t/30-relations.t
 t/31-threading.t
 t/32-iterators.t
diff --git a/TODO b/TODO
index 8802eee..54888ee 100644
--- a/TODO
+++ b/TODO
@@ -57,7 +57,4 @@
   algorithm).  The PP code isn't doing that, which means we're doing lots of
   extra primality checks, which aren't cheap in PP.
 
-- tests for factor_exp, liouville, partitions.
-
-- speedups for partitions()
-
+- tests for factor_exp, liouville.
diff --git a/t/24-partitions.t b/t/24-partitions.t
new file mode 100644
index 0000000..cb51723
--- /dev/null
+++ b/t/24-partitions.t
@@ -0,0 +1,88 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use Test::More;
+use Math::Prime::Util qw/partitions/;
+my $extra = defined $ENV{EXTENDED_TESTING} && $ENV{EXTENDED_TESTING};
+
+my @parts = qw/
+1
+1
+2
+3
+5
+7
+11
+15
+22
+30
+42
+56
+77
+101
+135
+176
+231
+297
+385
+490
+627
+792
+1002
+1255
+1575
+1958
+2436
+3010
+3718
+4565
+5604
+6842
+8349
+10143
+12310
+14883
+17977
+21637
+26015
+31185
+37338
+44583
+53174
+63261
+75175
+89134
+105558
+124754
+147273
+173525
+204226
+/;
+
+my %bparts = (
+    101 => "214481126",
+    256 => "365749566870782",
+    501 => "2431070104309287327876",
+   1001 => "25032297938763929621013218349796",
+   2347 => "56751384003004060684283391440819878903446789803099",
+   4128 => 
"13036233928924552978434294180871407270098426394166677221003078079504",
+   #9988 => 
"31043825285346179203111322344702502691204288916782299617140664920755263693739998376431336412511604846065386",
+  #13337 => 
"4841449229081281114351180373774137636239639013054790559544724995314398354517477085116206336008004971541987422037760634642695",
+  #37373 => 
"885240148270777711759915557428752066370785294706979437063536090533501018735098279767013023483349639513395622225840616033227700794918506274833787569446519667398089943122156454986205555766363295867812094833219935",
+);
+if (!$extra) {
+  my @ns = grep { $_ > 300 } keys %bparts;
+  foreach my $n (@ns) { delete $bparts{$n} }
+}
+
+plan tests => scalar(@parts) + scalar(keys(%bparts));
+
+
+foreach my $n (0..$#parts) {
+  is( partitions($n), $parts[$n], "partitions($n)" );
+}
+
+while (my($n, $epart) = each (%bparts)) {
+  is( partitions($n), $epart, "partitions($n)" );
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to