summaryrefslogtreecommitdiff
path: root/t/op
diff options
context:
space:
mode:
authorChip Salzenberg <salzench@dun.nielsen.com>1996-02-03 12:42:13 -0500
committerAndy Dougherty <doughera@lafcol.lafayette.edu>1996-02-03 12:42:13 -0500
commit8ba208abf89fdb78c61055f948a484207c04372d (patch)
tree2225cb6c8948a9f661b849c004a9f7616dd5f57a /t/op
parent482b294c2001bd1c291b5e70975012f29ac95f24 (diff)
downloadperl-8ba208abf89fdb78c61055f948a484207c04372d.tar.gz
Beta3: Ensure hex() and oct() positive [edited]
This patch ensures that hex() and oct() always return positive values.
Diffstat (limited to 't/op')
-rwxr-xr-xt/op/oct.t11
1 files changed, 7 insertions, 4 deletions
diff --git a/t/op/oct.t b/t/op/oct.t
index 8ed0c9843a..7890643aef 100755
--- a/t/op/oct.t
+++ b/t/op/oct.t
@@ -2,8 +2,11 @@
# $RCSfile: oct.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:08 $
-print "1..3\n";
+print "1..6\n";
-if (oct('01234') == 01234) {print "ok 1\n";} else {print "not ok 1\n";}
-if (oct('0x1234') == 0x1234) {print "ok 2\n";} else {print "not ok 2\n";}
-if (hex('01234') == 0x1234) {print "ok 3\n";} else {print "not ok 3\n";}
+print +(oct('01234') == 01234) ? "ok" : "not ok", " 1\n";
+print +(oct('0x1234') == 0x1234) ? "ok" : "not ok", " 2\n";
+print +(hex('01234') == 0x1234) ? "ok" : "not ok", " 3\n";
+print +(oct('20000000000') == 020000000000) ? "ok" : "not ok", " 4\n";
+print +(oct('x80000000') == 0x80000000) ? "ok" : "not ok", " 5\n";
+print +(hex('80000000') == 0x80000000) ? "ok" : "not ok", " 6\n";