summaryrefslogtreecommitdiff
path: root/ext/Devel-Peek/t
diff options
context:
space:
mode:
authorTAKAI Kousuke <62541129+t-a-k@users.noreply.github.com>2022-03-08 19:17:35 +0900
committerYves Orton <demerphq@gmail.com>2022-03-09 03:44:17 +0100
commit3bdf66c3d47f0589706b789aaf5b1cc6f02d4e2d (patch)
treed312731dd89ea79a844e00d06775e4b87aef16ea /ext/Devel-Peek/t
parentd4f3575722c94cdc1548d94cd4bd5db816bf1580 (diff)
downloadperl-3bdf66c3d47f0589706b789aaf5b1cc6f02d4e2d.tar.gz
Add tests for increased NV precision in Devel::Peek::Dump
Diffstat (limited to 'ext/Devel-Peek/t')
-rw-r--r--ext/Devel-Peek/t/Peek.t23
1 files changed, 23 insertions, 0 deletions
diff --git a/ext/Devel-Peek/t/Peek.t b/ext/Devel-Peek/t/Peek.t
index 634ab55c85..ecf8edf09a 100644
--- a/ext/Devel-Peek/t/Peek.t
+++ b/ext/Devel-Peek/t/Peek.t
@@ -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();