diff options
Diffstat (limited to 'tcl/tests/binary.test')
-rw-r--r-- | tcl/tests/binary.test | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/tcl/tests/binary.test b/tcl/tests/binary.test index cf048c9df6b..0e451fc72f0 100644 --- a/tcl/tests/binary.test +++ b/tcl/tests/binary.test @@ -17,7 +17,7 @@ if {[lsearch [namespace children] ::tcltest] == -1} { namespace import -force ::tcltest::* } -test binary-2.1 {DupByteArrayInternalRep} { +test binary-0.1 {DupByteArrayInternalRep} { set hdr [binary format cc 0 0316] set buf hellomatt @@ -42,7 +42,6 @@ test binary-1.4 {Tcl_BinaryObjCmd: format} { } {} - test binary-2.1 {Tcl_BinaryObjCmd: format} { list [catch {binary format a } msg] $msg } {1 {not enough arguments for all format specifiers}} @@ -1461,19 +1460,32 @@ test binary-42.1 {Tcl_BinaryObjCmd: bad arguments} {} { set result } {bad option "": must be format or scan} +# Wide int (guaranteed at least 64-bit) handling +test binary-43.1 {Tcl_BinaryObjCmd: format wide int} {} { + binary format w 7810179016327718216 +} HelloTcl +test binary-43.2 {Tcl_BinaryObjCmd: format wide int} {} { + binary format W 7810179016327718216 +} lcTolleH + +test binary-44.1 {Tcl_BinaryObjCmd: scan wide int} {} { + binary scan HelloTcl W x + set x +} 5216694956358656876 +test binary-44.2 {Tcl_BinaryObjCmd: scan wide int} {} { + binary scan lcTolleH w x + set x +} 5216694956358656876 + +test binary-45.1 {Tcl_BinaryObjCmd: combined wide int handling} { + binary scan [binary format sws 16450 -1 19521] c* x + set x +} {66 64 -1 -1 -1 -1 -1 -1 -1 -1 65 76} +test binary-45.2 {Tcl_BinaryObjCmd: combined wide int handling} { + binary scan [binary format sWs 16450 0x7fffffff 19521] c* x + set x +} {66 64 0 0 0 0 127 -1 -1 -1 65 76} + # cleanup ::tcltest::cleanupTests return - - - - - - - - - - - - - |