diff options
author | ferrieux <ferrieux@users.sourceforge.net> | 2008-12-10 18:21:46 (GMT) |
---|---|---|
committer | ferrieux <ferrieux@users.sourceforge.net> | 2008-12-10 18:21:46 (GMT) |
commit | 598d01fe5e0f51d30e934c1aba180b32b7733ebc (patch) | |
tree | 1a21e3ccc33a5243f3f2d9bf30b44617c5ff70e3 /tests | |
parent | 418c8071f2eaf8ed93cf80189e6b775369dba84b (diff) | |
download | tcl-598d01fe5e0f51d30e934c1aba180b32b7733ebc.zip tcl-598d01fe5e0f51d30e934c1aba180b32b7733ebc.tar.gz tcl-598d01fe5e0f51d30e934c1aba180b32b7733ebc.tar.bz2 |
TIP #343 IMPLEMENTATION - A Binary Specifier for [format/scan]
Diffstat (limited to 'tests')
-rw-r--r-- | tests/format.test | 5 | ||||
-rw-r--r-- | tests/scan.test | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/tests/format.test b/tests/format.test index 1b8869a..d2cbcde 100644 --- a/tests/format.test +++ b/tests/format.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: format.test,v 1.27 2008/07/19 22:50:39 nijtmans Exp $ +# RCS: @(#) $Id: format.test,v 1.28 2008/12/10 18:21:47 ferrieux Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -77,6 +77,9 @@ test format-1.11 {integer formatting} longIs32bit { test format-1.11.1 {integer formatting} longIs64bit { format "%-#20o %#-20o %#-20o %#-20o" 6 34 16923 -12 -1 } {06 042 041033 01777777777777777777764} +test format-1.12 {integer formatting} { + format "%b %#b %llb" 5 5 [expr {2**100}] +} {101 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000} test format-2.1 {string formatting} { format "%s %s %c %s" abcd {This is a very long test string.} 120 x diff --git a/tests/scan.test b/tests/scan.test index ef40d4b..4296366 100644 --- a/tests/scan.test +++ b/tests/scan.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: scan.test,v 1.22 2008/07/19 22:50:39 nijtmans Exp $ +# RCS: @(#) $Id: scan.test,v 1.23 2008/12/10 18:21:47 ferrieux Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -248,10 +248,14 @@ test scan-4.40.2 {Tcl_ScanObjCmd, base-16 integer scanning} { catch {unset x} list [scan {xF} {%x} x] [info exists x] } {0 0} +test scan-4.40.3 {Tcl_ScanObjCmd, base-2 integer scanning} { + set x {} + list [scan {1001 0b101 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000} {%b %b %llb} x y z] $x $y $z +} {3 9 5 340282366920938463463374607431768211456} test scan-4.41 {Tcl_ScanObjCmd, base-unknown integer scanning} { set x {} - list [scan {10 010 0x10} {%i%i%i} x y z] $x $y $z -} {3 10 8 16} + list [scan {10 010 0x10 0b10} {%i%i%i%i} x y z t] $x $y $z $t +} {4 10 8 16 0} test scan-4.42 {Tcl_ScanObjCmd, base-unknown integer scanning} { set x {} list [scan {10 010 0X10} {%i%i%i} x y z] $x $y $z |