diff options
Diffstat (limited to 'gnu/usr.bin/perl/cpan/Math-Complex/t/Trig.t')
-rwxr-xr-x | gnu/usr.bin/perl/cpan/Math-Complex/t/Trig.t | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/gnu/usr.bin/perl/cpan/Math-Complex/t/Trig.t b/gnu/usr.bin/perl/cpan/Math-Complex/t/Trig.t index a9a12556b65..ae0b0fd1d63 100755 --- a/gnu/usr.bin/perl/cpan/Math-Complex/t/Trig.t +++ b/gnu/usr.bin/perl/cpan/Math-Complex/t/Trig.t @@ -1,4 +1,4 @@ -#!./perl +#!./perl # # Regression tests for the Math::Trig package @@ -8,21 +8,34 @@ # # -- Jarkko Hietaniemi, April 1997 -use strict; -use warnings; -use Test::More tests => 153; +BEGIN { + if ($ENV{PERL_CORE}) { + chdir 't' if -d 't'; + #@INC = '../lib'; + } +} + +BEGIN { + eval { require Test::More }; + if ($@) { + # We are willing to lose testing in e.g. 5.00504. + print "1..0 # No Test::More, skipping\n"; + exit(0); + } else { + import Test::More; + } +} + +plan(tests => 153); use Math::Trig 1.18; use Math::Trig 1.18 qw(:pi Inf); -our $vax_float = (pack("d",1) =~ /^[\x80\x10]\x40/); -our $has_inf = !$vax_float; - my $pip2 = pi / 2; use strict; -our($x, $y, $z); +use vars qw($x $y $z); my $eps = 1e-11; @@ -30,7 +43,7 @@ if ($^O eq 'unicos') { # See lib/Math/Complex.pm and t/lib/complex.t. $eps = 1e-10; } -sub near { +sub near ($$;$) { my $e = defined $_[2] ? $_[2] : $eps; my $d = $_[1] ? abs($_[0]/$_[1] - 1) : abs($_[0]); print "# near? $_[0] $_[1] : $d : $e\n"; @@ -294,14 +307,9 @@ use Math::Trig ':radial'; ok(near($dst1, $dst2)); } -SKIP: { -# With netbsd-vax (or any vax) there is neither Inf, nor 1e40. -skip("different float range", 42) if $vax_float; -skip("no inf", 42) unless $has_inf; - print "# Infinity\n"; -my $BigDouble = eval '1e40'; +my $BigDouble = 1e40; # E.g. netbsd-alpha core dumps on Inf arith without this. local $SIG{FPE} = sub { }; @@ -328,17 +336,17 @@ ok(-Inf() / $BigDouble == -Inf()); print "# sinh/sech/cosh/csch/tanh/coth unto infinity\n"; -ok(near(sinh(100), eval '1.3441e+43', 1e-3)); -ok(near(sech(100), eval '7.4402e-44', 1e-3)); -ok(near(cosh(100), eval '1.3441e+43', 1e-3)); -ok(near(csch(100), eval '7.4402e-44', 1e-3)); +ok(near(sinh(100), 1.3441e+43, 1e-3)); +ok(near(sech(100), 7.4402e-44, 1e-3)); +ok(near(cosh(100), 1.3441e+43, 1e-3)); +ok(near(csch(100), 7.4402e-44, 1e-3)); ok(near(tanh(100), 1)); ok(near(coth(100), 1)); -ok(near(sinh(-100), eval '-1.3441e+43', 1e-3)); -ok(near(sech(-100), eval ' 7.4402e-44', 1e-3)); -ok(near(cosh(-100), eval ' 1.3441e+43', 1e-3)); -ok(near(csch(-100), eval '-7.4402e-44', 1e-3)); +ok(near(sinh(-100), -1.3441e+43, 1e-3)); +ok(near(sech(-100), 7.4402e-44, 1e-3)); +ok(near(cosh(-100), 1.3441e+43, 1e-3)); +ok(near(csch(-100), -7.4402e-44, 1e-3)); ok(near(tanh(-100), -1)); ok(near(coth(-100), -1)); @@ -356,8 +364,6 @@ cmp_ok(csch(-1e5), '==', 0); cmp_ok(tanh(-1e5), '==', -1); cmp_ok(coth(-1e5), '==', -1); -} - print "# great_circle_distance with small angles\n"; for my $e (qw(1e-2 1e-3 1e-4 1e-5)) { |