summaryrefslogtreecommitdiff
path: root/t/op/numconvert.t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-10-04 13:58:49 -0700
committerFather Chrysostomos <sprout@cpan.org>2010-10-04 13:58:49 -0700
commitafa74577a6e8d7cf96f7c62e4acca52fda973699 (patch)
treea269635929639ed9dbf10beae4f99382f480a8f7 /t/op/numconvert.t
parentb20c4ee1fc23699f6cbe3ce96cc8fe6eb4c52c4c (diff)
downloadperl-afa74577a6e8d7cf96f7c62e4acca52fda973699.tar.gz
[perl #45133] -0.0 has variable Boolean value
This patch makes -0.0 stringify as "0" (while leaving sprintf %g/%f unchanged).
Diffstat (limited to 't/op/numconvert.t')
-rw-r--r--t/op/numconvert.t12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/op/numconvert.t b/t/op/numconvert.t
index fedef70d40..ce7880990f 100644
--- a/t/op/numconvert.t
+++ b/t/op/numconvert.t
@@ -38,6 +38,7 @@
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
+ require './test.pl';
}
use strict 'vars';
@@ -72,6 +73,7 @@ my $st_t = 4*4; # We try 4 initializers and 4 reporters
my $num = 0;
$num += 10**$_ - 4**$_ for 1.. $max_chain;
$num *= $st_t;
+$num += $::additional_tests;
print "1..$num\n"; # In fact 15 times more subsubtests...
my $max_uv = ~0;
@@ -256,3 +258,13 @@ for my $num_chain (1..$max_chain) {
}
}
}
+
+# Tests that use test.pl start here.
+BEGIN { $::additional_tests = 3 }
+
+curr_test($test);
+
+ok(-0.0 eq "0", 'negative zero stringifies as 0');
+ok(!-0.0, "neg zero is boolean false");
+my $nz = -0.0; "$nz";
+ok(!$nz, 'previously stringified -0.0 is boolean false');