summaryrefslogtreecommitdiffstats
path: root/tests/binary.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-09-01 17:13:59 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-09-01 17:13:59 (GMT)
commitc639e72c38ffbe038a79a58991d4c5bb3e027a6f (patch)
tree958809c8acbbd29e5562804b7f60bf29c9d3e7b3 /tests/binary.test
parent2cd90e85bdaacea5b5fcf05011e14b92d78b5b12 (diff)
downloadtcl-c639e72c38ffbe038a79a58991d4c5bb3e027a6f.zip
tcl-c639e72c38ffbe038a79a58991d4c5bb3e027a6f.tar.gz
tcl-c639e72c38ffbe038a79a58991d4c5bb3e027a6f.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.test18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/binary.test b/tests/binary.test
index 44af9e5..e43b9f4 100644
--- a/tests/binary.test
+++ b/tests/binary.test
@@ -2356,6 +2356,24 @@ test binary-63.4 {NaN} ieeeFloatingPoint {
binary scan [binary format q {NaN( 3123456789aBc)}] w w
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 {