Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add basic pod about is_aks_prime and add basic loading tests for AKS …

…and BigPolynomial
  • Loading branch information...
commit 5c947f0032686d6d4c1fcce861b904ce0fee92c1 1 parent 3ec9032
@leto authored
Showing with 7 additions and 2 deletions.
  1. +4 −1 lib/Math/Primality/AKS.pm
  2. +3 −1 t/00-load.t
View
5 lib/Math/Primality/AKS.pm
@@ -42,7 +42,9 @@ our %EXPORT_TAGS = ( all => \@EXPORT_OK );
=head1 FUNCTIONS
-=head2 aks($n)
+=head2 is_aks_prime($n)
+
+Returns 1 if $n is an AKS prime, 0 if it is not.
=cut
@@ -121,6 +123,7 @@ sub is_aks_prime($) {
Math::Primality::BigPolynomial::mpz_poly_mod_power($res, $base, $n, $n, $intr);
+
if($res->isEqual($compare)) {
debug "Found not prime at $a\n";
return 0;
View
4 t/00-load.t
@@ -1,10 +1,12 @@
#!/usr/bin/env perl
use strict;
-use Test::More tests => 1;
+use Test::More tests => 3;
BEGIN {
use_ok( 'Math::Primality' );
+ use_ok( 'Math::Primality::AKS' );
+ use_ok( 'Math::Primality::BigPolynomial' );
}
diag( "Testing Math::Primality $Math::Primality::VERSION, Perl $], $^X" );
Please sign in to comment.
Something went wrong with that request. Please try again.