Skip to content

Commit

Permalink
Add tests for increased NV precision in Devel::Peek::Dump
Browse files Browse the repository at this point in the history
  • Loading branch information
t-a-k authored and demerphq committed Mar 9, 2022
1 parent d4f3575 commit 3bdf66c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions ext/Devel-Peek/t/Peek.t
Expand Up @@ -1569,4 +1569,27 @@ EODUMP
$out =~ s/\(0x[0-9a-f]{3,}\)/(0xNNN)/g;
is $out, $e, "DumpProg() has no 'Attempt to free X prematurely' warning";
}

{
my $one = 1.0;
my $epsilon_p = 1.0;
$epsilon_p /= 2 while $one != $one + $epsilon_p / 2;
my $epsilon_n = 1.0;
$epsilon_n /= 2 while $one != $one - $epsilon_n / 2;

my $head = 'SV = NV\($ADDR\) at $ADDR
(?:.+
)* ';
my $tail = '
(?:.+
)*';

do_test('NV 1.0', $one,
$head . 'NV = 1' . $tail);
do_test('NV 1.0 + epsilon', $one + $epsilon_p,
$head . 'NV = 1\.00000000\d+' . $tail);
do_test('NV 1.0 - epsilon', $one - $epsilon_p,
$head . 'NV = 0\.99999999\d+' . $tail);
}

done_testing();

0 comments on commit 3bdf66c

Please sign in to comment.