summaryrefslogtreecommitdiffstats
path: root/tests/binary.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-09-01 17:29:32 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-09-01 17:29:32 (GMT)
commit6587a69f5cb3b51fb3caff4f9107e292dbcbefed (patch)
tree8a14a70bb10f79c8b764eac9b06de1e7af757fc7 /tests/binary.test
parent279a2a19474b5ed67d539d10053387c2bdc819f6 (diff)
parent17706bbc78ed27de8dee78c6ea4c6d3d0762157c (diff)
downloadtcl-6587a69f5cb3b51fb3caff4f9107e292dbcbefed.zip
tcl-6587a69f5cb3b51fb3caff4f9107e292dbcbefed.tar.gz
tcl-6587a69f5cb3b51fb3caff4f9107e292dbcbefed.tar.bz2
3402540 Corrections to TclParseNumber() to make it reject invalid Nan(Hex).
[scan Inf %g] is portable; remove constraint.
Diffstat (limited to 'tests/binary.test')
-rw-r--r--tests/binary.test17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/binary.test b/tests/binary.test
index 8b2880b..6c00508 100644
--- a/tests/binary.test
+++ b/tests/binary.test
@@ -2381,6 +2381,23 @@ test binary-63.4 {NaN} ieeeFloatingPoint {
format 0x%016lx [expr {$w & 0xfff3ffffffffffff}]
} 0x7ff3123456789abc
+# Make sure TclParseNumber() rejects invalid nan-hex formats [Bug 3402540]
+test binary-63.5 {NaN} -constraints ieeeFloatingPoint -body {
+ binary format q Nan(
+} -returnCodes error -match glob -result {expected floating-point number*}
+test binary-63.6 {NaN} -constraints ieeeFloatingPoint -body {
+ binary format q Nan()
+} -returnCodes error -match glob -result {expected floating-point number*}
+test binary-63.7 {NaN} -constraints ieeeFloatingPoint -body {
+ binary format q Nan(g)
+} -returnCodes error -match glob -result {expected floating-point number*}
+test binary-63.8 {NaN} -constraints ieeeFloatingPoint -body {
+ binary format q Nan(1,2)
+} -returnCodes error -match glob -result {expected floating-point number*}
+test binary-63.9 {NaN} -constraints ieeeFloatingPoint -body {
+ binary format q Nan(1234567890abcd)
+} -returnCodes error -match glob -result {expected floating-point number*}
+
test binary-64.1 {NaN} -constraints ieeeFloatingPoint -body {
binary scan [binary format w 0x7ff8000000000000] q d
set d