summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2016-10-09 15:21:26 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2016-10-09 15:21:26 (GMT)
commit1c4fbbc3332e525ff1368d9ba26681d826d2efde (patch)
treeb865f81dde7ff4c605df611ce1e984f306bbdf1a /tests
parente68205abcae7f231dd47d201507b33330f1406aa (diff)
downloadtcl-1c4fbbc3332e525ff1368d9ba26681d826d2efde.zip
tcl-1c4fbbc3332e525ff1368d9ba26681d826d2efde.tar.gz
tcl-1c4fbbc3332e525ff1368d9ba26681d826d2efde.tar.bz2
[7114ac6141] Improve testing and docs of Tcl_GetInt and Tcl_GetDouble. No behaviour change.
Diffstat (limited to 'tests')
-rw-r--r--tests/get.test22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/get.test b/tests/get.test
index d51ec6d..7aa06c1 100644
--- a/tests/get.test
+++ b/tests/get.test
@@ -19,9 +19,10 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
catch [list package require -exact Tcltest [info patchlevel]]
testConstraint testgetint [llength [info commands testgetint]]
+testConstraint testdoubleobj [llength [info commands testdoubleobj]]
testConstraint longIs32bit [expr {int(0x80000000) < 0}]
testConstraint longIs64bit [expr {int(0x8000000000000000) < 0}]
-
+
test get-1.1 {Tcl_GetInt procedure} testgetint {
testgetint 44 { 22}
} {66}
@@ -95,7 +96,24 @@ test get-3.2 {Tcl_GetDouble(FromObj), bad numbers} {
}
set result
} {0 1 0 1 1 {expected floating-point number but got "++1.0"} 1 {expected floating-point number but got "+-1.0"} 1 {expected floating-point number but got "-+1.0"} 0 -1 1 {expected floating-point number but got "--1.0"} 1 {expected floating-point number but got "- +1.0"}}
-
+# Bug 7114ac6141
+test get-3.3 {tcl_GetInt with iffy numbers} testgetint {
+ lmap x {0 " 0" "0 " " 0 " " 0xa " " 010 " " 0o10 " " 0b10 "} {
+ catch {testgetint 44 $x} x
+ set x
+ }
+} {44 44 44 44 54 52 52 46}
+test get-3.4 {Tcl_GetDouble with iffy numbers} testdoubleobj {
+ lmap x {0 0.0 " .0" ".0 " " 0e0 " "09" "- 0" "-0" "0o12" "0b10"} {
+ catch {testdoubleobj set 1 $x} x
+ set x
+ }
+} {0.0 0.0 0.0 0.0 0.0 {expected floating-point number but got "09" (looks like invalid octal number)} {expected floating-point number but got "- 0"} 0.0 10.0 2.0}
+
# cleanup
::tcltest::cleanupTests
return
+
+# Local Variables:
+# mode: tcl
+# End: