Permalink
Browse files

fixes some tests

  • Loading branch information...
1 parent 51cbbe3 commit eeef22e14098c5f2eaff5deb7945dc27962303df @bubaflub bubaflub committed Oct 26, 2009
Showing with 10 additions and 5 deletions.
  1. +10 −5 t/aks.t
View
15 t/aks.t
@@ -2,17 +2,17 @@
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More tests => 16;
use Math::Primality;
use Math::GMPz;
use POSIX qw(ceil floor); # for testing _Rmpz_logbase2* functions
### check _find_smallest_r ###
-my $result = Math::Primality::_find_smallest_r(Math::GMPz->new(4099));
-is("$result", "691", "smallest r for 4099 should be 691");
-$result = Math::Primality::_find_smallest_r(Math::GMPz->new(10007));
-is("$result", "797", "smallest r for 10007 should be 797");
+my $smallest_r = Math::Primality::_find_smallest_r(Math::GMPz->new(4099));
+is("$smallest_r", "691", "smallest r for 4099 should be 691");
+$smallest_r = Math::Primality::_find_smallest_r(Math::GMPz->new(10007));
+is("$smallest_r", "797", "smallest r for 10007 should be 797");
### log base 2 for testing my _Rmpz_logbase2* functions
sub log2 {
my $n = shift;
@@ -32,3 +32,8 @@ for (my $i = 1; $i < 7; $i++) {
$b = Math::Primality::_Rmpz_logbase2fl(Math::GMPz->new($n));
is("$a", "$b", "log2($n) == _Rmpz_logbase2fl($n)");
}
+### check _calculate_max_a ###
+my $max_a = Math::Primality::_calculate_max_a(Math::GMPz->new(797), Math::GMPz->new(10007));
+is("$max_a", "789", "max a of 10007 (with r of 797) should be 789");
+$max_a = Math::Primality::_calculate_max_a(Math::GMPz->new(691), Math::GMPz->new(4099));
+is("$max_a", "682", "max a of 4099 (with r of 691) should be 682");

0 comments on commit eeef22e

Please sign in to comment.