From 332e5136e66e21b7b72acfda563ec435998d552c Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 27 Nov 2008 22:56:26 -0800 Subject: [PATCH] Refactor the rest of the tests to add # of tests and get rid of unnecessary use of Math::GSL --- t/PowInt.t | 7 +++---- t/QRNG.t | 9 ++++----- t/RNG.t | 8 ++++---- t/Randist.t | 12 +++++------- t/Roots.t | 2 +- t/SF.t | 18 +++++------------- t/Siman.t | 4 ++-- t/Sort.t | 11 +++++------ t/Spline.t | 7 +++---- t/Statistics.t | 7 +++---- t/Sum.t | 11 +++++------ t/Sys.t | 7 +++---- t/Vector.t | 10 +++++----- t/Wavelet.t | 11 +++++------ t/Wavelet2D.t | 7 +++---- 15 files changed, 56 insertions(+), 75 deletions(-) diff --git a/t/PowInt.t b/t/PowInt.t index da28079..c5630f2 100644 --- a/t/PowInt.t +++ b/t/PowInt.t @@ -1,10 +1,9 @@ package Math::GSL::PowInt::Test; -use Math::GSL::Test qw/:all/; use base q{Test::Class}; -use Test::More; +use Test::More tests => 14; +use Math::GSL::Sys qw/gsl_posinf gsl_nan/; +use Math::GSL::Test qw/:all/; use Math::GSL::PowInt qw/:all/; -use Math::GSL::Sys qw/gsl_posinf gsl_nan/; -use Math::GSL qw/:all/; use Data::Dumper; use strict; diff --git a/t/QRNG.t b/t/QRNG.t index d695e0d..ce1c732 100644 --- a/t/QRNG.t +++ b/t/QRNG.t @@ -1,11 +1,10 @@ package Math::GSL::QRNG::Test; -use Math::GSL::Test qw/:all/; use base q{Test::Class}; -use Test::More; -use Math::GSL::QRNG qw/:all/; -use Math::GSL qw/:all/; -use Data::Dumper; +use Test::More tests => 8; +use Math::GSL::QRNG qw/:all/; +use Math::GSL::Test qw/:all/; use Math::GSL::Errno qw/:all/; +use Data::Dumper; use strict; sub make_fixture : Test(setup) { diff --git a/t/RNG.t b/t/RNG.t index f703d5b..35d575b 100644 --- a/t/RNG.t +++ b/t/RNG.t @@ -1,9 +1,9 @@ package Math::GSL::RNG::Test; -use Math::GSL::Test qw/:all/; use base q{Test::Class}; -use Test::More; -use Math::GSL qw/:all/; -use Math::GSL::RNG qw/:all/; +use Test::More tests => 31; +use Math::GSL qw/:all/; +use Math::GSL::RNG qw/:all/; +use Math::GSL::Test qw/:all/; use Math::GSL::Errno qw/:all/; use Data::Dumper; use strict; diff --git a/t/Randist.t b/t/Randist.t index 0109aca..78694a8 100644 --- a/t/Randist.t +++ b/t/Randist.t @@ -1,12 +1,11 @@ package Math::GSL::Randist::Test; -use Math::GSL::Test qw/:all/; use base q{Test::Class}; -use Test::More; +use Test::More tests => 1; +use Math::GSL::Test qw/:all/; +use Math::GSL::RNG qw/:all/; +use Math::GSL::Errno qw/:all/; use Math::GSL::Randist qw/:all/; -use Math::GSL::RNG qw/:all/; -use Math::GSL qw/:all/; use Data::Dumper; -use Math::GSL::Errno qw/:all/; use strict; sub make_fixture : Test(setup) { @@ -18,7 +17,6 @@ sub teardown : Test(teardown) { } sub GSL_RAN_BERNOULLI_PDF : Tests { - my $x = gsl_ran_bernoulli_pdf(2, 0.5); - is($x, 0); + ok_similar( 0, gsl_ran_bernoulli_pdf(2, 0.5), '=0 at (2,0.5)' ); } Test::Class->runtests; diff --git a/t/Roots.t b/t/Roots.t index e8a247b..fa9a0a1 100644 --- a/t/Roots.t +++ b/t/Roots.t @@ -1,7 +1,7 @@ package Math::GSL::Roots::Test; use strict; use base q{Test::Class}; -use Test::More; +use Test::More tests => 14; use Math::GSL qw/:all/; use Math::GSL::Roots qw/:all/; use Math::GSL::Test qw/:all/; diff --git a/t/SF.t b/t/SF.t index d07e757..7169e96 100644 --- a/t/SF.t +++ b/t/SF.t @@ -2,28 +2,20 @@ package Math::GSL::SF::Test; use Math::GSL::Test qw/:all/; use base q{Test::Class}; use Test::More tests => 1108; -use Math::GSL qw/:all/; -use Math::GSL::Const qw/:all/; -use Math::GSL::Errno qw/:all/; -use Math::GSL::SF qw/:all/; +use Math::GSL qw/:all/; +use Math::GSL::Const qw/:all/; +use Math::GSL::Errno qw/:all/; +use Math::GSL::SF qw/:all/; +use Math::GSL::Poly qw/:all/; use Math::GSL::Machine qw/:all/; -use Math::GSL::Poly qw/:all/; use Data::Dumper; use strict; use warnings; BEGIN{ gsl_set_error_handler_off(); } my $factor = 100; -my $TOL0 = $factor*2.0*$GSL_DBL_EPSILON; my $TOL1 = $factor*16.0*$GSL_DBL_EPSILON; -my $TOL2 = $factor*256.0*$GSL_DBL_EPSILON; -my $TOL3 = $factor*2048.0*$GSL_DBL_EPSILON; -my $TOL4 = $factor*16384.0*$GSL_DBL_EPSILON; -my $TOL5 = $factor*131072.0*$GSL_DBL_EPSILON; -my $TOL6 = $factor*1048576.0*$GSL_DBL_EPSILON; my $SQRT_TOL0 = 2.0*$GSL_SQRT_DBL_EPSILON; -my $TEST_SNGL = 1.0e-06; -my $DBL_MAX = 1.7976931348623157e+308; my $DELTA = 1.2246467991473531772e-16; my $w = 0.8*$GSL_LOG_DBL_MAX; my $y = 0.2*$GSL_DBL_MAX; diff --git a/t/Siman.t b/t/Siman.t index b7c8ae8..4638777 100644 --- a/t/Siman.t +++ b/t/Siman.t @@ -1,8 +1,8 @@ package Math::GSL::Siman::Test; use base q{Test::Class}; -use Test::More; +use Test::More tests => 1; use Math::GSL qw/:all/; -use Math::GSL::Siman qw/:all/; +use Math::GSL::Siman qw/:all/; use Math::GSL::Test qw/:all/; use Math::GSL::Errno qw/:all/; use Data::Dumper; diff --git a/t/Sort.t b/t/Sort.t index 5135a56..7061bf1 100644 --- a/t/Sort.t +++ b/t/Sort.t @@ -1,13 +1,12 @@ package Math::GSL::Sort::Test; use Math::GSL::Test qw/:all/; use base q{Test::Class}; -use Test::More; +use Test::More tests => 20; +use Math::GSL::RNG qw/:all/; +use Math::GSL::Sort qw/:all/; +use Math::GSL::Errno qw/:all/; +use Math::GSL::Vector qw/:all/; use Math::GSL::Permutation qw/:all/; -use Math::GSL::Sort qw/:all/; -use Math::GSL::RNG qw/:all/; -use Math::GSL::Vector qw/:all/; -use Math::GSL qw/:all/; -use Math::GSL::Errno qw/:all/; use Data::Dumper; use strict; diff --git a/t/Spline.t b/t/Spline.t index a93df2e..a5c94d2 100644 --- a/t/Spline.t +++ b/t/Spline.t @@ -1,10 +1,9 @@ package Math::GSL::Spline::Test; -use Math::GSL::Test qw/:all/; use base 'Test::Class'; -use Test::More 'no_plan'; -use Math::GSL qw/:all/; +use Test::More tests => 38; +use Math::GSL::Errno qw/:all/; +use Math::GSL::Test qw/:all/; use Math::GSL::Spline qw/:all/; -use Math::GSL::Errno qw/:all/; use Math::GSL::Interp qw/:all/; use Test::Exception; use Data::Dumper; diff --git a/t/Statistics.t b/t/Statistics.t index dbbbc13..5346249 100644 --- a/t/Statistics.t +++ b/t/Statistics.t @@ -1,10 +1,9 @@ package Math::GSL::Statistics::Test; -use Math::GSL::Test qw/:all/; use base q{Test::Class}; -use Test::More; -use Math::GSL::Statistics qw/:all/; +use Test::More tests => 28; +use Math::GSL::Test qw/:all/; use Math::GSL::Sort qw/:all/; -use Math::GSL qw/:all/; +use Math::GSL::Statistics qw/:all/; use strict; sub make_fixture : Test(setup) { diff --git a/t/Sum.t b/t/Sum.t index 6e958cd..e4f4d49 100644 --- a/t/Sum.t +++ b/t/Sum.t @@ -1,12 +1,11 @@ package Math::GSL::Sum::Test; -use Math::GSL::Test qw/:all/; use base q{Test::Class}; -use Test::More; -use Math::GSL::Errno qw/:all/; -use Math::GSL::Const qw/:all/; +use Test::More tests => 14; +use Math::GSL::Sum qw/:all/; +use Math::GSL::Test qw/:all/; +use Math::GSL::Errno qw/:all/; +use Math::GSL::Const qw/:all/; use Math::GSL::Machine qw/:all/; -use Math::GSL::Sum qw/:all/; -use Math::GSL qw/:all/; use Data::Dumper; use strict; diff --git a/t/Sys.t b/t/Sys.t index 6331af7..6c9d292 100644 --- a/t/Sys.t +++ b/t/Sys.t @@ -1,9 +1,8 @@ package Math::GSL::Sys::Test; -use Math::GSL::Test qw/:all/; use base q{Test::Class}; -use Test::More; -use Math::GSL::Sys qw/:all/; -use Math::GSL qw/:all/; +use Test::More tests => 13; +use Math::GSL::Sys qw/:all/; +use Math::GSL::Test qw/:all/; use Data::Dumper; use strict; diff --git a/t/Vector.t b/t/Vector.t index 1048b34..0318a15 100755 --- a/t/Vector.t +++ b/t/Vector.t @@ -1,13 +1,13 @@ package Math::GSL::Vector::Test; -use Math::GSL::Test qw/:all/; use base q{Test::Class}; use Test::More tests => 122; -use Math::GSL::Vector qw/:all/; +use Math::GSL qw/:all/; +use Math::GSL::Test qw/:all/; +use Math::GSL::Errno qw/:all/; +use Math::GSL::Vector qw/:all/; use Math::GSL::Complex qw/:all/; -use Math::GSL qw/:all/; -use Data::Dumper; -use Math::GSL::Errno qw/:all/; use Test::Exception; +use Data::Dumper; use strict; BEGIN{ gsl_set_error_handler_off(); } diff --git a/t/Wavelet.t b/t/Wavelet.t index fef795c..b964d22 100644 --- a/t/Wavelet.t +++ b/t/Wavelet.t @@ -1,12 +1,11 @@ package Math::GSL::Wavelet::Test; -use Math::GSL::Test qw/:all/; use base q{Test::Class}; -use Test::More; -use Math::GSL::Errno qw/:all/; -use Math::GSL::Wavelet qw/:all/; -use Math::GSL qw/:all/; -use Data::Dumper; +use Test::More tests => 11; +use Math::GSL::Test qw/:all/; +use Math::GSL::Errno qw/:all/; +use Math::GSL::Wavelet qw/:all/; use Scalar::Util qw/blessed/; +use Data::Dumper; use strict; BEGIN{ gsl_set_error_handler_off(); } diff --git a/t/Wavelet2D.t b/t/Wavelet2D.t index c0366a0..48ac43d 100644 --- a/t/Wavelet2D.t +++ b/t/Wavelet2D.t @@ -1,10 +1,9 @@ package Math::GSL::Wavelet2D::Test; use base q{Test::Class}; -use Test::More; -use Math::GSL qw/:all/; +use Test::More tests => 1; +use Math::GSL::Test qw/:all/; +use Math::GSL::Errno qw/:all/; use Math::GSL::Wavelet2D qw/:all/; -use Math::GSL::Test qw/:all/; -use Math::GSL::Errno qw/:all/; use Data::Dumper; use strict; -- 2.11.4.GIT