From 23bfc6c3e04494eb9a8165535ae9a80efec1dd7a Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Fri, 7 Jan 2011 02:26:54 +0000 Subject: * 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.) --- ChangeLog | 8 +++++ tests/util.test | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 97 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8dc89d9..a8da281 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-01-07 Kevin B. Kenny + + * 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 * 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 -- cgit v0.12