summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2016-10-09 15:22:20 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2016-10-09 15:22:20 (GMT)
commitc8cc6fac8ee6338a97e9d3e0f45654191fe0bde8 (patch)
treeab9ab85f425d9b3997f42da00572718df4897afd /tests
parent58165211fc0567001df02564b1b06e64f66c5ab1 (diff)
parent1c4fbbc3332e525ff1368d9ba26681d826d2efde (diff)
downloadtcl-c8cc6fac8ee6338a97e9d3e0f45654191fe0bde8.zip
tcl-c8cc6fac8ee6338a97e9d3e0f45654191fe0bde8.tar.gz
tcl-c8cc6fac8ee6338a97e9d3e0f45654191fe0bde8.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: