os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/binary.test
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/binary.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,1533 @@
     1.4 +# This file tests the tclBinary.c file and the "binary" Tcl command. 
     1.5 +#
     1.6 +# This file contains a collection of tests for one or more of the Tcl
     1.7 +# built-in commands.  Sourcing this file into Tcl runs the tests and
     1.8 +# generates output for errors.  No output means no errors were found.
     1.9 +#
    1.10 +# Copyright (c) 1997 by Sun Microsystems, Inc.
    1.11 +# Copyright (c) 1998-1999 by Scriptics Corporation.
    1.12 +#
    1.13 +# See the file "license.terms" for information on usage and redistribution
    1.14 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    1.15 +#
    1.16 +# RCS: @(#) $Id: binary.test,v 1.11.2.4 2006/04/05 15:17:06 dgp Exp $
    1.17 +
    1.18 +if {[lsearch [namespace children] ::tcltest] == -1} {
    1.19 +    package require tcltest
    1.20 +    namespace import -force ::tcltest::*
    1.21 +}
    1.22 +
    1.23 +test binary-0.1 {DupByteArrayInternalRep} {
    1.24 +    set hdr [binary format cc 0 0316]
    1.25 +    set buf hellomatt
    1.26 +    
    1.27 +    set data $hdr
    1.28 +    append data $buf
    1.29 +    
    1.30 +    string length $data
    1.31 +} 11
    1.32 +
    1.33 +test binary-1.1 {Tcl_BinaryObjCmd: bad args} {
    1.34 +    list [catch {binary} msg] $msg
    1.35 +} {1 {wrong # args: should be "binary option ?arg arg ...?"}}
    1.36 +test binary-1.2 {Tcl_BinaryObjCmd: bad args} {
    1.37 +    list [catch {binary foo} msg] $msg
    1.38 +} {1 {bad option "foo": must be format or scan}}
    1.39 +
    1.40 +test binary-1.3 {Tcl_BinaryObjCmd: format error} {
    1.41 +    list [catch {binary f} msg] $msg
    1.42 +} {1 {wrong # args: should be "binary format formatString ?arg arg ...?"}}
    1.43 +test binary-1.4 {Tcl_BinaryObjCmd: format} {
    1.44 +    binary format ""
    1.45 +} {}
    1.46 +
    1.47 +
    1.48 +test binary-2.1 {Tcl_BinaryObjCmd: format} {
    1.49 +    list [catch {binary format a } msg] $msg
    1.50 +} {1 {not enough arguments for all format specifiers}}
    1.51 +test binary-2.2 {Tcl_BinaryObjCmd: format} {
    1.52 +    binary format a0 foo
    1.53 +} {}
    1.54 +test binary-2.3 {Tcl_BinaryObjCmd: format} {
    1.55 +    binary format a f
    1.56 +} {f}
    1.57 +test binary-2.4 {Tcl_BinaryObjCmd: format} {
    1.58 +    binary format a foo
    1.59 +} {f}
    1.60 +test binary-2.5 {Tcl_BinaryObjCmd: format} {
    1.61 +    binary format a3 foo
    1.62 +} {foo}
    1.63 +test binary-2.6 {Tcl_BinaryObjCmd: format} {
    1.64 +    binary format a5 foo
    1.65 +} foo\x00\x00
    1.66 +test binary-2.7 {Tcl_BinaryObjCmd: format} {
    1.67 +    binary format a*a3 foobarbaz blat
    1.68 +} foobarbazbla
    1.69 +test binary-2.8 {Tcl_BinaryObjCmd: format} {
    1.70 +    binary format a*X3a2 foobar x
    1.71 +} foox\x00r
    1.72 +
    1.73 +test binary-3.1 {Tcl_BinaryObjCmd: format} {
    1.74 +    list [catch {binary format A} msg] $msg
    1.75 +} {1 {not enough arguments for all format specifiers}}
    1.76 +test binary-3.2 {Tcl_BinaryObjCmd: format} {
    1.77 +    binary format A0 f
    1.78 +} {}
    1.79 +test binary-3.3 {Tcl_BinaryObjCmd: format} {
    1.80 +    binary format A f
    1.81 +} {f}
    1.82 +test binary-3.4 {Tcl_BinaryObjCmd: format} {
    1.83 +    binary format A foo
    1.84 +} {f}
    1.85 +test binary-3.5 {Tcl_BinaryObjCmd: format} {
    1.86 +    binary format A3 foo
    1.87 +} {foo}
    1.88 +test binary-3.6 {Tcl_BinaryObjCmd: format} {
    1.89 +    binary format A5 foo
    1.90 +} {foo  }
    1.91 +test binary-3.7 {Tcl_BinaryObjCmd: format} {
    1.92 +    binary format A*A3 foobarbaz blat
    1.93 +} foobarbazbla
    1.94 +test binary-3.8 {Tcl_BinaryObjCmd: format} {
    1.95 +    binary format A*X3A2 foobar x
    1.96 +} {foox r}
    1.97 +
    1.98 +test binary-4.1 {Tcl_BinaryObjCmd: format} {
    1.99 +    list [catch {binary format B} msg] $msg
   1.100 +} {1 {not enough arguments for all format specifiers}}
   1.101 +test binary-4.2 {Tcl_BinaryObjCmd: format} {
   1.102 +    binary format B0 1
   1.103 +} {}
   1.104 +test binary-4.3 {Tcl_BinaryObjCmd: format} {
   1.105 +    binary format B 1
   1.106 +} \x80
   1.107 +test binary-4.4 {Tcl_BinaryObjCmd: format} {
   1.108 +    binary format B* 010011
   1.109 +} \x4c
   1.110 +test binary-4.5 {Tcl_BinaryObjCmd: format} {
   1.111 +    binary format B8 01001101
   1.112 +} \x4d
   1.113 +test binary-4.6 {Tcl_BinaryObjCmd: format} {
   1.114 +    binary format A2X2B9 oo 01001101
   1.115 +} \x4d\x00
   1.116 +test binary-4.7 {Tcl_BinaryObjCmd: format} {
   1.117 +    binary format B9 010011011010
   1.118 +} \x4d\x80
   1.119 +test binary-4.8 {Tcl_BinaryObjCmd: format} {
   1.120 +    binary format B2B3 10 010
   1.121 +} \x80\x40
   1.122 +test binary-4.9 {Tcl_BinaryObjCmd: format} {
   1.123 +    list [catch {binary format B1B5 1 foo} msg] $msg
   1.124 +} {1 {expected binary string but got "foo" instead}}
   1.125 +
   1.126 +test binary-5.1 {Tcl_BinaryObjCmd: format} {
   1.127 +    list [catch {binary format b} msg] $msg
   1.128 +} {1 {not enough arguments for all format specifiers}}
   1.129 +test binary-5.2 {Tcl_BinaryObjCmd: format} {
   1.130 +    binary format b0 1
   1.131 +} {}
   1.132 +test binary-5.3 {Tcl_BinaryObjCmd: format} {
   1.133 +    binary format b 1
   1.134 +} \x01
   1.135 +test binary-5.4 {Tcl_BinaryObjCmd: format} {
   1.136 +    binary format b* 010011
   1.137 +} 2
   1.138 +test binary-5.5 {Tcl_BinaryObjCmd: format} {
   1.139 +    binary format b8 01001101
   1.140 +} \xb2
   1.141 +test binary-5.6 {Tcl_BinaryObjCmd: format} {
   1.142 +    binary format A2X2b9 oo 01001101
   1.143 +} \xb2\x00
   1.144 +test binary-5.7 {Tcl_BinaryObjCmd: format} {
   1.145 +    binary format b9 010011011010
   1.146 +} \xb2\x01
   1.147 +test binary-5.8 {Tcl_BinaryObjCmd: format} {
   1.148 +    binary format b17 1
   1.149 +} \x01\00\00
   1.150 +test binary-5.9 {Tcl_BinaryObjCmd: format} {
   1.151 +    binary format b2b3 10 010
   1.152 +} \x01\x02
   1.153 +test binary-5.10 {Tcl_BinaryObjCmd: format} {
   1.154 +    list [catch {binary format b1b5 1 foo} msg] $msg
   1.155 +} {1 {expected binary string but got "foo" instead}}
   1.156 +
   1.157 +test binary-6.1 {Tcl_BinaryObjCmd: format} {
   1.158 +    list [catch {binary format h} msg] $msg
   1.159 +} {1 {not enough arguments for all format specifiers}}
   1.160 +test binary-6.2 {Tcl_BinaryObjCmd: format} {
   1.161 +    binary format h0 1
   1.162 +} {}
   1.163 +test binary-6.3 {Tcl_BinaryObjCmd: format} {
   1.164 +    binary format h 1
   1.165 +} \x01
   1.166 +test binary-6.4 {Tcl_BinaryObjCmd: format} {
   1.167 +    binary format h c
   1.168 +} \x0c
   1.169 +test binary-6.5 {Tcl_BinaryObjCmd: format} {
   1.170 +    binary format h* baadf00d
   1.171 +} \xab\xda\x0f\xd0
   1.172 +test binary-6.6 {Tcl_BinaryObjCmd: format} {
   1.173 +    binary format h4 c410
   1.174 +} \x4c\x01
   1.175 +test binary-6.7 {Tcl_BinaryObjCmd: format} {
   1.176 +    binary format h6 c4102
   1.177 +} \x4c\x01\x02
   1.178 +test binary-6.8 {Tcl_BinaryObjCmd: format} {
   1.179 +    binary format h5 c41020304
   1.180 +} \x4c\x01\x02
   1.181 +test binary-6.9 {Tcl_BinaryObjCmd: format} {
   1.182 +    binary format a3X3h5 foo 2
   1.183 +} \x02\x00\x00
   1.184 +test binary-6.10 {Tcl_BinaryObjCmd: format} {
   1.185 +    binary format h2h3 23 456
   1.186 +} \x32\x54\x06
   1.187 +test binary-6.11 {Tcl_BinaryObjCmd: format} {
   1.188 +    list [catch {binary format h2 foo} msg] $msg
   1.189 +} {1 {expected hexadecimal string but got "foo" instead}}
   1.190 +
   1.191 +test binary-7.1 {Tcl_BinaryObjCmd: format} {
   1.192 +    list [catch {binary format H} msg] $msg
   1.193 +} {1 {not enough arguments for all format specifiers}}
   1.194 +test binary-7.2 {Tcl_BinaryObjCmd: format} {
   1.195 +    binary format H0 1
   1.196 +} {}
   1.197 +test binary-7.3 {Tcl_BinaryObjCmd: format} {
   1.198 +    binary format H 1
   1.199 +} \x10
   1.200 +test binary-7.4 {Tcl_BinaryObjCmd: format} {
   1.201 +    binary format H c
   1.202 +} \xc0
   1.203 +test binary-7.5 {Tcl_BinaryObjCmd: format} {
   1.204 +    binary format H* baadf00d
   1.205 +} \xba\xad\xf0\x0d
   1.206 +test binary-7.6 {Tcl_BinaryObjCmd: format} {
   1.207 +    binary format H4 c410
   1.208 +} \xc4\x10
   1.209 +test binary-7.7 {Tcl_BinaryObjCmd: format} {
   1.210 +    binary format H6 c4102
   1.211 +} \xc4\x10\x20
   1.212 +test binary-7.8 {Tcl_BinaryObjCmd: format} {
   1.213 +    binary format H5 c41023304
   1.214 +} \xc4\x10\x20
   1.215 +test binary-7.9 {Tcl_BinaryObjCmd: format} {
   1.216 +    binary format a3X3H5 foo 2
   1.217 +} \x20\x00\x00
   1.218 +test binary-7.10 {Tcl_BinaryObjCmd: format} {
   1.219 +    binary format H2H3 23 456
   1.220 +} \x23\x45\x60
   1.221 +test binary-7.11 {Tcl_BinaryObjCmd: format} {
   1.222 +    list [catch {binary format H2 foo} msg] $msg
   1.223 +} {1 {expected hexadecimal string but got "foo" instead}}
   1.224 +
   1.225 +test binary-8.1 {Tcl_BinaryObjCmd: format} {
   1.226 +    list [catch {binary format c} msg] $msg
   1.227 +} {1 {not enough arguments for all format specifiers}}
   1.228 +test binary-8.2 {Tcl_BinaryObjCmd: format} {
   1.229 +    list [catch {binary format c blat} msg] $msg
   1.230 +} {1 {expected integer but got "blat"}}
   1.231 +test binary-8.3 {Tcl_BinaryObjCmd: format} {
   1.232 +    binary format c0 0x50
   1.233 +} {}
   1.234 +test binary-8.4 {Tcl_BinaryObjCmd: format} {
   1.235 +    binary format c 0x50
   1.236 +} P
   1.237 +test binary-8.5 {Tcl_BinaryObjCmd: format} {
   1.238 +    binary format c 0x5052
   1.239 +} R
   1.240 +test binary-8.6 {Tcl_BinaryObjCmd: format} {
   1.241 +    binary format c2 {0x50 0x52}
   1.242 +} PR
   1.243 +test binary-8.7 {Tcl_BinaryObjCmd: format} {
   1.244 +    binary format c2 {0x50 0x52 0x53}
   1.245 +} PR
   1.246 +test binary-8.8 {Tcl_BinaryObjCmd: format} {
   1.247 +    binary format c* {0x50 0x52}
   1.248 +} PR
   1.249 +test binary-8.9 {Tcl_BinaryObjCmd: format} {
   1.250 +    list [catch {binary format c2 {0x50}} msg] $msg
   1.251 +} {1 {number of elements in list does not match count}}
   1.252 +test binary-8.10 {Tcl_BinaryObjCmd: format} {
   1.253 +    set a {0x50 0x51}
   1.254 +    list [catch {binary format c $a} msg] $msg
   1.255 +} [list 1 "expected integer but got \"0x50 0x51\""]
   1.256 +test binary-8.11 {Tcl_BinaryObjCmd: format} {
   1.257 +    set a {0x50 0x51}
   1.258 +    binary format c1 $a
   1.259 +} P
   1.260 +
   1.261 +test binary-9.1 {Tcl_BinaryObjCmd: format} {
   1.262 +    list [catch {binary format s} msg] $msg
   1.263 +} {1 {not enough arguments for all format specifiers}}
   1.264 +test binary-9.2 {Tcl_BinaryObjCmd: format} {
   1.265 +    list [catch {binary format s blat} msg] $msg
   1.266 +} {1 {expected integer but got "blat"}}
   1.267 +test binary-9.3 {Tcl_BinaryObjCmd: format} {
   1.268 +    binary format s0 0x50
   1.269 +} {}
   1.270 +test binary-9.4 {Tcl_BinaryObjCmd: format} {
   1.271 +    binary format s 0x50
   1.272 +} P\x00
   1.273 +test binary-9.5 {Tcl_BinaryObjCmd: format} {
   1.274 +    binary format s 0x5052
   1.275 +} RP
   1.276 +test binary-9.6 {Tcl_BinaryObjCmd: format} {
   1.277 +    binary format s 0x505251 0x53
   1.278 +} QR
   1.279 +test binary-9.7 {Tcl_BinaryObjCmd: format} {
   1.280 +    binary format s2 {0x50 0x52}
   1.281 +} P\x00R\x00
   1.282 +test binary-9.8 {Tcl_BinaryObjCmd: format} {
   1.283 +    binary format s* {0x5051 0x52}
   1.284 +} QPR\x00
   1.285 +test binary-9.9 {Tcl_BinaryObjCmd: format} {
   1.286 +    binary format s2 {0x50 0x52 0x53} 0x54
   1.287 +} P\x00R\x00
   1.288 +test binary-9.10 {Tcl_BinaryObjCmd: format} {
   1.289 +    list [catch {binary format s2 {0x50}} msg] $msg
   1.290 +} {1 {number of elements in list does not match count}}
   1.291 +test binary-9.11 {Tcl_BinaryObjCmd: format} {
   1.292 +    set a {0x50 0x51}
   1.293 +    list [catch {binary format s $a} msg] $msg
   1.294 +} [list 1 "expected integer but got \"0x50 0x51\""]
   1.295 +test binary-9.12 {Tcl_BinaryObjCmd: format} {
   1.296 +    set a {0x50 0x51}
   1.297 +    binary format s1 $a
   1.298 +} P\x00
   1.299 +
   1.300 +test binary-10.1 {Tcl_BinaryObjCmd: format} {
   1.301 +    list [catch {binary format S} msg] $msg
   1.302 +} {1 {not enough arguments for all format specifiers}}
   1.303 +test binary-10.2 {Tcl_BinaryObjCmd: format} {
   1.304 +    list [catch {binary format S blat} msg] $msg
   1.305 +} {1 {expected integer but got "blat"}}
   1.306 +test binary-10.3 {Tcl_BinaryObjCmd: format} {
   1.307 +    binary format S0 0x50
   1.308 +} {}
   1.309 +test binary-10.4 {Tcl_BinaryObjCmd: format} {
   1.310 +    binary format S 0x50
   1.311 +} \x00P
   1.312 +test binary-10.5 {Tcl_BinaryObjCmd: format} {
   1.313 +    binary format S 0x5052
   1.314 +} PR
   1.315 +test binary-10.6 {Tcl_BinaryObjCmd: format} {
   1.316 +    binary format S 0x505251 0x53
   1.317 +} RQ
   1.318 +test binary-10.7 {Tcl_BinaryObjCmd: format} {
   1.319 +    binary format S2 {0x50 0x52}
   1.320 +} \x00P\x00R
   1.321 +test binary-10.8 {Tcl_BinaryObjCmd: format} {
   1.322 +    binary format S* {0x5051 0x52}
   1.323 +} PQ\x00R
   1.324 +test binary-10.9 {Tcl_BinaryObjCmd: format} {
   1.325 +    binary format S2 {0x50 0x52 0x53} 0x54
   1.326 +} \x00P\x00R
   1.327 +test binary-10.10 {Tcl_BinaryObjCmd: format} {
   1.328 +    list [catch {binary format S2 {0x50}} msg] $msg
   1.329 +} {1 {number of elements in list does not match count}}
   1.330 +test binary-10.11 {Tcl_BinaryObjCmd: format} {
   1.331 +    set a {0x50 0x51}
   1.332 +    list [catch {binary format S $a} msg] $msg
   1.333 +} [list 1 "expected integer but got \"0x50 0x51\""]
   1.334 +test binary-10.12 {Tcl_BinaryObjCmd: format} {
   1.335 +    set a {0x50 0x51}
   1.336 +    binary format S1 $a
   1.337 +} \x00P
   1.338 +
   1.339 +test binary-11.1 {Tcl_BinaryObjCmd: format} {
   1.340 +    list [catch {binary format i} msg] $msg
   1.341 +} {1 {not enough arguments for all format specifiers}}
   1.342 +test binary-11.2 {Tcl_BinaryObjCmd: format} {
   1.343 +    list [catch {binary format i blat} msg] $msg
   1.344 +} {1 {expected integer but got "blat"}}
   1.345 +test binary-11.3 {Tcl_BinaryObjCmd: format} {
   1.346 +    binary format i0 0x50
   1.347 +} {}
   1.348 +test binary-11.4 {Tcl_BinaryObjCmd: format} {
   1.349 +    binary format i 0x50
   1.350 +} P\x00\x00\x00
   1.351 +test binary-11.5 {Tcl_BinaryObjCmd: format} {
   1.352 +    binary format i 0x5052
   1.353 +} RP\x00\x00
   1.354 +test binary-11.6 {Tcl_BinaryObjCmd: format} {
   1.355 +    binary format i 0x505251 0x53
   1.356 +} QRP\x00
   1.357 +test binary-11.7 {Tcl_BinaryObjCmd: format} {
   1.358 +    binary format i1 {0x505251 0x53}
   1.359 +} QRP\x00
   1.360 +test binary-11.8 {Tcl_BinaryObjCmd: format} {
   1.361 +    binary format i 0x53525150
   1.362 +} PQRS
   1.363 +test binary-11.9 {Tcl_BinaryObjCmd: format} {
   1.364 +    binary format i2 {0x50 0x52}
   1.365 +} P\x00\x00\x00R\x00\x00\x00
   1.366 +test binary-11.10 {Tcl_BinaryObjCmd: format} {
   1.367 +    binary format i* {0x50515253 0x52}
   1.368 +} SRQPR\x00\x00\x00
   1.369 +test binary-11.11 {Tcl_BinaryObjCmd: format} {
   1.370 +    list [catch {binary format i2 {0x50}} msg] $msg
   1.371 +} {1 {number of elements in list does not match count}}
   1.372 +test binary-11.12 {Tcl_BinaryObjCmd: format} {
   1.373 +    set a {0x50 0x51}
   1.374 +    list [catch {binary format i $a} msg] $msg
   1.375 +} [list 1 "expected integer but got \"0x50 0x51\""]
   1.376 +test binary-11.13 {Tcl_BinaryObjCmd: format} {
   1.377 +    set a {0x50 0x51}
   1.378 +    binary format i1 $a
   1.379 +} P\x00\x00\x00
   1.380 +
   1.381 +test binary-12.1 {Tcl_BinaryObjCmd: format} {
   1.382 +    list [catch {binary format I} msg] $msg
   1.383 +} {1 {not enough arguments for all format specifiers}}
   1.384 +test binary-12.2 {Tcl_BinaryObjCmd: format} {
   1.385 +    list [catch {binary format I blat} msg] $msg
   1.386 +} {1 {expected integer but got "blat"}}
   1.387 +test binary-12.3 {Tcl_BinaryObjCmd: format} {
   1.388 +    binary format I0 0x50
   1.389 +} {}
   1.390 +test binary-12.4 {Tcl_BinaryObjCmd: format} {
   1.391 +    binary format I 0x50
   1.392 +} \x00\x00\x00P
   1.393 +test binary-12.5 {Tcl_BinaryObjCmd: format} {
   1.394 +    binary format I 0x5052
   1.395 +} \x00\x00PR
   1.396 +test binary-12.6 {Tcl_BinaryObjCmd: format} {
   1.397 +    binary format I 0x505251 0x53
   1.398 +} \x00PRQ
   1.399 +test binary-12.7 {Tcl_BinaryObjCmd: format} {
   1.400 +    binary format I1 {0x505251 0x53}
   1.401 +} \x00PRQ
   1.402 +test binary-12.8 {Tcl_BinaryObjCmd: format} {
   1.403 +    binary format I 0x53525150
   1.404 +} SRQP
   1.405 +test binary-12.9 {Tcl_BinaryObjCmd: format} {
   1.406 +    binary format I2 {0x50 0x52}
   1.407 +} \x00\x00\x00P\x00\x00\x00R
   1.408 +test binary-12.10 {Tcl_BinaryObjCmd: format} {
   1.409 +    binary format I* {0x50515253 0x52}
   1.410 +} PQRS\x00\x00\x00R
   1.411 +test binary-12.11 {Tcl_BinaryObjCmd: format} {
   1.412 +    list [catch {binary format i2 {0x50}} msg] $msg
   1.413 +} {1 {number of elements in list does not match count}}
   1.414 +test binary-12.12 {Tcl_BinaryObjCmd: format} {
   1.415 +    set a {0x50 0x51}
   1.416 +    list [catch {binary format I $a} msg] $msg
   1.417 +} [list 1 "expected integer but got \"0x50 0x51\""]
   1.418 +test binary-12.13 {Tcl_BinaryObjCmd: format} {
   1.419 +    set a {0x50 0x51}
   1.420 +    binary format I1 $a
   1.421 +} \x00\x00\x00P
   1.422 +
   1.423 +test binary-13.1 {Tcl_BinaryObjCmd: format} {
   1.424 +    list [catch {binary format f} msg] $msg
   1.425 +} {1 {not enough arguments for all format specifiers}}
   1.426 +test binary-13.2 {Tcl_BinaryObjCmd: format} {
   1.427 +    list [catch {binary format f blat} msg] $msg
   1.428 +} {1 {expected floating-point number but got "blat"}}
   1.429 +test binary-13.3 {Tcl_BinaryObjCmd: format} {
   1.430 +    binary format f0 1.6
   1.431 +} {}
   1.432 +test binary-13.4 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
   1.433 +    binary format f 1.6
   1.434 +} \x3f\xcc\xcc\xcd
   1.435 +test binary-13.5 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
   1.436 +    binary format f 1.6
   1.437 +} \xcd\xcc\xcc\x3f
   1.438 +test binary-13.6 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
   1.439 +    binary format f* {1.6 3.4}
   1.440 +} \x3f\xcc\xcc\xcd\x40\x59\x99\x9a
   1.441 +test binary-13.7 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
   1.442 +    binary format f* {1.6 3.4}
   1.443 +} \xcd\xcc\xcc\x3f\x9a\x99\x59\x40
   1.444 +test binary-13.8 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
   1.445 +    binary format f2 {1.6 3.4}
   1.446 +} \x3f\xcc\xcc\xcd\x40\x59\x99\x9a
   1.447 +test binary-13.9 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
   1.448 +    binary format f2 {1.6 3.4}
   1.449 +} \xcd\xcc\xcc\x3f\x9a\x99\x59\x40
   1.450 +test binary-13.10 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
   1.451 +    binary format f2 {1.6 3.4 5.6}
   1.452 +} \x3f\xcc\xcc\xcd\x40\x59\x99\x9a
   1.453 +test binary-13.11 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
   1.454 +    binary format f2 {1.6 3.4 5.6}
   1.455 +} \xcd\xcc\xcc\x3f\x9a\x99\x59\x40
   1.456 +test binary-13.12 {Tcl_BinaryObjCmd: float overflow} {nonPortable macOrUnix} {
   1.457 +    binary format f -3.402825e+38
   1.458 +} \xff\x7f\xff\xff
   1.459 +test binary-13.13 {Tcl_BinaryObjCmd: float overflow} {nonPortable pcOnly} {
   1.460 +    binary format f -3.402825e+38
   1.461 +} \xff\xff\x7f\xff
   1.462 +test binary-13.14 {Tcl_BinaryObjCmd: float underflow} {nonPortable macOrUnix} {
   1.463 +    binary format f -3.402825e-100
   1.464 +} \x80\x00\x00\x00
   1.465 +test binary-13.15 {Tcl_BinaryObjCmd: float underflow} {nonPortable pcOnly} {
   1.466 +    binary format f -3.402825e-100
   1.467 +} \x00\x00\x00\x80
   1.468 +test binary-13.16 {Tcl_BinaryObjCmd: format} {
   1.469 +    list [catch {binary format f2 {1.6}} msg] $msg
   1.470 +} {1 {number of elements in list does not match count}}
   1.471 +test binary-13.17 {Tcl_BinaryObjCmd: format} {
   1.472 +    set a {1.6 3.4}
   1.473 +    list [catch {binary format f $a} msg] $msg
   1.474 +} [list 1 "expected floating-point number but got \"1.6 3.4\""]
   1.475 +test binary-13.18 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
   1.476 +    set a {1.6 3.4}
   1.477 +    binary format f1 $a
   1.478 +} \x3f\xcc\xcc\xcd
   1.479 +test binary-13.19 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
   1.480 +    set a {1.6 3.4}
   1.481 +    binary format f1 $a
   1.482 +} \xcd\xcc\xcc\x3f
   1.483 +
   1.484 +test binary-14.1 {Tcl_BinaryObjCmd: format} {
   1.485 +    list [catch {binary format d} msg] $msg
   1.486 +} {1 {not enough arguments for all format specifiers}}
   1.487 +test binary-14.2 {Tcl_BinaryObjCmd: format} {
   1.488 +    list [catch {binary format d blat} msg] $msg
   1.489 +} {1 {expected floating-point number but got "blat"}}
   1.490 +test binary-14.3 {Tcl_BinaryObjCmd: format} {
   1.491 +    binary format d0 1.6
   1.492 +} {}
   1.493 +test binary-14.4 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
   1.494 +    binary format d 1.6
   1.495 +} \x3f\xf9\x99\x99\x99\x99\x99\x9a
   1.496 +test binary-14.5 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
   1.497 +    binary format d 1.6
   1.498 +} \x9a\x99\x99\x99\x99\x99\xf9\x3f
   1.499 +test binary-14.6 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
   1.500 +    binary format d* {1.6 3.4}
   1.501 +} \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33
   1.502 +test binary-14.7 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
   1.503 +    binary format d* {1.6 3.4}
   1.504 +} \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40
   1.505 +test binary-14.8 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
   1.506 +    binary format d2 {1.6 3.4}
   1.507 +} \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33
   1.508 +test binary-14.9 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
   1.509 +    binary format d2 {1.6 3.4}
   1.510 +} \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40
   1.511 +test binary-14.10 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
   1.512 +    binary format d2 {1.6 3.4 5.6}
   1.513 +} \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33
   1.514 +test binary-14.11 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
   1.515 +    binary format d2 {1.6 3.4 5.6}
   1.516 +} \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40
   1.517 +test binary-14.12 {Tcl_BinaryObjCmd: float overflow} {nonPortable unixOnly} {
   1.518 +    binary format d NaN
   1.519 +} \x7f\xff\xff\xff\xff\xff\xff\xff
   1.520 +test binary-14.13 {Tcl_BinaryObjCmd: float overflow} {nonPortable macOnly} {
   1.521 +    binary format d NaN
   1.522 +} \x7f\xf8\x02\xa0\x00\x00\x00\x00
   1.523 +test binary-14.14 {Tcl_BinaryObjCmd: format} {
   1.524 +    list [catch {binary format d2 {1.6}} msg] $msg
   1.525 +} {1 {number of elements in list does not match count}}
   1.526 +test binary-14.15 {Tcl_BinaryObjCmd: format} {
   1.527 +    set a {1.6 3.4}
   1.528 +    list [catch {binary format d $a} msg] $msg
   1.529 +} [list 1 "expected floating-point number but got \"1.6 3.4\""]
   1.530 +test binary-14.16 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
   1.531 +    set a {1.6 3.4}
   1.532 +    binary format d1 $a
   1.533 +} \x3f\xf9\x99\x99\x99\x99\x99\x9a
   1.534 +test binary-14.17 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
   1.535 +    set a {1.6 3.4}
   1.536 +    binary format d1 $a
   1.537 +} \x9a\x99\x99\x99\x99\x99\xf9\x3f
   1.538 +test binary-14.18 {FormatNumber: Bug 1116542} {
   1.539 +    binary scan [binary format d 1.25] d w
   1.540 +    set w
   1.541 +} 1.25
   1.542 +
   1.543 +test binary-15.1 {Tcl_BinaryObjCmd: format} {
   1.544 +    list [catch {binary format ax*a "y" "z"} msg] $msg
   1.545 +} {1 {cannot use "*" in format string with "x"}}
   1.546 +test binary-15.2 {Tcl_BinaryObjCmd: format} {
   1.547 +    binary format axa "y" "z"
   1.548 +} y\x00z
   1.549 +test binary-15.3 {Tcl_BinaryObjCmd: format} {
   1.550 +    binary format ax3a "y" "z"
   1.551 +} y\x00\x00\x00z
   1.552 +test binary-15.4 {Tcl_BinaryObjCmd: format} {
   1.553 +    binary format a*X3x3a* "foo" "z"
   1.554 +} \x00\x00\x00z
   1.555 +
   1.556 +test binary-16.1 {Tcl_BinaryObjCmd: format} {
   1.557 +    binary format a*X*a "foo" "z"
   1.558 +} zoo
   1.559 +test binary-16.2 {Tcl_BinaryObjCmd: format} {
   1.560 +    binary format aX3a "y" "z"
   1.561 +} z
   1.562 +test binary-16.3 {Tcl_BinaryObjCmd: format} {
   1.563 +    binary format a*Xa* "foo" "zy"
   1.564 +} fozy
   1.565 +test binary-16.4 {Tcl_BinaryObjCmd: format} {
   1.566 +    binary format a*X3a "foobar" "z"
   1.567 +} foozar
   1.568 +test binary-16.5 {Tcl_BinaryObjCmd: format} {
   1.569 +    binary format a*X3aX2a "foobar" "z" "b"
   1.570 +} fobzar
   1.571 +
   1.572 +test binary-17.1 {Tcl_BinaryObjCmd: format} {
   1.573 +    binary format @1
   1.574 +} \x00
   1.575 +test binary-17.2 {Tcl_BinaryObjCmd: format} {
   1.576 +    binary format @5a2 "ab"
   1.577 +} \x00\x00\x00\x00\x00\x61\x62
   1.578 +test binary-17.3 {Tcl_BinaryObjCmd: format} {
   1.579 +    binary format {a*  @0  a2 @* a*} "foobar" "ab" "blat"
   1.580 +} abobarblat
   1.581 +
   1.582 +test binary-18.1 {Tcl_BinaryObjCmd: format} {
   1.583 +    list [catch {binary format u0a3 abc abd} msg] $msg
   1.584 +} {1 {bad field specifier "u"}}
   1.585 +
   1.586 +
   1.587 +test binary-19.1 {Tcl_BinaryObjCmd: errors} {
   1.588 +    list [catch {binary s} msg] $msg
   1.589 +} {1 {wrong # args: should be "binary scan value formatString ?varName varName ...?"}}
   1.590 +test binary-19.2 {Tcl_BinaryObjCmd: errors} {
   1.591 +    list [catch {binary scan foo} msg] $msg
   1.592 +} {1 {wrong # args: should be "binary scan value formatString ?varName varName ...?"}}
   1.593 +test binary-19.3 {Tcl_BinaryObjCmd: scan} {
   1.594 +    binary scan {} {}
   1.595 +} 0
   1.596 +
   1.597 +test binary-20.1 {Tcl_BinaryObjCmd: scan} {
   1.598 +    list [catch {binary scan abc a} msg] $msg
   1.599 +} {1 {not enough arguments for all format specifiers}}
   1.600 +test binary-20.2 {Tcl_BinaryObjCmd: scan} {
   1.601 +    catch {unset arg1}
   1.602 +    set arg1 1
   1.603 +    list [catch {binary scan abc a arg1(a)} msg] $msg
   1.604 +} {1 {can't set "arg1(a)": variable isn't array}}
   1.605 +test binary-20.3 {Tcl_BinaryObjCmd: scan} {
   1.606 +    catch {unset arg1}
   1.607 +    set arg1 abc
   1.608 +    list [binary scan abc a0 arg1] $arg1
   1.609 +} {1 {}}
   1.610 +test binary-20.4 {Tcl_BinaryObjCmd: scan} {
   1.611 +    catch {unset arg1}
   1.612 +    list [binary scan abc a* arg1] $arg1
   1.613 +} {1 abc}
   1.614 +test binary-20.5 {Tcl_BinaryObjCmd: scan} {
   1.615 +    catch {unset arg1}
   1.616 +    list [binary scan abc a5 arg1] [info exists arg1]
   1.617 +} {0 0}
   1.618 +test binary-20.6 {Tcl_BinaryObjCmd: scan} {
   1.619 +    set arg1 foo
   1.620 +    list [binary scan abc a2 arg1] $arg1
   1.621 +} {1 ab}
   1.622 +test binary-20.7 {Tcl_BinaryObjCmd: scan} {
   1.623 +    catch {unset arg1}
   1.624 +    catch {unset arg2}
   1.625 +    list [binary scan abcdef a2a2 arg1 arg2] $arg1 $arg2
   1.626 +} {2 ab cd}
   1.627 +test binary-20.8 {Tcl_BinaryObjCmd: scan} {
   1.628 +    catch {unset arg1}
   1.629 +    list [binary scan abc a2 arg1(a)] $arg1(a)
   1.630 +} {1 ab}
   1.631 +test binary-20.9 {Tcl_BinaryObjCmd: scan} {
   1.632 +    catch {unset arg1}
   1.633 +    list [binary scan abc a arg1(a)] $arg1(a)
   1.634 +} {1 a}
   1.635 +
   1.636 +test binary-21.1 {Tcl_BinaryObjCmd: scan} {
   1.637 +    list [catch {binary scan abc A} msg] $msg
   1.638 +} {1 {not enough arguments for all format specifiers}}
   1.639 +test binary-21.2 {Tcl_BinaryObjCmd: scan} {
   1.640 +    catch {unset arg1}
   1.641 +    set arg1 1
   1.642 +    list [catch {binary scan abc A arg1(a)} msg] $msg
   1.643 +} {1 {can't set "arg1(a)": variable isn't array}}
   1.644 +test binary-21.3 {Tcl_BinaryObjCmd: scan} {
   1.645 +    catch {unset arg1}
   1.646 +    set arg1 abc
   1.647 +    list [binary scan abc A0 arg1] $arg1
   1.648 +} {1 {}}
   1.649 +test binary-21.4 {Tcl_BinaryObjCmd: scan} {
   1.650 +    catch {unset arg1}
   1.651 +    list [binary scan abc A* arg1] $arg1
   1.652 +} {1 abc}
   1.653 +test binary-21.5 {Tcl_BinaryObjCmd: scan} {
   1.654 +    catch {unset arg1}
   1.655 +    list [binary scan abc A5 arg1] [info exists arg1]
   1.656 +} {0 0}
   1.657 +test binary-21.6 {Tcl_BinaryObjCmd: scan} {
   1.658 +    set arg1 foo
   1.659 +    list [binary scan abc A2 arg1] $arg1
   1.660 +} {1 ab}
   1.661 +test binary-21.7 {Tcl_BinaryObjCmd: scan} {
   1.662 +    catch {unset arg1}
   1.663 +    catch {unset arg2}
   1.664 +    list [binary scan abcdef A2A2 arg1 arg2] $arg1 $arg2
   1.665 +} {2 ab cd}
   1.666 +test binary-21.8 {Tcl_BinaryObjCmd: scan} {
   1.667 +    catch {unset arg1}
   1.668 +    list [binary scan abc A2 arg1(a)] $arg1(a)
   1.669 +} {1 ab}
   1.670 +test binary-21.9 {Tcl_BinaryObjCmd: scan} {
   1.671 +    catch {unset arg1}
   1.672 +    list [binary scan abc A2 arg1(a)] $arg1(a)
   1.673 +} {1 ab}
   1.674 +test binary-21.10 {Tcl_BinaryObjCmd: scan} {
   1.675 +    catch {unset arg1}
   1.676 +    list [binary scan abc A arg1(a)] $arg1(a)
   1.677 +} {1 a}
   1.678 +test binary-21.11 {Tcl_BinaryObjCmd: scan} {
   1.679 +    catch {unset arg1}
   1.680 +    list [binary scan "abc def \x00  " A* arg1] $arg1
   1.681 +} {1 {abc def}}
   1.682 +test binary-21.12 {Tcl_BinaryObjCmd: scan} {
   1.683 +    catch {unset arg1}
   1.684 +    list [binary scan "abc def \x00ghi  " A* arg1] $arg1
   1.685 +} [list 1 "abc def \x00ghi"]
   1.686 +
   1.687 +test binary-22.1 {Tcl_BinaryObjCmd: scan} {
   1.688 +    list [catch {binary scan abc b} msg] $msg
   1.689 +} {1 {not enough arguments for all format specifiers}}
   1.690 +test binary-22.2 {Tcl_BinaryObjCmd: scan} {
   1.691 +    catch {unset arg1}
   1.692 +    list [binary scan \x52\x53 b* arg1] $arg1
   1.693 +} {1 0100101011001010}
   1.694 +test binary-22.3 {Tcl_BinaryObjCmd: scan} {
   1.695 +    catch {unset arg1}
   1.696 +    list [binary scan \x82\x53 b arg1] $arg1
   1.697 +} {1 0}
   1.698 +test binary-22.4 {Tcl_BinaryObjCmd: scan} {
   1.699 +    catch {unset arg1}
   1.700 +    list [binary scan \x82\x53 b1 arg1] $arg1
   1.701 +} {1 0}
   1.702 +test binary-22.5 {Tcl_BinaryObjCmd: scan} {
   1.703 +    catch {unset arg1}
   1.704 +    list [binary scan \x82\x53 b0 arg1] $arg1
   1.705 +} {1 {}}
   1.706 +test binary-22.6 {Tcl_BinaryObjCmd: scan} {
   1.707 +    catch {unset arg1}
   1.708 +    list [binary scan \x52\x53 b5 arg1] $arg1
   1.709 +} {1 01001}
   1.710 +test binary-22.7 {Tcl_BinaryObjCmd: scan} {
   1.711 +    catch {unset arg1}
   1.712 +    list [binary scan \x52\x53 b8 arg1] $arg1
   1.713 +} {1 01001010}
   1.714 +test binary-22.8 {Tcl_BinaryObjCmd: scan} {
   1.715 +    catch {unset arg1}
   1.716 +    list [binary scan \x52\x53 b14 arg1] $arg1
   1.717 +} {1 01001010110010}
   1.718 +test binary-22.9 {Tcl_BinaryObjCmd: scan} {
   1.719 +    catch {unset arg1}
   1.720 +    set arg1 foo
   1.721 +    list [binary scan \x52 b14 arg1] $arg1
   1.722 +} {0 foo}
   1.723 +test binary-22.10 {Tcl_BinaryObjCmd: scan} {
   1.724 +    catch {unset arg1}
   1.725 +    set arg1 1
   1.726 +    list [catch {binary scan \x52\x53 b1 arg1(a)} msg] $msg
   1.727 +} {1 {can't set "arg1(a)": variable isn't array}}
   1.728 +test binary-22.11 {Tcl_BinaryObjCmd: scan} {
   1.729 +    catch {unset arg1 arg2}
   1.730 +    set arg1 foo
   1.731 +    set arg2 bar
   1.732 +    list [binary scan \x07\x87\x05 b5b* arg1 arg2] $arg1 $arg2
   1.733 +} {2 11100 1110000110100000}
   1.734 +
   1.735 +
   1.736 +test binary-23.1 {Tcl_BinaryObjCmd: scan} {
   1.737 +    list [catch {binary scan abc B} msg] $msg
   1.738 +} {1 {not enough arguments for all format specifiers}}
   1.739 +test binary-23.2 {Tcl_BinaryObjCmd: scan} {
   1.740 +    catch {unset arg1}
   1.741 +    list [binary scan \x52\x53 B* arg1] $arg1
   1.742 +} {1 0101001001010011}
   1.743 +test binary-23.3 {Tcl_BinaryObjCmd: scan} {
   1.744 +    catch {unset arg1}
   1.745 +    list [binary scan \x82\x53 B arg1] $arg1
   1.746 +} {1 1}
   1.747 +test binary-23.4 {Tcl_BinaryObjCmd: scan} {
   1.748 +    catch {unset arg1}
   1.749 +    list [binary scan \x82\x53 B1 arg1] $arg1
   1.750 +} {1 1}
   1.751 +test binary-23.5 {Tcl_BinaryObjCmd: scan} {
   1.752 +    catch {unset arg1}
   1.753 +    list [binary scan \x52\x53 B0 arg1] $arg1
   1.754 +} {1 {}}
   1.755 +test binary-23.6 {Tcl_BinaryObjCmd: scan} {
   1.756 +    catch {unset arg1}
   1.757 +    list [binary scan \x52\x53 B5 arg1] $arg1
   1.758 +} {1 01010}
   1.759 +test binary-23.7 {Tcl_BinaryObjCmd: scan} {
   1.760 +    catch {unset arg1}
   1.761 +    list [binary scan \x52\x53 B8 arg1] $arg1
   1.762 +} {1 01010010}
   1.763 +test binary-23.8 {Tcl_BinaryObjCmd: scan} {
   1.764 +    catch {unset arg1}
   1.765 +    list [binary scan \x52\x53 B14 arg1] $arg1
   1.766 +} {1 01010010010100}
   1.767 +test binary-23.9 {Tcl_BinaryObjCmd: scan} {
   1.768 +    catch {unset arg1}
   1.769 +    set arg1 foo
   1.770 +    list [binary scan \x52 B14 arg1] $arg1
   1.771 +} {0 foo}
   1.772 +test binary-23.10 {Tcl_BinaryObjCmd: scan} {
   1.773 +    catch {unset arg1}
   1.774 +    set arg1 1
   1.775 +    list [catch {binary scan \x52\x53 B1 arg1(a)} msg] $msg
   1.776 +} {1 {can't set "arg1(a)": variable isn't array}}
   1.777 +test binary-23.11 {Tcl_BinaryObjCmd: scan} {
   1.778 +    catch {unset arg1 arg2}
   1.779 +    set arg1 foo
   1.780 +    set arg2 bar
   1.781 +    list [binary scan \x70\x87\x05 B5B* arg1 arg2] $arg1 $arg2
   1.782 +} {2 01110 1000011100000101}
   1.783 +
   1.784 +test binary-24.1 {Tcl_BinaryObjCmd: scan} {
   1.785 +    list [catch {binary scan abc h} msg] $msg
   1.786 +} {1 {not enough arguments for all format specifiers}}
   1.787 +test binary-24.2 {Tcl_BinaryObjCmd: scan} {
   1.788 +    catch {unset arg1}
   1.789 +    list [binary scan \x52\xa3 h* arg1] $arg1
   1.790 +} {1 253a}
   1.791 +test binary-24.3 {Tcl_BinaryObjCmd: scan} {
   1.792 +    catch {unset arg1}
   1.793 +    list [binary scan \xc2\xa3 h arg1] $arg1
   1.794 +} {1 2}
   1.795 +test binary-24.4 {Tcl_BinaryObjCmd: scan} {
   1.796 +    catch {unset arg1}
   1.797 +    list [binary scan \x82\x53 h1 arg1] $arg1
   1.798 +} {1 2}
   1.799 +test binary-24.5 {Tcl_BinaryObjCmd: scan} {
   1.800 +    catch {unset arg1}
   1.801 +    list [binary scan \x52\x53 h0 arg1] $arg1
   1.802 +} {1 {}}
   1.803 +test binary-24.6 {Tcl_BinaryObjCmd: scan} {
   1.804 +    catch {unset arg1}
   1.805 +    list [binary scan \xf2\x53 h2 arg1] $arg1
   1.806 +} {1 2f}
   1.807 +test binary-24.7 {Tcl_BinaryObjCmd: scan} {
   1.808 +    catch {unset arg1}
   1.809 +    list [binary scan \x52\x53 h3 arg1] $arg1
   1.810 +} {1 253}
   1.811 +test binary-24.8 {Tcl_BinaryObjCmd: scan} {
   1.812 +    catch {unset arg1}
   1.813 +    set arg1 foo
   1.814 +    list [binary scan \x52 h3 arg1] $arg1
   1.815 +} {0 foo}
   1.816 +test binary-24.9 {Tcl_BinaryObjCmd: scan} {
   1.817 +    catch {unset arg1}
   1.818 +    set arg1 1
   1.819 +    list [catch {binary scan \x52\x53 h1 arg1(a)} msg] $msg
   1.820 +} {1 {can't set "arg1(a)": variable isn't array}}
   1.821 +test binary-24.10 {Tcl_BinaryObjCmd: scan} {
   1.822 +    catch {unset arg1 arg2}
   1.823 +    set arg1 foo
   1.824 +    set arg2 bar
   1.825 +    list [binary scan \x70\x87\x05 h2h* arg1 arg2] $arg1 $arg2
   1.826 +} {2 07 7850}
   1.827 +
   1.828 +test binary-25.1 {Tcl_BinaryObjCmd: scan} {
   1.829 +    list [catch {binary scan abc H} msg] $msg
   1.830 +} {1 {not enough arguments for all format specifiers}}
   1.831 +test binary-25.2 {Tcl_BinaryObjCmd: scan} {
   1.832 +    catch {unset arg1}
   1.833 +    list [binary scan \x52\xa3 H* arg1] $arg1
   1.834 +} {1 52a3}
   1.835 +test binary-25.3 {Tcl_BinaryObjCmd: scan} {
   1.836 +    catch {unset arg1}
   1.837 +    list [binary scan \xc2\xa3 H arg1] $arg1
   1.838 +} {1 c}
   1.839 +test binary-25.4 {Tcl_BinaryObjCmd: scan} {
   1.840 +    catch {unset arg1}
   1.841 +    list [binary scan \x82\x53 H1 arg1] $arg1
   1.842 +} {1 8}
   1.843 +test binary-25.5 {Tcl_BinaryObjCmd: scan} {
   1.844 +    catch {unset arg1}
   1.845 +    list [binary scan \x52\x53 H0 arg1] $arg1
   1.846 +} {1 {}}
   1.847 +test binary-25.6 {Tcl_BinaryObjCmd: scan} {
   1.848 +    catch {unset arg1}
   1.849 +    list [binary scan \xf2\x53 H2 arg1] $arg1
   1.850 +} {1 f2}
   1.851 +test binary-25.7 {Tcl_BinaryObjCmd: scan} {
   1.852 +    catch {unset arg1}
   1.853 +    list [binary scan \x52\x53 H3 arg1] $arg1
   1.854 +} {1 525}
   1.855 +test binary-25.8 {Tcl_BinaryObjCmd: scan} {
   1.856 +    catch {unset arg1}
   1.857 +    set arg1 foo
   1.858 +    list [binary scan \x52 H3 arg1] $arg1
   1.859 +} {0 foo}
   1.860 +test binary-25.9 {Tcl_BinaryObjCmd: scan} {
   1.861 +    catch {unset arg1}
   1.862 +    set arg1 1
   1.863 +    list [catch {binary scan \x52\x53 H1 arg1(a)} msg] $msg
   1.864 +} {1 {can't set "arg1(a)": variable isn't array}}
   1.865 +test binary-25.10 {Tcl_BinaryObjCmd: scan} {
   1.866 +    catch {unset arg1 arg2}
   1.867 +    set arg1 foo
   1.868 +    set arg2 bar
   1.869 +    list [binary scan \x70\x87\x05 H2H* arg1 arg2] $arg1 $arg2
   1.870 +} {2 70 8705}
   1.871 +
   1.872 +test binary-26.1 {Tcl_BinaryObjCmd: scan} {
   1.873 +    list [catch {binary scan abc c} msg] $msg
   1.874 +} {1 {not enough arguments for all format specifiers}}
   1.875 +test binary-26.2 {Tcl_BinaryObjCmd: scan} {
   1.876 +    catch {unset arg1}
   1.877 +    list [binary scan \x52\xa3 c* arg1] $arg1
   1.878 +} {1 {82 -93}}
   1.879 +test binary-26.3 {Tcl_BinaryObjCmd: scan} {
   1.880 +    catch {unset arg1}
   1.881 +    list [binary scan \x52\xa3 c arg1] $arg1
   1.882 +} {1 82}
   1.883 +test binary-26.4 {Tcl_BinaryObjCmd: scan} {
   1.884 +    catch {unset arg1}
   1.885 +    list [binary scan \x52\xa3 c1 arg1] $arg1
   1.886 +} {1 82}
   1.887 +test binary-26.5 {Tcl_BinaryObjCmd: scan} {
   1.888 +    catch {unset arg1}
   1.889 +    list [binary scan \x52\xa3 c0 arg1] $arg1
   1.890 +} {1 {}}
   1.891 +test binary-26.6 {Tcl_BinaryObjCmd: scan} {
   1.892 +    catch {unset arg1}
   1.893 +    list [binary scan \x52\xa3 c2 arg1] $arg1
   1.894 +} {1 {82 -93}}
   1.895 +test binary-26.7 {Tcl_BinaryObjCmd: scan} {
   1.896 +    catch {unset arg1}
   1.897 +    list [binary scan \xff c arg1] $arg1
   1.898 +} {1 -1}
   1.899 +test binary-26.8 {Tcl_BinaryObjCmd: scan} {
   1.900 +    catch {unset arg1}
   1.901 +    set arg1 foo
   1.902 +    list [binary scan \x52 c3 arg1] $arg1
   1.903 +} {0 foo}
   1.904 +test binary-26.9 {Tcl_BinaryObjCmd: scan} {
   1.905 +    catch {unset arg1}
   1.906 +    set arg1 1
   1.907 +    list [catch {binary scan \x52\x53 c1 arg1(a)} msg] $msg
   1.908 +} {1 {can't set "arg1(a)": variable isn't array}}
   1.909 +test binary-26.10 {Tcl_BinaryObjCmd: scan} {
   1.910 +    catch {unset arg1 arg2}
   1.911 +    set arg1 foo
   1.912 +    set arg2 bar
   1.913 +    list [binary scan \x70\x87\x05 c2c* arg1 arg2] $arg1 $arg2
   1.914 +} {2 {112 -121} 5}
   1.915 +
   1.916 +test binary-27.1 {Tcl_BinaryObjCmd: scan} {
   1.917 +    list [catch {binary scan abc s} msg] $msg
   1.918 +} {1 {not enough arguments for all format specifiers}}
   1.919 +test binary-27.2 {Tcl_BinaryObjCmd: scan} {
   1.920 +    catch {unset arg1}
   1.921 +    list [binary scan \x52\xa3\x53\x54 s* arg1] $arg1
   1.922 +} {1 {-23726 21587}}
   1.923 +test binary-27.3 {Tcl_BinaryObjCmd: scan} {
   1.924 +    catch {unset arg1}
   1.925 +    list [binary scan \x52\xa3\x53\x54 s arg1] $arg1
   1.926 +} {1 -23726}
   1.927 +test binary-27.4 {Tcl_BinaryObjCmd: scan} {
   1.928 +    catch {unset arg1}
   1.929 +    list [binary scan \x52\xa3 s1 arg1] $arg1
   1.930 +} {1 -23726}
   1.931 +test binary-27.5 {Tcl_BinaryObjCmd: scan} {
   1.932 +    catch {unset arg1}
   1.933 +    list [binary scan \x52\xa3 s0 arg1] $arg1
   1.934 +} {1 {}}
   1.935 +test binary-27.6 {Tcl_BinaryObjCmd: scan} {
   1.936 +    catch {unset arg1}
   1.937 +    list [binary scan \x52\xa3\x53\x54 s2 arg1] $arg1
   1.938 +} {1 {-23726 21587}}
   1.939 +test binary-27.7 {Tcl_BinaryObjCmd: scan} {
   1.940 +    catch {unset arg1}
   1.941 +    set arg1 foo
   1.942 +    list [binary scan \x52 s1 arg1] $arg1
   1.943 +} {0 foo}
   1.944 +test binary-27.8 {Tcl_BinaryObjCmd: scan} {
   1.945 +    catch {unset arg1}
   1.946 +    set arg1 1
   1.947 +    list [catch {binary scan \x52\x53 s1 arg1(a)} msg] $msg
   1.948 +} {1 {can't set "arg1(a)": variable isn't array}}
   1.949 +test binary-27.9 {Tcl_BinaryObjCmd: scan} {
   1.950 +    catch {unset arg1 arg2}
   1.951 +    set arg1 foo
   1.952 +    set arg2 bar
   1.953 +    list [binary scan \x52\xa3\x53\x54\x05 s2c* arg1 arg2] $arg1 $arg2
   1.954 +} {2 {-23726 21587} 5}
   1.955 +
   1.956 +test binary-28.1 {Tcl_BinaryObjCmd: scan} {
   1.957 +    list [catch {binary scan abc S} msg] $msg
   1.958 +} {1 {not enough arguments for all format specifiers}}
   1.959 +test binary-28.2 {Tcl_BinaryObjCmd: scan} {
   1.960 +    catch {unset arg1}
   1.961 +    list [binary scan \x52\xa3\x53\x54 S* arg1] $arg1
   1.962 +} {1 {21155 21332}}
   1.963 +test binary-28.3 {Tcl_BinaryObjCmd: scan} {
   1.964 +    catch {unset arg1}
   1.965 +    list [binary scan \x52\xa3\x53\x54 S arg1] $arg1
   1.966 +} {1 21155}
   1.967 +test binary-28.4 {Tcl_BinaryObjCmd: scan} {
   1.968 +    catch {unset arg1}
   1.969 +    list [binary scan \x52\xa3 S1 arg1] $arg1
   1.970 +} {1 21155}
   1.971 +test binary-28.5 {Tcl_BinaryObjCmd: scan} {
   1.972 +    catch {unset arg1}
   1.973 +    list [binary scan \x52\xa3 S0 arg1] $arg1
   1.974 +} {1 {}}
   1.975 +test binary-28.6 {Tcl_BinaryObjCmd: scan} {
   1.976 +    catch {unset arg1}
   1.977 +    list [binary scan \x52\xa3\x53\x54 S2 arg1] $arg1
   1.978 +} {1 {21155 21332}}
   1.979 +test binary-28.7 {Tcl_BinaryObjCmd: scan} {
   1.980 +    catch {unset arg1}
   1.981 +    set arg1 foo
   1.982 +    list [binary scan \x52 S1 arg1] $arg1
   1.983 +} {0 foo}
   1.984 +test binary-28.8 {Tcl_BinaryObjCmd: scan} {
   1.985 +    catch {unset arg1}
   1.986 +    set arg1 1
   1.987 +    list [catch {binary scan \x52\x53 S1 arg1(a)} msg] $msg
   1.988 +} {1 {can't set "arg1(a)": variable isn't array}}
   1.989 +test binary-28.9 {Tcl_BinaryObjCmd: scan} {
   1.990 +    catch {unset arg1 arg2}
   1.991 +    set arg1 foo
   1.992 +    set arg2 bar
   1.993 +    list [binary scan \x52\xa3\x53\x54\x05 S2c* arg1 arg2] $arg1 $arg2
   1.994 +} {2 {21155 21332} 5}
   1.995 +
   1.996 +test binary-29.1 {Tcl_BinaryObjCmd: scan} {
   1.997 +    list [catch {binary scan abc i} msg] $msg
   1.998 +} {1 {not enough arguments for all format specifiers}}
   1.999 +test binary-29.2 {Tcl_BinaryObjCmd: scan} {
  1.1000 +    catch {unset arg1}
  1.1001 +    list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 i* arg1] $arg1
  1.1002 +} {1 {1414767442 67305985}}
  1.1003 +test binary-29.3 {Tcl_BinaryObjCmd: scan} {
  1.1004 +    catch {unset arg1}
  1.1005 +    list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 i arg1] $arg1
  1.1006 +} {1 1414767442}
  1.1007 +test binary-29.4 {Tcl_BinaryObjCmd: scan} {
  1.1008 +    catch {unset arg1}
  1.1009 +    list [binary scan \x52\xa3\x53\x54 i1 arg1] $arg1
  1.1010 +} {1 1414767442}
  1.1011 +test binary-29.5 {Tcl_BinaryObjCmd: scan} {
  1.1012 +    catch {unset arg1}
  1.1013 +    list [binary scan \x52\xa3\x53 i0 arg1] $arg1
  1.1014 +} {1 {}}
  1.1015 +test binary-29.6 {Tcl_BinaryObjCmd: scan} {
  1.1016 +    catch {unset arg1}
  1.1017 +    list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 i2 arg1] $arg1
  1.1018 +} {1 {1414767442 67305985}}
  1.1019 +test binary-29.7 {Tcl_BinaryObjCmd: scan} {
  1.1020 +    catch {unset arg1}
  1.1021 +    set arg1 foo
  1.1022 +    list [binary scan \x52 i1 arg1] $arg1
  1.1023 +} {0 foo}
  1.1024 +test binary-29.8 {Tcl_BinaryObjCmd: scan} {
  1.1025 +    catch {unset arg1}
  1.1026 +    set arg1 1
  1.1027 +    list [catch {binary scan \x52\x53\x53\x54 i1 arg1(a)} msg] $msg
  1.1028 +} {1 {can't set "arg1(a)": variable isn't array}}
  1.1029 +test binary-29.9 {Tcl_BinaryObjCmd: scan} {
  1.1030 +    catch {unset arg1 arg2}
  1.1031 +    set arg1 foo
  1.1032 +    set arg2 bar
  1.1033 +    list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04\x05 i2c* arg1 arg2] $arg1 $arg2
  1.1034 +} {2 {1414767442 67305985} 5}
  1.1035 +
  1.1036 +test binary-30.1 {Tcl_BinaryObjCmd: scan} {
  1.1037 +    list [catch {binary scan abc I} msg] $msg
  1.1038 +} {1 {not enough arguments for all format specifiers}}
  1.1039 +test binary-30.2 {Tcl_BinaryObjCmd: scan} {
  1.1040 +    catch {unset arg1}
  1.1041 +    list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 I* arg1] $arg1
  1.1042 +} {1 {1386435412 16909060}}
  1.1043 +test binary-30.3 {Tcl_BinaryObjCmd: scan} {
  1.1044 +    catch {unset arg1}
  1.1045 +    list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 I arg1] $arg1
  1.1046 +} {1 1386435412}
  1.1047 +test binary-30.4 {Tcl_BinaryObjCmd: scan} {
  1.1048 +    catch {unset arg1}
  1.1049 +    list [binary scan \x52\xa3\x53\x54 I1 arg1] $arg1
  1.1050 +} {1 1386435412}
  1.1051 +test binary-30.5 {Tcl_BinaryObjCmd: scan} {
  1.1052 +    catch {unset arg1}
  1.1053 +    list [binary scan \x52\xa3\x53 I0 arg1] $arg1
  1.1054 +} {1 {}}
  1.1055 +test binary-30.6 {Tcl_BinaryObjCmd: scan} {
  1.1056 +    catch {unset arg1}
  1.1057 +    list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 I2 arg1] $arg1
  1.1058 +} {1 {1386435412 16909060}}
  1.1059 +test binary-30.7 {Tcl_BinaryObjCmd: scan} {
  1.1060 +    catch {unset arg1}
  1.1061 +    set arg1 foo
  1.1062 +    list [binary scan \x52 I1 arg1] $arg1
  1.1063 +} {0 foo}
  1.1064 +test binary-30.8 {Tcl_BinaryObjCmd: scan} {
  1.1065 +    catch {unset arg1}
  1.1066 +    set arg1 1
  1.1067 +    list [catch {binary scan \x52\x53\x53\x54 I1 arg1(a)} msg] $msg
  1.1068 +} {1 {can't set "arg1(a)": variable isn't array}}
  1.1069 +test binary-30.9 {Tcl_BinaryObjCmd: scan} {
  1.1070 +    catch {unset arg1 arg2}
  1.1071 +    set arg1 foo
  1.1072 +    set arg2 bar
  1.1073 +    list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04\x05 I2c* arg1 arg2] $arg1 $arg2
  1.1074 +} {2 {1386435412 16909060} 5}
  1.1075 +
  1.1076 +test binary-31.1 {Tcl_BinaryObjCmd: scan} {
  1.1077 +    list [catch {binary scan abc f} msg] $msg
  1.1078 +} {1 {not enough arguments for all format specifiers}}
  1.1079 +test binary-31.2 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
  1.1080 +    catch {unset arg1}
  1.1081 +    list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a f* arg1] $arg1
  1.1082 +} {1 {1.60000002384 3.40000009537}}
  1.1083 +test binary-31.3 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
  1.1084 +    catch {unset arg1}
  1.1085 +    list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 f* arg1] $arg1
  1.1086 +} {1 {1.60000002384 3.40000009537}}
  1.1087 +test binary-31.4 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
  1.1088 +    catch {unset arg1}
  1.1089 +    list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a f arg1] $arg1
  1.1090 +} {1 1.60000002384}
  1.1091 +test binary-31.5 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
  1.1092 +    catch {unset arg1}
  1.1093 +    list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 f arg1] $arg1
  1.1094 +} {1 1.60000002384}
  1.1095 +test binary-31.6 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
  1.1096 +    catch {unset arg1}
  1.1097 +    list [binary scan \x3f\xcc\xcc\xcd f1 arg1] $arg1
  1.1098 +} {1 1.60000002384}
  1.1099 +test binary-31.7 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
  1.1100 +    catch {unset arg1}
  1.1101 +    list [binary scan \xcd\xcc\xcc\x3f f1 arg1] $arg1
  1.1102 +} {1 1.60000002384}
  1.1103 +test binary-31.8 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
  1.1104 +    catch {unset arg1}
  1.1105 +    list [binary scan \x3f\xcc\xcc\xcd f0 arg1] $arg1
  1.1106 +} {1 {}}
  1.1107 +test binary-31.9 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
  1.1108 +    catch {unset arg1}
  1.1109 +    list [binary scan \xcd\xcc\xcc\x3f f0 arg1] $arg1
  1.1110 +} {1 {}}
  1.1111 +test binary-31.10 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
  1.1112 +    catch {unset arg1}
  1.1113 +    list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a f2 arg1] $arg1
  1.1114 +} {1 {1.60000002384 3.40000009537}}
  1.1115 +test binary-31.11 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
  1.1116 +    catch {unset arg1}
  1.1117 +    list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 f2 arg1] $arg1
  1.1118 +} {1 {1.60000002384 3.40000009537}}
  1.1119 +test binary-31.12 {Tcl_BinaryObjCmd: scan} {
  1.1120 +    catch {unset arg1}
  1.1121 +    set arg1 foo
  1.1122 +    list [binary scan \x52 f1 arg1] $arg1
  1.1123 +} {0 foo}
  1.1124 +test binary-31.13 {Tcl_BinaryObjCmd: scan} {
  1.1125 +    catch {unset arg1}
  1.1126 +    set arg1 1
  1.1127 +    list [catch {binary scan \x3f\xcc\xcc\xcd f1 arg1(a)} msg] $msg
  1.1128 +} {1 {can't set "arg1(a)": variable isn't array}}
  1.1129 +test binary-31.14 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
  1.1130 +    catch {unset arg1 arg2}
  1.1131 +    set arg1 foo
  1.1132 +    set arg2 bar
  1.1133 +    list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a\x05 f2c* arg1 arg2] $arg1 $arg2
  1.1134 +} {2 {1.60000002384 3.40000009537} 5}
  1.1135 +test binary-31.15 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
  1.1136 +    catch {unset arg1 arg2}
  1.1137 +    set arg1 foo
  1.1138 +    set arg2 bar
  1.1139 +    list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40\x05 f2c* arg1 arg2] $arg1 $arg2
  1.1140 +} {2 {1.60000002384 3.40000009537} 5}
  1.1141 +
  1.1142 +test binary-32.1 {Tcl_BinaryObjCmd: scan} {
  1.1143 +    list [catch {binary scan abc d} msg] $msg
  1.1144 +} {1 {not enough arguments for all format specifiers}}
  1.1145 +test binary-32.2 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
  1.1146 +    catch {unset arg1}
  1.1147 +    list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33 d* arg1] $arg1
  1.1148 +} {1 {1.6 3.4}}
  1.1149 +test binary-32.3 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
  1.1150 +    catch {unset arg1}
  1.1151 +    list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40 d* arg1] $arg1
  1.1152 +} {1 {1.6 3.4}}
  1.1153 +test binary-32.4 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
  1.1154 +    catch {unset arg1}
  1.1155 +    list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33 d arg1] $arg1
  1.1156 +} {1 1.6}
  1.1157 +test binary-32.5 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
  1.1158 +    catch {unset arg1}
  1.1159 +    list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40 d arg1] $arg1
  1.1160 +} {1 1.6}
  1.1161 +test binary-32.6 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
  1.1162 +    catch {unset arg1}
  1.1163 +    list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a d1 arg1] $arg1
  1.1164 +} {1 1.6}
  1.1165 +test binary-32.7 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
  1.1166 +    catch {unset arg1}
  1.1167 +    list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f d1 arg1] $arg1
  1.1168 +} {1 1.6}
  1.1169 +test binary-32.8 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
  1.1170 +    catch {unset arg1}
  1.1171 +    list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a d0 arg1] $arg1
  1.1172 +} {1 {}}
  1.1173 +test binary-32.9 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
  1.1174 +    catch {unset arg1}
  1.1175 +    list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f d0 arg1] $arg1
  1.1176 +} {1 {}}
  1.1177 +test binary-32.10 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
  1.1178 +    catch {unset arg1}
  1.1179 +    list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33 d2 arg1] $arg1
  1.1180 +} {1 {1.6 3.4}}
  1.1181 +test binary-32.11 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
  1.1182 +    catch {unset arg1}
  1.1183 +    list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40 d2 arg1] $arg1
  1.1184 +} {1 {1.6 3.4}}
  1.1185 +test binary-32.12 {Tcl_BinaryObjCmd: scan} {
  1.1186 +    catch {unset arg1}
  1.1187 +    set arg1 foo
  1.1188 +    list [binary scan \x52 d1 arg1] $arg1
  1.1189 +} {0 foo}
  1.1190 +test binary-32.13 {Tcl_BinaryObjCmd: scan} {
  1.1191 +    catch {unset arg1}
  1.1192 +    set arg1 1
  1.1193 +    list [catch {binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a d1 arg1(a)} msg] $msg
  1.1194 +} {1 {can't set "arg1(a)": variable isn't array}}
  1.1195 +test binary-32.14 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
  1.1196 +    catch {unset arg1 arg2}
  1.1197 +    set arg1 foo
  1.1198 +    set arg2 bar
  1.1199 +    list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33\x05 d2c* arg1 arg2] $arg1 $arg2
  1.1200 +} {2 {1.6 3.4} 5}
  1.1201 +test binary-32.15 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
  1.1202 +    catch {unset arg1 arg2}
  1.1203 +    set arg1 foo
  1.1204 +    set arg2 bar
  1.1205 +    list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40\x05 d2c* arg1 arg2] $arg1 $arg2
  1.1206 +} {2 {1.6 3.4} 5}
  1.1207 +
  1.1208 +test binary-33.1 {Tcl_BinaryObjCmd: scan} {
  1.1209 +    catch {unset arg1}
  1.1210 +    catch {unset arg2}
  1.1211 +    list [binary scan abcdefg a2xa3 arg1 arg2] $arg1 $arg2
  1.1212 +} {2 ab def}
  1.1213 +test binary-33.2 {Tcl_BinaryObjCmd: scan} {
  1.1214 +    catch {unset arg1}
  1.1215 +    catch {unset arg2}
  1.1216 +    set arg2 foo
  1.1217 +    list [binary scan abcdefg a3x*a3 arg1 arg2] $arg1 $arg2
  1.1218 +} {1 abc foo}
  1.1219 +test binary-33.3 {Tcl_BinaryObjCmd: scan} {
  1.1220 +    catch {unset arg1}
  1.1221 +    catch {unset arg2}
  1.1222 +    set arg2 foo
  1.1223 +    list [binary scan abcdefg a3x20a3 arg1 arg2] $arg1 $arg2
  1.1224 +} {1 abc foo}
  1.1225 +test binary-33.4 {Tcl_BinaryObjCmd: scan} {
  1.1226 +    catch {unset arg1}
  1.1227 +    catch {unset arg2}
  1.1228 +    set arg2 foo
  1.1229 +    list [binary scan abc a3x20a3 arg1 arg2] $arg1 $arg2
  1.1230 +} {1 abc foo}
  1.1231 +test binary-33.5 {Tcl_BinaryObjCmd: scan} {
  1.1232 +    catch {unset arg1}
  1.1233 +    list [binary scan abcdef x1a1 arg1] $arg1
  1.1234 +} {1 b}
  1.1235 +test binary-33.6 {Tcl_BinaryObjCmd: scan} {
  1.1236 +    catch {unset arg1}
  1.1237 +    list [binary scan abcdef x5a1 arg1] $arg1
  1.1238 +} {1 f}
  1.1239 +test binary-33.7 {Tcl_BinaryObjCmd: scan} {
  1.1240 +    catch {unset arg1}
  1.1241 +    list [binary scan abcdef x0a1 arg1] $arg1
  1.1242 +} {1 a}
  1.1243 +
  1.1244 +test binary-34.1 {Tcl_BinaryObjCmd: scan} {
  1.1245 +    catch {unset arg1}
  1.1246 +    catch {unset arg2}
  1.1247 +    list [binary scan abcdefg a2Xa3 arg1 arg2] $arg1 $arg2
  1.1248 +} {2 ab bcd}
  1.1249 +test binary-34.2 {Tcl_BinaryObjCmd: scan} {
  1.1250 +    catch {unset arg1}
  1.1251 +    catch {unset arg2}
  1.1252 +    set arg2 foo
  1.1253 +    list [binary scan abcdefg a3X*a3 arg1 arg2] $arg1 $arg2
  1.1254 +} {2 abc abc}
  1.1255 +test binary-34.3 {Tcl_BinaryObjCmd: scan} {
  1.1256 +    catch {unset arg1}
  1.1257 +    catch {unset arg2}
  1.1258 +    set arg2 foo
  1.1259 +    list [binary scan abcdefg a3X20a3 arg1 arg2] $arg1 $arg2
  1.1260 +} {2 abc abc}
  1.1261 +test binary-34.4 {Tcl_BinaryObjCmd: scan} {
  1.1262 +    catch {unset arg1}
  1.1263 +    list [binary scan abc X20a3 arg1] $arg1
  1.1264 +} {1 abc}
  1.1265 +test binary-34.5 {Tcl_BinaryObjCmd: scan} {
  1.1266 +    catch {unset arg1}
  1.1267 +    list [binary scan abcdef x*X1a1 arg1] $arg1
  1.1268 +} {1 f}
  1.1269 +test binary-34.6 {Tcl_BinaryObjCmd: scan} {
  1.1270 +    catch {unset arg1}
  1.1271 +    list [binary scan abcdef x*X5a1 arg1] $arg1
  1.1272 +} {1 b}
  1.1273 +test binary-34.7 {Tcl_BinaryObjCmd: scan} {
  1.1274 +    catch {unset arg1}
  1.1275 +    list [binary scan abcdef x3X0a1 arg1] $arg1
  1.1276 +} {1 d}
  1.1277 +
  1.1278 +test binary-35.1 {Tcl_BinaryObjCmd: scan} {
  1.1279 +    catch {unset arg1}
  1.1280 +    catch {unset arg2}
  1.1281 +    list [catch {binary scan abcdefg a2@a3 arg1 arg2} msg] $msg
  1.1282 +} {1 {missing count for "@" field specifier}}
  1.1283 +test binary-35.2 {Tcl_BinaryObjCmd: scan} {
  1.1284 +    catch {unset arg1}
  1.1285 +    catch {unset arg2}
  1.1286 +    set arg2 foo
  1.1287 +    list [binary scan abcdefg a3@*a3 arg1 arg2] $arg1 $arg2
  1.1288 +} {1 abc foo}
  1.1289 +test binary-35.3 {Tcl_BinaryObjCmd: scan} {
  1.1290 +    catch {unset arg1}
  1.1291 +    catch {unset arg2}
  1.1292 +    set arg2 foo
  1.1293 +    list [binary scan abcdefg a3@20a3 arg1 arg2] $arg1 $arg2
  1.1294 +} {1 abc foo}
  1.1295 +test binary-35.4 {Tcl_BinaryObjCmd: scan} {
  1.1296 +    catch {unset arg1}
  1.1297 +    list [binary scan abcdef @2a3 arg1] $arg1
  1.1298 +} {1 cde}
  1.1299 +test binary-35.5 {Tcl_BinaryObjCmd: scan} {
  1.1300 +    catch {unset arg1}
  1.1301 +    list [binary scan abcdef x*@1a1 arg1] $arg1
  1.1302 +} {1 b}
  1.1303 +test binary-35.6 {Tcl_BinaryObjCmd: scan} {
  1.1304 +    catch {unset arg1}
  1.1305 +    list [binary scan abcdef x*@0a1 arg1] $arg1
  1.1306 +} {1 a}
  1.1307 +
  1.1308 +test binary-36.1 {Tcl_BinaryObjCmd: scan} {
  1.1309 +    list [catch {binary scan abcdef u0a3} msg] $msg
  1.1310 +} {1 {bad field specifier "u"}}
  1.1311 +
  1.1312 +# GetFormatSpec is pretty thoroughly tested above, but there are a few
  1.1313 +# cases we should text explicitly
  1.1314 +
  1.1315 +test binary-37.1 {GetFormatSpec: whitespace} {
  1.1316 +    binary format "a3 a5     a3" foo barblat baz
  1.1317 +} foobarblbaz
  1.1318 +test binary-37.2 {GetFormatSpec: whitespace} {
  1.1319 +    binary format "      " foo
  1.1320 +} {}
  1.1321 +test binary-37.3 {GetFormatSpec: whitespace} {
  1.1322 +    binary format "     a3" foo
  1.1323 +} foo
  1.1324 +test binary-37.4 {GetFormatSpec: whitespace} {
  1.1325 +    binary format "" foo
  1.1326 +} {}
  1.1327 +test binary-37.5 {GetFormatSpec: whitespace} {
  1.1328 +    binary format "" foo
  1.1329 +} {}
  1.1330 +test binary-37.6 {GetFormatSpec: whitespace} {
  1.1331 +    binary format "     a3   " foo
  1.1332 +} foo
  1.1333 +test binary-37.7 {GetFormatSpec: numbers} {
  1.1334 +    list [catch {binary scan abcdef "x-1" foo} msg] $msg
  1.1335 +} {1 {bad field specifier "-"}}
  1.1336 +test binary-37.8 {GetFormatSpec: numbers} {
  1.1337 +    catch {unset arg1}
  1.1338 +    set arg1 foo
  1.1339 +    list [binary scan abcdef "a0x3" arg1] $arg1
  1.1340 +} {1 {}}
  1.1341 +test binary-37.9 {GetFormatSpec: numbers} {
  1.1342 +    # test format of neg numbers
  1.1343 +    # bug report/fix provided by Harald Kirsch
  1.1344 +    set x [binary format f* {1 -1 2 -2 0}]
  1.1345 +    binary scan $x f* bla
  1.1346 +    set bla
  1.1347 +} {1.0 -1.0 2.0 -2.0 0.0}
  1.1348 +
  1.1349 +test binary-38.1 {FormatNumber: word alignment} {
  1.1350 +    set x [binary format c1s1 1 1]
  1.1351 +} \x01\x01\x00
  1.1352 +test binary-38.2 {FormatNumber: word alignment} {
  1.1353 +    set x [binary format c1S1 1 1]
  1.1354 +} \x01\x00\x01
  1.1355 +test binary-38.3 {FormatNumber: word alignment} {
  1.1356 +    set x [binary format c1i1 1 1]
  1.1357 +} \x01\x01\x00\x00\x00
  1.1358 +test binary-38.4 {FormatNumber: word alignment} {
  1.1359 +    set x [binary format c1I1 1 1]
  1.1360 +} \x01\x00\x00\x00\x01
  1.1361 +test binary-38.5 {FormatNumber: word alignment} {nonPortable macOrUnix} {
  1.1362 +    set x [binary format c1d1 1 1.6]
  1.1363 +} \x01\x3f\xf9\x99\x99\x99\x99\x99\x9a
  1.1364 +test binary-38.6 {FormatNumber: word alignment} {nonPortable pcOnly} {
  1.1365 +    set x [binary format c1d1 1 1.6]
  1.1366 +} \x01\x9a\x99\x99\x99\x99\x99\xf9\x3f
  1.1367 +test binary-38.7 {FormatNumber: word alignment} {nonPortable macOrUnix} {
  1.1368 +    set x [binary format c1f1 1 1.6]
  1.1369 +} \x01\x3f\xcc\xcc\xcd
  1.1370 +test binary-38.8 {FormatNumber: word alignment} {nonPortable pcOnly} {
  1.1371 +    set x [binary format c1f1 1 1.6]
  1.1372 +} \x01\xcd\xcc\xcc\x3f
  1.1373 +
  1.1374 +test binary-39.1 {ScanNumber: sign extension} {
  1.1375 +    catch {unset arg1}
  1.1376 +    list [binary scan \x52\xa3 c2 arg1] $arg1
  1.1377 +} {1 {82 -93}}
  1.1378 +test binary-39.2 {ScanNumber: sign extension} {
  1.1379 +    catch {unset arg1}
  1.1380 +    list [binary scan \x01\x02\x01\x81\x82\x01\x81\x82 s4 arg1] $arg1
  1.1381 +} {1 {513 -32511 386 -32127}}
  1.1382 +test binary-39.3 {ScanNumber: sign extension} {
  1.1383 +    catch {unset arg1}
  1.1384 +    list [binary scan \x01\x02\x01\x81\x82\x01\x81\x82 S4 arg1] $arg1
  1.1385 +} {1 {258 385 -32255 -32382}}
  1.1386 +test binary-39.4 {ScanNumber: sign extension} {
  1.1387 +    catch {unset arg1}
  1.1388 +    list [binary scan \x01\x01\x01\x02\x81\x01\x01\x01\x01\x82\x01\x01\x01\x01\x82\x01\x01\x01\x01\x81 i5 arg1] $arg1
  1.1389 +} {1 {33620225 16843137 16876033 25297153 -2130640639}}
  1.1390 +test binary-39.5 {ScanNumber: sign extension} {
  1.1391 +    catch {unset arg1}
  1.1392 +    list [binary scan \x01\x01\x01\x02\x81\x01\x01\x01\x01\x82\x01\x01\x01\x01\x82\x01\x01\x01\x01\x81 I5 arg1] $arg1
  1.1393 +} {1 {16843010 -2130640639 25297153 16876033 16843137}}
  1.1394 +
  1.1395 +test binary-40.1 {ScanNumber: floating point overflow} {nonPortable unixOnly} {
  1.1396 +    catch {unset arg1}
  1.1397 +    list [binary scan \xff\xff\xff\xff f1 arg1] $arg1
  1.1398 +} {1 -NaN}
  1.1399 +test binary-40.2 {ScanNumber: floating point overflow} {nonPortable macOnly} {
  1.1400 +    catch {unset arg1}
  1.1401 +    list [binary scan \xff\xff\xff\xff f1 arg1] $arg1
  1.1402 +} {1 -NAN(255)}
  1.1403 +test binary-40.3 {ScanNumber: floating point overflow} {nonPortable pcOnly} {
  1.1404 +    catch {unset arg1}
  1.1405 +    set result [binary scan \xff\xff\xff\xff f1 arg1]
  1.1406 +    if {([string compare $arg1 -1.\#QNAN] == 0)
  1.1407 +	|| ([string compare $arg1 -NAN] == 0)} {
  1.1408 +	lappend result success
  1.1409 +    } else {
  1.1410 +	lappend result failure
  1.1411 +    }
  1.1412 +} {1 success}
  1.1413 +test binary-40.4 {ScanNumber: floating point overflow} {nonPortable unixOnly} {
  1.1414 +    catch {unset arg1}
  1.1415 +    list [binary scan \xff\xff\xff\xff\xff\xff\xff\xff d1 arg1] $arg1
  1.1416 +} {1 -NaN}
  1.1417 +test binary-40.5 {ScanNumber: floating point overflow} {nonPortable macOnly} {
  1.1418 +    catch {unset arg1}
  1.1419 +    list [binary scan \xff\xff\xff\xff\xff\xff\xff\xff d1 arg1] $arg1
  1.1420 +} {1 -NAN(255)}
  1.1421 +test binary-40.6 {ScanNumber: floating point overflow} {nonPortable pcOnly} {
  1.1422 +    catch {unset arg1}
  1.1423 +    set result [binary scan \xff\xff\xff\xff\xff\xff\xff\xff d1 arg1]
  1.1424 +    if {([string compare $arg1 -1.\#QNAN] == 0)
  1.1425 +	|| ([string compare $arg1 -NAN] == 0)} {
  1.1426 +	lappend result success
  1.1427 +    } else {
  1.1428 +	lappend result failure
  1.1429 +    }
  1.1430 +} {1 success}
  1.1431 +
  1.1432 +test binary-41.1 {ScanNumber: word alignment} {
  1.1433 +    catch {unset arg1; unset arg2}
  1.1434 +    list [binary scan \x01\x01\x00 c1s1 arg1 arg2] $arg1 $arg2
  1.1435 +} {2 1 1}
  1.1436 +test binary-41.2 {ScanNumber: word alignment} {
  1.1437 +    catch {unset arg1; unset arg2}
  1.1438 +    list [binary scan \x01\x00\x01 c1S1 arg1 arg2] $arg1 $arg2
  1.1439 +} {2 1 1}
  1.1440 +test binary-41.3 {ScanNumber: word alignment} {
  1.1441 +    catch {unset arg1; unset arg2}
  1.1442 +    list [binary scan \x01\x01\x00\x00\x00 c1i1 arg1 arg2] $arg1 $arg2
  1.1443 +} {2 1 1}
  1.1444 +test binary-41.4 {ScanNumber: word alignment} {
  1.1445 +    catch {unset arg1; unset arg2}
  1.1446 +    list [binary scan \x01\x00\x00\x00\x01 c1I1 arg1 arg2] $arg1 $arg2
  1.1447 +} {2 1 1}
  1.1448 +test binary-41.5 {ScanNumber: word alignment} {nonPortable macOrUnix} {
  1.1449 +    catch {unset arg1; unset arg2}
  1.1450 +    list [binary scan \x01\x3f\xcc\xcc\xcd c1f1 arg1 arg2] $arg1 $arg2
  1.1451 +} {2 1 1.60000002384}
  1.1452 +test binary-41.6 {ScanNumber: word alignment} {nonPortable pcOnly} {
  1.1453 +    catch {unset arg1; unset arg2}
  1.1454 +    list [binary scan \x01\xcd\xcc\xcc\x3f c1f1 arg1 arg2] $arg1 $arg2
  1.1455 +} {2 1 1.60000002384}
  1.1456 +test binary-41.7 {ScanNumber: word alignment} {nonPortable macOrUnix} {
  1.1457 +    catch {unset arg1; unset arg2}
  1.1458 +    list [binary scan \x01\x3f\xf9\x99\x99\x99\x99\x99\x9a c1d1 arg1 arg2] $arg1 $arg2
  1.1459 +} {2 1 1.6}
  1.1460 +test binary-41.8 {ScanNumber: word alignment} {nonPortable pcOnly} {
  1.1461 +    catch {unset arg1; unset arg2}
  1.1462 +    list [binary scan \x01\x9a\x99\x99\x99\x99\x99\xf9\x3f c1d1 arg1 arg2] $arg1 $arg2
  1.1463 +} {2 1 1.6}
  1.1464 +
  1.1465 +test binary-42.1 {Tcl_BinaryObjCmd: bad arguments} {} {
  1.1466 +    catch {binary ?} result
  1.1467 +    set result
  1.1468 +} {bad option "?": must be format or scan}
  1.1469 +
  1.1470 +# Wide int (guaranteed at least 64-bit) handling
  1.1471 +test binary-43.1 {Tcl_BinaryObjCmd: format wide int} {} {
  1.1472 +    binary format w 7810179016327718216
  1.1473 +} HelloTcl
  1.1474 +test binary-43.2 {Tcl_BinaryObjCmd: format wide int} {} {
  1.1475 +    binary format W 7810179016327718216
  1.1476 +} lcTolleH
  1.1477 +
  1.1478 +test binary-44.1 {Tcl_BinaryObjCmd: scan wide int} {} {
  1.1479 +    binary scan HelloTcl W x
  1.1480 +    set x
  1.1481 +} 5216694956358656876
  1.1482 +test binary-44.2 {Tcl_BinaryObjCmd: scan wide int} {} {
  1.1483 +    binary scan lcTolleH w x
  1.1484 +    set x
  1.1485 +} 5216694956358656876
  1.1486 +test binary-44.3 {Tcl_BinaryObjCmd: scan wide int with bit 31 set} {} {
  1.1487 +    binary scan [binary format w [expr {wide(3) << 31}]] w x
  1.1488 +    set x
  1.1489 +} 6442450944
  1.1490 +test binary-44.4 {Tcl_BinaryObjCmd: scan wide int with bit 31 set} {} {
  1.1491 +    binary scan [binary format W [expr {wide(3) << 31}]] W x
  1.1492 +    set x
  1.1493 +} 6442450944
  1.1494 +
  1.1495 +test binary-45.1 {Tcl_BinaryObjCmd: combined wide int handling} {
  1.1496 +    binary scan [binary format sws 16450 -1 19521] c* x
  1.1497 +    set x
  1.1498 +} {66 64 -1 -1 -1 -1 -1 -1 -1 -1 65 76}
  1.1499 +test binary-45.2 {Tcl_BinaryObjCmd: combined wide int handling} {
  1.1500 +    binary scan [binary format sWs 16450 0x7fffffff 19521] c* x
  1.1501 +    set x
  1.1502 +} {66 64 0 0 0 0 127 -1 -1 -1 65 76}
  1.1503 +
  1.1504 +test binary-46.1 {Tcl_BinaryObjCmd: handling of non-ISO8859-1 chars} {
  1.1505 +    binary format a* \u20ac
  1.1506 +} \u00ac
  1.1507 +test binary-46.2 {Tcl_BinaryObjCmd: handling of non-ISO8859-1 chars} {
  1.1508 +    list [binary scan [binary format a* \u20ac\u20bd] s x] $x
  1.1509 +} {1 -16980}
  1.1510 +test binary-46.3 {Tcl_BinaryObjCmd: handling of non-ISO8859-1 chars} {
  1.1511 +    set x {}
  1.1512 +    set y {}
  1.1513 +    set z {}
  1.1514 +    list [binary scan [binary format a* \u20ac\u20bd] aaa x y z] $x $y $z
  1.1515 +} "2 \u00ac \u00bd {}"
  1.1516 +test binary-46.4 {Tcl_BinaryObjCmd: handling of non-ISO8859-1 chars} {
  1.1517 +    set x [encoding convertto iso8859-15 \u20ac]
  1.1518 +    set y [binary format a* $x]
  1.1519 +    list $x $y
  1.1520 +} "\u00a4 \u00a4"
  1.1521 +test binary-46.5 {Tcl_BinaryObjCmd: handling of non-ISO8859-1 chars} {
  1.1522 +    set x [binary scan \u00a4 a* y]
  1.1523 +    list $x $y [encoding convertfrom iso8859-15 $y]
  1.1524 +} "1 \u00a4 \u20ac"
  1.1525 +
  1.1526 +test binary-47.1 {Tcl_BinaryObjCmd: number cache reference count handling} {
  1.1527 +    # This test is only reliable when memory debugging is turned on,
  1.1528 +    # but without even memory debugging it should still generate the
  1.1529 +    # expected answers and might therefore still pick up memory corruption
  1.1530 +    # caused by [Bug 851747].
  1.1531 +    list [binary scan aba ccc x x x] $x
  1.1532 +} {3 97}
  1.1533 +
  1.1534 +# cleanup
  1.1535 +::tcltest::cleanupTests
  1.1536 +return