summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2011-01-07 02:26:54 (GMT)
committerKevin B Kenny <kennykb@acm.org>2011-01-07 02:26:54 (GMT)
commit23bfc6c3e04494eb9a8165535ae9a80efec1dd7a (patch)
tree41a959ed5a45fc272ddd3ac85711ccd9596e567f
parent7b8d446e2d60cdb9a7f06cc2c59a1629b9ffe953 (diff)
downloadtcl-23bfc6c3e04494eb9a8165535ae9a80efec1dd7a.zip
tcl-23bfc6c3e04494eb9a8165535ae9a80efec1dd7a.tar.gz
tcl-23bfc6c3e04494eb9a8165535ae9a80efec1dd7a.tar.bz2
* tests/util.test (util-15.*): Added test cases for floating point
conversion of the largest denormal and the smallest normal number, to avoid any possibility of the failure suffered by PHP in the last couple of days. (They didn't fail, so no actual functional change.)
-rw-r--r--ChangeLog8
-rw-r--r--tests/util.test90
2 files changed, 97 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8dc89d9..a8da281 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-01-07 Kevin B. Kenny <kennykb@acm.org>
+
+ * tests/util.test (util-15.*): Added test cases for floating point
+ conversion of the largest denormal and the smallest normal number,
+ to avoid any possibility of the failure suffered by PHP in the
+ last couple of days. (They didn't fail, so no actual functional
+ change.)
+
2011-01-05 Donal K. Fellows <dkf@users.sf.net>
* tests/package.test, tests/pkg.test: Coalesce these tests into one
diff --git a/tests/util.test b/tests/util.test
index 1d31609..d435a82 100644
--- a/tests/util.test
+++ b/tests/util.test
@@ -7,7 +7,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: util.test,v 1.21 2010/11/28 23:20:11 kennykb Exp $
+# RCS: @(#) $Id: util.test,v 1.22 2011/01/07 02:26:55 kennykb Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -1903,6 +1903,94 @@ test util-14.2 {funky NaN} {*}{
-result -NaN(3456789abcdef)
}
+test util-15.1 {largest subnormal} {*}{
+ -body {
+ binary scan [binary format w 0x000fffffffffffff] q x
+ set x
+ }
+ -result 2.225073858507201e-308
+ -cleanup {
+ unset x
+ }
+}
+
+test util-15.2 {largest subnormal} {*}{
+ -body {
+ binary scan [binary format w 0x800fffffffffffff] q x
+ set x
+ }
+ -result -2.225073858507201e-308
+ -cleanup {
+ unset x
+ }
+}
+
+test util-15.3 {largest subnormal} {*}{
+ -body {
+ binary scan [binary format q 2.225073858507201e-308] w x
+ format %#lx $x
+ }
+ -result 0xfffffffffffff
+ -cleanup {
+ unset x
+ }
+}
+
+test util-15.4 {largest subnormal} {*}{
+ -body {
+ binary scan [binary format q -2.225073858507201e-308] w x
+ format %#lx $x
+ }
+ -result 0x800fffffffffffff
+ -cleanup {
+ unset x
+ }
+}
+
+test util-15.5 {smallest normal} {*}{
+ -body {
+ binary scan [binary format w 0x0010000000000000] q x
+ set x
+ }
+ -result 2.2250738585072014e-308
+ -cleanup {
+ unset x
+ }
+}
+
+test util-15.6 {smallest normal} {*}{
+ -body {
+ binary scan [binary format w 0x8010000000000000] q x
+ set x
+ }
+ -result -2.2250738585072014e-308
+ -cleanup {
+ unset x
+ }
+}
+
+test util-15.7 {smallest normal} {*}{
+ -body {
+ binary scan [binary format q 2.2250738585072014e-308] w x
+ format %#lx $x
+ }
+ -result 0x10000000000000
+ -cleanup {
+ unset x
+ }
+}
+
+test util-15.8 {smallest normal} {*}{
+ -body {
+ binary scan [binary format q -2.2250738585072014e-308] w x
+ format %#lx $x
+ }
+ -result 0x8010000000000000
+ -cleanup {
+ unset x
+ }
+}
+
# cleanup
::tcltest::cleanupTests
return