xref: /openbsd-src/gnu/usr.bin/perl/dist/Math-Complex/t/underbar.t (revision f2a19305cfc49ea4d1a5feb55cd6c283c6f1e031)
1*f2a19305Safresh1#
2*f2a19305Safresh1# Tests that the standard Perl 5 functions that we override
3*f2a19305Safresh1# that operate on the $_ will work correctly [perl #62412]
4*f2a19305Safresh1#
5*f2a19305Safresh1
6*f2a19305Safresh1use Test::More;
7*f2a19305Safresh1
8*f2a19305Safresh1use strict;
9*f2a19305Safresh1use warnings;
10*f2a19305Safresh1
11*f2a19305Safresh1my @f = qw(abs cos exp log sin sqrt);
12*f2a19305Safresh1
13*f2a19305Safresh1plan tests => scalar @f;
14*f2a19305Safresh1
15*f2a19305Safresh1use Math::Complex;
16*f2a19305Safresh1
17*f2a19305Safresh1my %CORE;
18*f2a19305Safresh1
19*f2a19305Safresh1for my $f (@f) {
20*f2a19305Safresh1    local $_ = 0.5;
21*f2a19305Safresh1    $CORE{$f} = eval "CORE::$f";
22*f2a19305Safresh1}
23*f2a19305Safresh1
24*f2a19305Safresh1for my $f (@f) {
25*f2a19305Safresh1    local $_ = 0.5;
26*f2a19305Safresh1    is(eval "Math::Complex::$f", $CORE{$f}, $f);
27*f2a19305Safresh1}
28*f2a19305Safresh1
29