develooper Front page | perl.perl5.porters | Postings from February 2001

PATCH: extra tests to check on negative float to unsigned cast

Thread Next
From:
Jeff Okamoto
Date:
February 23, 2001 13:28
Subject:
PATCH: extra tests to check on negative float to unsigned cast
Message ID:
200102232128.NAA28938@xfiles.corp.hp.com
These are against TRIAL2.

Jeff
-----
--- t/bop.t.dist	Fri Feb 23 13:20:43 2001
+++ t/bop.t	Fri Feb 23 13:20:43 2001
@@ -9,7 +9,7 @@
     @INC = '../lib';
 }
 
-print "1..42\n";
+print "1..44\n";
 
 # numerics
 print ((0xdead & 0xbeef) == 0x9ead ? "ok 1\n" : "not ok 1\n");
@@ -163,3 +163,9 @@
 # More variations on 19 and 22.
 print "ok \xFF\x{FF}\n" & "ok 41\n";
 print "ok \x{FF}\xFF\n" & "ok 42\n";
+
+# Tests to see if you really can do casts negative floats to unsigned properly
+$neg1 = -1.0;
+print ((~ $neg1 == 0) ? "ok 43\n" : "not ok 43\n");
+$neg7 = -7.0;
+print ((~ $neg7 == 6) ? "ok 44\n" : "not ok 44\n");

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About