sl@0
|
1 |
# This file tests the tclBinary.c file and the "binary" Tcl command.
|
sl@0
|
2 |
#
|
sl@0
|
3 |
# This file contains a collection of tests for one or more of the Tcl
|
sl@0
|
4 |
# built-in commands. Sourcing this file into Tcl runs the tests and
|
sl@0
|
5 |
# generates output for errors. No output means no errors were found.
|
sl@0
|
6 |
#
|
sl@0
|
7 |
# Copyright (c) 1997 by Sun Microsystems, Inc.
|
sl@0
|
8 |
# Copyright (c) 1998-1999 by Scriptics Corporation.
|
sl@0
|
9 |
#
|
sl@0
|
10 |
# See the file "license.terms" for information on usage and redistribution
|
sl@0
|
11 |
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
sl@0
|
12 |
#
|
sl@0
|
13 |
# RCS: @(#) $Id: binary.test,v 1.11.2.4 2006/04/05 15:17:06 dgp Exp $
|
sl@0
|
14 |
|
sl@0
|
15 |
if {[lsearch [namespace children] ::tcltest] == -1} {
|
sl@0
|
16 |
package require tcltest
|
sl@0
|
17 |
namespace import -force ::tcltest::*
|
sl@0
|
18 |
}
|
sl@0
|
19 |
|
sl@0
|
20 |
test binary-0.1 {DupByteArrayInternalRep} {
|
sl@0
|
21 |
set hdr [binary format cc 0 0316]
|
sl@0
|
22 |
set buf hellomatt
|
sl@0
|
23 |
|
sl@0
|
24 |
set data $hdr
|
sl@0
|
25 |
append data $buf
|
sl@0
|
26 |
|
sl@0
|
27 |
string length $data
|
sl@0
|
28 |
} 11
|
sl@0
|
29 |
|
sl@0
|
30 |
test binary-1.1 {Tcl_BinaryObjCmd: bad args} {
|
sl@0
|
31 |
list [catch {binary} msg] $msg
|
sl@0
|
32 |
} {1 {wrong # args: should be "binary option ?arg arg ...?"}}
|
sl@0
|
33 |
test binary-1.2 {Tcl_BinaryObjCmd: bad args} {
|
sl@0
|
34 |
list [catch {binary foo} msg] $msg
|
sl@0
|
35 |
} {1 {bad option "foo": must be format or scan}}
|
sl@0
|
36 |
|
sl@0
|
37 |
test binary-1.3 {Tcl_BinaryObjCmd: format error} {
|
sl@0
|
38 |
list [catch {binary f} msg] $msg
|
sl@0
|
39 |
} {1 {wrong # args: should be "binary format formatString ?arg arg ...?"}}
|
sl@0
|
40 |
test binary-1.4 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
41 |
binary format ""
|
sl@0
|
42 |
} {}
|
sl@0
|
43 |
|
sl@0
|
44 |
|
sl@0
|
45 |
test binary-2.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
46 |
list [catch {binary format a } msg] $msg
|
sl@0
|
47 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
48 |
test binary-2.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
49 |
binary format a0 foo
|
sl@0
|
50 |
} {}
|
sl@0
|
51 |
test binary-2.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
52 |
binary format a f
|
sl@0
|
53 |
} {f}
|
sl@0
|
54 |
test binary-2.4 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
55 |
binary format a foo
|
sl@0
|
56 |
} {f}
|
sl@0
|
57 |
test binary-2.5 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
58 |
binary format a3 foo
|
sl@0
|
59 |
} {foo}
|
sl@0
|
60 |
test binary-2.6 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
61 |
binary format a5 foo
|
sl@0
|
62 |
} foo\x00\x00
|
sl@0
|
63 |
test binary-2.7 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
64 |
binary format a*a3 foobarbaz blat
|
sl@0
|
65 |
} foobarbazbla
|
sl@0
|
66 |
test binary-2.8 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
67 |
binary format a*X3a2 foobar x
|
sl@0
|
68 |
} foox\x00r
|
sl@0
|
69 |
|
sl@0
|
70 |
test binary-3.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
71 |
list [catch {binary format A} msg] $msg
|
sl@0
|
72 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
73 |
test binary-3.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
74 |
binary format A0 f
|
sl@0
|
75 |
} {}
|
sl@0
|
76 |
test binary-3.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
77 |
binary format A f
|
sl@0
|
78 |
} {f}
|
sl@0
|
79 |
test binary-3.4 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
80 |
binary format A foo
|
sl@0
|
81 |
} {f}
|
sl@0
|
82 |
test binary-3.5 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
83 |
binary format A3 foo
|
sl@0
|
84 |
} {foo}
|
sl@0
|
85 |
test binary-3.6 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
86 |
binary format A5 foo
|
sl@0
|
87 |
} {foo }
|
sl@0
|
88 |
test binary-3.7 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
89 |
binary format A*A3 foobarbaz blat
|
sl@0
|
90 |
} foobarbazbla
|
sl@0
|
91 |
test binary-3.8 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
92 |
binary format A*X3A2 foobar x
|
sl@0
|
93 |
} {foox r}
|
sl@0
|
94 |
|
sl@0
|
95 |
test binary-4.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
96 |
list [catch {binary format B} msg] $msg
|
sl@0
|
97 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
98 |
test binary-4.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
99 |
binary format B0 1
|
sl@0
|
100 |
} {}
|
sl@0
|
101 |
test binary-4.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
102 |
binary format B 1
|
sl@0
|
103 |
} \x80
|
sl@0
|
104 |
test binary-4.4 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
105 |
binary format B* 010011
|
sl@0
|
106 |
} \x4c
|
sl@0
|
107 |
test binary-4.5 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
108 |
binary format B8 01001101
|
sl@0
|
109 |
} \x4d
|
sl@0
|
110 |
test binary-4.6 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
111 |
binary format A2X2B9 oo 01001101
|
sl@0
|
112 |
} \x4d\x00
|
sl@0
|
113 |
test binary-4.7 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
114 |
binary format B9 010011011010
|
sl@0
|
115 |
} \x4d\x80
|
sl@0
|
116 |
test binary-4.8 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
117 |
binary format B2B3 10 010
|
sl@0
|
118 |
} \x80\x40
|
sl@0
|
119 |
test binary-4.9 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
120 |
list [catch {binary format B1B5 1 foo} msg] $msg
|
sl@0
|
121 |
} {1 {expected binary string but got "foo" instead}}
|
sl@0
|
122 |
|
sl@0
|
123 |
test binary-5.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
124 |
list [catch {binary format b} msg] $msg
|
sl@0
|
125 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
126 |
test binary-5.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
127 |
binary format b0 1
|
sl@0
|
128 |
} {}
|
sl@0
|
129 |
test binary-5.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
130 |
binary format b 1
|
sl@0
|
131 |
} \x01
|
sl@0
|
132 |
test binary-5.4 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
133 |
binary format b* 010011
|
sl@0
|
134 |
} 2
|
sl@0
|
135 |
test binary-5.5 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
136 |
binary format b8 01001101
|
sl@0
|
137 |
} \xb2
|
sl@0
|
138 |
test binary-5.6 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
139 |
binary format A2X2b9 oo 01001101
|
sl@0
|
140 |
} \xb2\x00
|
sl@0
|
141 |
test binary-5.7 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
142 |
binary format b9 010011011010
|
sl@0
|
143 |
} \xb2\x01
|
sl@0
|
144 |
test binary-5.8 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
145 |
binary format b17 1
|
sl@0
|
146 |
} \x01\00\00
|
sl@0
|
147 |
test binary-5.9 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
148 |
binary format b2b3 10 010
|
sl@0
|
149 |
} \x01\x02
|
sl@0
|
150 |
test binary-5.10 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
151 |
list [catch {binary format b1b5 1 foo} msg] $msg
|
sl@0
|
152 |
} {1 {expected binary string but got "foo" instead}}
|
sl@0
|
153 |
|
sl@0
|
154 |
test binary-6.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
155 |
list [catch {binary format h} msg] $msg
|
sl@0
|
156 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
157 |
test binary-6.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
158 |
binary format h0 1
|
sl@0
|
159 |
} {}
|
sl@0
|
160 |
test binary-6.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
161 |
binary format h 1
|
sl@0
|
162 |
} \x01
|
sl@0
|
163 |
test binary-6.4 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
164 |
binary format h c
|
sl@0
|
165 |
} \x0c
|
sl@0
|
166 |
test binary-6.5 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
167 |
binary format h* baadf00d
|
sl@0
|
168 |
} \xab\xda\x0f\xd0
|
sl@0
|
169 |
test binary-6.6 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
170 |
binary format h4 c410
|
sl@0
|
171 |
} \x4c\x01
|
sl@0
|
172 |
test binary-6.7 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
173 |
binary format h6 c4102
|
sl@0
|
174 |
} \x4c\x01\x02
|
sl@0
|
175 |
test binary-6.8 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
176 |
binary format h5 c41020304
|
sl@0
|
177 |
} \x4c\x01\x02
|
sl@0
|
178 |
test binary-6.9 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
179 |
binary format a3X3h5 foo 2
|
sl@0
|
180 |
} \x02\x00\x00
|
sl@0
|
181 |
test binary-6.10 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
182 |
binary format h2h3 23 456
|
sl@0
|
183 |
} \x32\x54\x06
|
sl@0
|
184 |
test binary-6.11 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
185 |
list [catch {binary format h2 foo} msg] $msg
|
sl@0
|
186 |
} {1 {expected hexadecimal string but got "foo" instead}}
|
sl@0
|
187 |
|
sl@0
|
188 |
test binary-7.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
189 |
list [catch {binary format H} msg] $msg
|
sl@0
|
190 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
191 |
test binary-7.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
192 |
binary format H0 1
|
sl@0
|
193 |
} {}
|
sl@0
|
194 |
test binary-7.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
195 |
binary format H 1
|
sl@0
|
196 |
} \x10
|
sl@0
|
197 |
test binary-7.4 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
198 |
binary format H c
|
sl@0
|
199 |
} \xc0
|
sl@0
|
200 |
test binary-7.5 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
201 |
binary format H* baadf00d
|
sl@0
|
202 |
} \xba\xad\xf0\x0d
|
sl@0
|
203 |
test binary-7.6 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
204 |
binary format H4 c410
|
sl@0
|
205 |
} \xc4\x10
|
sl@0
|
206 |
test binary-7.7 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
207 |
binary format H6 c4102
|
sl@0
|
208 |
} \xc4\x10\x20
|
sl@0
|
209 |
test binary-7.8 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
210 |
binary format H5 c41023304
|
sl@0
|
211 |
} \xc4\x10\x20
|
sl@0
|
212 |
test binary-7.9 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
213 |
binary format a3X3H5 foo 2
|
sl@0
|
214 |
} \x20\x00\x00
|
sl@0
|
215 |
test binary-7.10 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
216 |
binary format H2H3 23 456
|
sl@0
|
217 |
} \x23\x45\x60
|
sl@0
|
218 |
test binary-7.11 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
219 |
list [catch {binary format H2 foo} msg] $msg
|
sl@0
|
220 |
} {1 {expected hexadecimal string but got "foo" instead}}
|
sl@0
|
221 |
|
sl@0
|
222 |
test binary-8.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
223 |
list [catch {binary format c} msg] $msg
|
sl@0
|
224 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
225 |
test binary-8.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
226 |
list [catch {binary format c blat} msg] $msg
|
sl@0
|
227 |
} {1 {expected integer but got "blat"}}
|
sl@0
|
228 |
test binary-8.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
229 |
binary format c0 0x50
|
sl@0
|
230 |
} {}
|
sl@0
|
231 |
test binary-8.4 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
232 |
binary format c 0x50
|
sl@0
|
233 |
} P
|
sl@0
|
234 |
test binary-8.5 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
235 |
binary format c 0x5052
|
sl@0
|
236 |
} R
|
sl@0
|
237 |
test binary-8.6 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
238 |
binary format c2 {0x50 0x52}
|
sl@0
|
239 |
} PR
|
sl@0
|
240 |
test binary-8.7 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
241 |
binary format c2 {0x50 0x52 0x53}
|
sl@0
|
242 |
} PR
|
sl@0
|
243 |
test binary-8.8 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
244 |
binary format c* {0x50 0x52}
|
sl@0
|
245 |
} PR
|
sl@0
|
246 |
test binary-8.9 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
247 |
list [catch {binary format c2 {0x50}} msg] $msg
|
sl@0
|
248 |
} {1 {number of elements in list does not match count}}
|
sl@0
|
249 |
test binary-8.10 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
250 |
set a {0x50 0x51}
|
sl@0
|
251 |
list [catch {binary format c $a} msg] $msg
|
sl@0
|
252 |
} [list 1 "expected integer but got \"0x50 0x51\""]
|
sl@0
|
253 |
test binary-8.11 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
254 |
set a {0x50 0x51}
|
sl@0
|
255 |
binary format c1 $a
|
sl@0
|
256 |
} P
|
sl@0
|
257 |
|
sl@0
|
258 |
test binary-9.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
259 |
list [catch {binary format s} msg] $msg
|
sl@0
|
260 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
261 |
test binary-9.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
262 |
list [catch {binary format s blat} msg] $msg
|
sl@0
|
263 |
} {1 {expected integer but got "blat"}}
|
sl@0
|
264 |
test binary-9.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
265 |
binary format s0 0x50
|
sl@0
|
266 |
} {}
|
sl@0
|
267 |
test binary-9.4 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
268 |
binary format s 0x50
|
sl@0
|
269 |
} P\x00
|
sl@0
|
270 |
test binary-9.5 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
271 |
binary format s 0x5052
|
sl@0
|
272 |
} RP
|
sl@0
|
273 |
test binary-9.6 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
274 |
binary format s 0x505251 0x53
|
sl@0
|
275 |
} QR
|
sl@0
|
276 |
test binary-9.7 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
277 |
binary format s2 {0x50 0x52}
|
sl@0
|
278 |
} P\x00R\x00
|
sl@0
|
279 |
test binary-9.8 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
280 |
binary format s* {0x5051 0x52}
|
sl@0
|
281 |
} QPR\x00
|
sl@0
|
282 |
test binary-9.9 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
283 |
binary format s2 {0x50 0x52 0x53} 0x54
|
sl@0
|
284 |
} P\x00R\x00
|
sl@0
|
285 |
test binary-9.10 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
286 |
list [catch {binary format s2 {0x50}} msg] $msg
|
sl@0
|
287 |
} {1 {number of elements in list does not match count}}
|
sl@0
|
288 |
test binary-9.11 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
289 |
set a {0x50 0x51}
|
sl@0
|
290 |
list [catch {binary format s $a} msg] $msg
|
sl@0
|
291 |
} [list 1 "expected integer but got \"0x50 0x51\""]
|
sl@0
|
292 |
test binary-9.12 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
293 |
set a {0x50 0x51}
|
sl@0
|
294 |
binary format s1 $a
|
sl@0
|
295 |
} P\x00
|
sl@0
|
296 |
|
sl@0
|
297 |
test binary-10.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
298 |
list [catch {binary format S} msg] $msg
|
sl@0
|
299 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
300 |
test binary-10.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
301 |
list [catch {binary format S blat} msg] $msg
|
sl@0
|
302 |
} {1 {expected integer but got "blat"}}
|
sl@0
|
303 |
test binary-10.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
304 |
binary format S0 0x50
|
sl@0
|
305 |
} {}
|
sl@0
|
306 |
test binary-10.4 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
307 |
binary format S 0x50
|
sl@0
|
308 |
} \x00P
|
sl@0
|
309 |
test binary-10.5 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
310 |
binary format S 0x5052
|
sl@0
|
311 |
} PR
|
sl@0
|
312 |
test binary-10.6 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
313 |
binary format S 0x505251 0x53
|
sl@0
|
314 |
} RQ
|
sl@0
|
315 |
test binary-10.7 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
316 |
binary format S2 {0x50 0x52}
|
sl@0
|
317 |
} \x00P\x00R
|
sl@0
|
318 |
test binary-10.8 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
319 |
binary format S* {0x5051 0x52}
|
sl@0
|
320 |
} PQ\x00R
|
sl@0
|
321 |
test binary-10.9 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
322 |
binary format S2 {0x50 0x52 0x53} 0x54
|
sl@0
|
323 |
} \x00P\x00R
|
sl@0
|
324 |
test binary-10.10 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
325 |
list [catch {binary format S2 {0x50}} msg] $msg
|
sl@0
|
326 |
} {1 {number of elements in list does not match count}}
|
sl@0
|
327 |
test binary-10.11 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
328 |
set a {0x50 0x51}
|
sl@0
|
329 |
list [catch {binary format S $a} msg] $msg
|
sl@0
|
330 |
} [list 1 "expected integer but got \"0x50 0x51\""]
|
sl@0
|
331 |
test binary-10.12 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
332 |
set a {0x50 0x51}
|
sl@0
|
333 |
binary format S1 $a
|
sl@0
|
334 |
} \x00P
|
sl@0
|
335 |
|
sl@0
|
336 |
test binary-11.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
337 |
list [catch {binary format i} msg] $msg
|
sl@0
|
338 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
339 |
test binary-11.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
340 |
list [catch {binary format i blat} msg] $msg
|
sl@0
|
341 |
} {1 {expected integer but got "blat"}}
|
sl@0
|
342 |
test binary-11.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
343 |
binary format i0 0x50
|
sl@0
|
344 |
} {}
|
sl@0
|
345 |
test binary-11.4 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
346 |
binary format i 0x50
|
sl@0
|
347 |
} P\x00\x00\x00
|
sl@0
|
348 |
test binary-11.5 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
349 |
binary format i 0x5052
|
sl@0
|
350 |
} RP\x00\x00
|
sl@0
|
351 |
test binary-11.6 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
352 |
binary format i 0x505251 0x53
|
sl@0
|
353 |
} QRP\x00
|
sl@0
|
354 |
test binary-11.7 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
355 |
binary format i1 {0x505251 0x53}
|
sl@0
|
356 |
} QRP\x00
|
sl@0
|
357 |
test binary-11.8 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
358 |
binary format i 0x53525150
|
sl@0
|
359 |
} PQRS
|
sl@0
|
360 |
test binary-11.9 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
361 |
binary format i2 {0x50 0x52}
|
sl@0
|
362 |
} P\x00\x00\x00R\x00\x00\x00
|
sl@0
|
363 |
test binary-11.10 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
364 |
binary format i* {0x50515253 0x52}
|
sl@0
|
365 |
} SRQPR\x00\x00\x00
|
sl@0
|
366 |
test binary-11.11 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
367 |
list [catch {binary format i2 {0x50}} msg] $msg
|
sl@0
|
368 |
} {1 {number of elements in list does not match count}}
|
sl@0
|
369 |
test binary-11.12 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
370 |
set a {0x50 0x51}
|
sl@0
|
371 |
list [catch {binary format i $a} msg] $msg
|
sl@0
|
372 |
} [list 1 "expected integer but got \"0x50 0x51\""]
|
sl@0
|
373 |
test binary-11.13 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
374 |
set a {0x50 0x51}
|
sl@0
|
375 |
binary format i1 $a
|
sl@0
|
376 |
} P\x00\x00\x00
|
sl@0
|
377 |
|
sl@0
|
378 |
test binary-12.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
379 |
list [catch {binary format I} msg] $msg
|
sl@0
|
380 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
381 |
test binary-12.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
382 |
list [catch {binary format I blat} msg] $msg
|
sl@0
|
383 |
} {1 {expected integer but got "blat"}}
|
sl@0
|
384 |
test binary-12.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
385 |
binary format I0 0x50
|
sl@0
|
386 |
} {}
|
sl@0
|
387 |
test binary-12.4 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
388 |
binary format I 0x50
|
sl@0
|
389 |
} \x00\x00\x00P
|
sl@0
|
390 |
test binary-12.5 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
391 |
binary format I 0x5052
|
sl@0
|
392 |
} \x00\x00PR
|
sl@0
|
393 |
test binary-12.6 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
394 |
binary format I 0x505251 0x53
|
sl@0
|
395 |
} \x00PRQ
|
sl@0
|
396 |
test binary-12.7 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
397 |
binary format I1 {0x505251 0x53}
|
sl@0
|
398 |
} \x00PRQ
|
sl@0
|
399 |
test binary-12.8 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
400 |
binary format I 0x53525150
|
sl@0
|
401 |
} SRQP
|
sl@0
|
402 |
test binary-12.9 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
403 |
binary format I2 {0x50 0x52}
|
sl@0
|
404 |
} \x00\x00\x00P\x00\x00\x00R
|
sl@0
|
405 |
test binary-12.10 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
406 |
binary format I* {0x50515253 0x52}
|
sl@0
|
407 |
} PQRS\x00\x00\x00R
|
sl@0
|
408 |
test binary-12.11 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
409 |
list [catch {binary format i2 {0x50}} msg] $msg
|
sl@0
|
410 |
} {1 {number of elements in list does not match count}}
|
sl@0
|
411 |
test binary-12.12 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
412 |
set a {0x50 0x51}
|
sl@0
|
413 |
list [catch {binary format I $a} msg] $msg
|
sl@0
|
414 |
} [list 1 "expected integer but got \"0x50 0x51\""]
|
sl@0
|
415 |
test binary-12.13 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
416 |
set a {0x50 0x51}
|
sl@0
|
417 |
binary format I1 $a
|
sl@0
|
418 |
} \x00\x00\x00P
|
sl@0
|
419 |
|
sl@0
|
420 |
test binary-13.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
421 |
list [catch {binary format f} msg] $msg
|
sl@0
|
422 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
423 |
test binary-13.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
424 |
list [catch {binary format f blat} msg] $msg
|
sl@0
|
425 |
} {1 {expected floating-point number but got "blat"}}
|
sl@0
|
426 |
test binary-13.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
427 |
binary format f0 1.6
|
sl@0
|
428 |
} {}
|
sl@0
|
429 |
test binary-13.4 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
|
sl@0
|
430 |
binary format f 1.6
|
sl@0
|
431 |
} \x3f\xcc\xcc\xcd
|
sl@0
|
432 |
test binary-13.5 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
|
sl@0
|
433 |
binary format f 1.6
|
sl@0
|
434 |
} \xcd\xcc\xcc\x3f
|
sl@0
|
435 |
test binary-13.6 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
|
sl@0
|
436 |
binary format f* {1.6 3.4}
|
sl@0
|
437 |
} \x3f\xcc\xcc\xcd\x40\x59\x99\x9a
|
sl@0
|
438 |
test binary-13.7 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
|
sl@0
|
439 |
binary format f* {1.6 3.4}
|
sl@0
|
440 |
} \xcd\xcc\xcc\x3f\x9a\x99\x59\x40
|
sl@0
|
441 |
test binary-13.8 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
|
sl@0
|
442 |
binary format f2 {1.6 3.4}
|
sl@0
|
443 |
} \x3f\xcc\xcc\xcd\x40\x59\x99\x9a
|
sl@0
|
444 |
test binary-13.9 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
|
sl@0
|
445 |
binary format f2 {1.6 3.4}
|
sl@0
|
446 |
} \xcd\xcc\xcc\x3f\x9a\x99\x59\x40
|
sl@0
|
447 |
test binary-13.10 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
|
sl@0
|
448 |
binary format f2 {1.6 3.4 5.6}
|
sl@0
|
449 |
} \x3f\xcc\xcc\xcd\x40\x59\x99\x9a
|
sl@0
|
450 |
test binary-13.11 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
|
sl@0
|
451 |
binary format f2 {1.6 3.4 5.6}
|
sl@0
|
452 |
} \xcd\xcc\xcc\x3f\x9a\x99\x59\x40
|
sl@0
|
453 |
test binary-13.12 {Tcl_BinaryObjCmd: float overflow} {nonPortable macOrUnix} {
|
sl@0
|
454 |
binary format f -3.402825e+38
|
sl@0
|
455 |
} \xff\x7f\xff\xff
|
sl@0
|
456 |
test binary-13.13 {Tcl_BinaryObjCmd: float overflow} {nonPortable pcOnly} {
|
sl@0
|
457 |
binary format f -3.402825e+38
|
sl@0
|
458 |
} \xff\xff\x7f\xff
|
sl@0
|
459 |
test binary-13.14 {Tcl_BinaryObjCmd: float underflow} {nonPortable macOrUnix} {
|
sl@0
|
460 |
binary format f -3.402825e-100
|
sl@0
|
461 |
} \x80\x00\x00\x00
|
sl@0
|
462 |
test binary-13.15 {Tcl_BinaryObjCmd: float underflow} {nonPortable pcOnly} {
|
sl@0
|
463 |
binary format f -3.402825e-100
|
sl@0
|
464 |
} \x00\x00\x00\x80
|
sl@0
|
465 |
test binary-13.16 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
466 |
list [catch {binary format f2 {1.6}} msg] $msg
|
sl@0
|
467 |
} {1 {number of elements in list does not match count}}
|
sl@0
|
468 |
test binary-13.17 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
469 |
set a {1.6 3.4}
|
sl@0
|
470 |
list [catch {binary format f $a} msg] $msg
|
sl@0
|
471 |
} [list 1 "expected floating-point number but got \"1.6 3.4\""]
|
sl@0
|
472 |
test binary-13.18 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
|
sl@0
|
473 |
set a {1.6 3.4}
|
sl@0
|
474 |
binary format f1 $a
|
sl@0
|
475 |
} \x3f\xcc\xcc\xcd
|
sl@0
|
476 |
test binary-13.19 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
|
sl@0
|
477 |
set a {1.6 3.4}
|
sl@0
|
478 |
binary format f1 $a
|
sl@0
|
479 |
} \xcd\xcc\xcc\x3f
|
sl@0
|
480 |
|
sl@0
|
481 |
test binary-14.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
482 |
list [catch {binary format d} msg] $msg
|
sl@0
|
483 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
484 |
test binary-14.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
485 |
list [catch {binary format d blat} msg] $msg
|
sl@0
|
486 |
} {1 {expected floating-point number but got "blat"}}
|
sl@0
|
487 |
test binary-14.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
488 |
binary format d0 1.6
|
sl@0
|
489 |
} {}
|
sl@0
|
490 |
test binary-14.4 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
|
sl@0
|
491 |
binary format d 1.6
|
sl@0
|
492 |
} \x3f\xf9\x99\x99\x99\x99\x99\x9a
|
sl@0
|
493 |
test binary-14.5 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
|
sl@0
|
494 |
binary format d 1.6
|
sl@0
|
495 |
} \x9a\x99\x99\x99\x99\x99\xf9\x3f
|
sl@0
|
496 |
test binary-14.6 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
|
sl@0
|
497 |
binary format d* {1.6 3.4}
|
sl@0
|
498 |
} \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33
|
sl@0
|
499 |
test binary-14.7 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
|
sl@0
|
500 |
binary format d* {1.6 3.4}
|
sl@0
|
501 |
} \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40
|
sl@0
|
502 |
test binary-14.8 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
|
sl@0
|
503 |
binary format d2 {1.6 3.4}
|
sl@0
|
504 |
} \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33
|
sl@0
|
505 |
test binary-14.9 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
|
sl@0
|
506 |
binary format d2 {1.6 3.4}
|
sl@0
|
507 |
} \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40
|
sl@0
|
508 |
test binary-14.10 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
|
sl@0
|
509 |
binary format d2 {1.6 3.4 5.6}
|
sl@0
|
510 |
} \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33
|
sl@0
|
511 |
test binary-14.11 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
|
sl@0
|
512 |
binary format d2 {1.6 3.4 5.6}
|
sl@0
|
513 |
} \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40
|
sl@0
|
514 |
test binary-14.12 {Tcl_BinaryObjCmd: float overflow} {nonPortable unixOnly} {
|
sl@0
|
515 |
binary format d NaN
|
sl@0
|
516 |
} \x7f\xff\xff\xff\xff\xff\xff\xff
|
sl@0
|
517 |
test binary-14.13 {Tcl_BinaryObjCmd: float overflow} {nonPortable macOnly} {
|
sl@0
|
518 |
binary format d NaN
|
sl@0
|
519 |
} \x7f\xf8\x02\xa0\x00\x00\x00\x00
|
sl@0
|
520 |
test binary-14.14 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
521 |
list [catch {binary format d2 {1.6}} msg] $msg
|
sl@0
|
522 |
} {1 {number of elements in list does not match count}}
|
sl@0
|
523 |
test binary-14.15 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
524 |
set a {1.6 3.4}
|
sl@0
|
525 |
list [catch {binary format d $a} msg] $msg
|
sl@0
|
526 |
} [list 1 "expected floating-point number but got \"1.6 3.4\""]
|
sl@0
|
527 |
test binary-14.16 {Tcl_BinaryObjCmd: format} {nonPortable macOrUnix} {
|
sl@0
|
528 |
set a {1.6 3.4}
|
sl@0
|
529 |
binary format d1 $a
|
sl@0
|
530 |
} \x3f\xf9\x99\x99\x99\x99\x99\x9a
|
sl@0
|
531 |
test binary-14.17 {Tcl_BinaryObjCmd: format} {nonPortable pcOnly} {
|
sl@0
|
532 |
set a {1.6 3.4}
|
sl@0
|
533 |
binary format d1 $a
|
sl@0
|
534 |
} \x9a\x99\x99\x99\x99\x99\xf9\x3f
|
sl@0
|
535 |
test binary-14.18 {FormatNumber: Bug 1116542} {
|
sl@0
|
536 |
binary scan [binary format d 1.25] d w
|
sl@0
|
537 |
set w
|
sl@0
|
538 |
} 1.25
|
sl@0
|
539 |
|
sl@0
|
540 |
test binary-15.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
541 |
list [catch {binary format ax*a "y" "z"} msg] $msg
|
sl@0
|
542 |
} {1 {cannot use "*" in format string with "x"}}
|
sl@0
|
543 |
test binary-15.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
544 |
binary format axa "y" "z"
|
sl@0
|
545 |
} y\x00z
|
sl@0
|
546 |
test binary-15.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
547 |
binary format ax3a "y" "z"
|
sl@0
|
548 |
} y\x00\x00\x00z
|
sl@0
|
549 |
test binary-15.4 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
550 |
binary format a*X3x3a* "foo" "z"
|
sl@0
|
551 |
} \x00\x00\x00z
|
sl@0
|
552 |
|
sl@0
|
553 |
test binary-16.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
554 |
binary format a*X*a "foo" "z"
|
sl@0
|
555 |
} zoo
|
sl@0
|
556 |
test binary-16.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
557 |
binary format aX3a "y" "z"
|
sl@0
|
558 |
} z
|
sl@0
|
559 |
test binary-16.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
560 |
binary format a*Xa* "foo" "zy"
|
sl@0
|
561 |
} fozy
|
sl@0
|
562 |
test binary-16.4 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
563 |
binary format a*X3a "foobar" "z"
|
sl@0
|
564 |
} foozar
|
sl@0
|
565 |
test binary-16.5 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
566 |
binary format a*X3aX2a "foobar" "z" "b"
|
sl@0
|
567 |
} fobzar
|
sl@0
|
568 |
|
sl@0
|
569 |
test binary-17.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
570 |
binary format @1
|
sl@0
|
571 |
} \x00
|
sl@0
|
572 |
test binary-17.2 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
573 |
binary format @5a2 "ab"
|
sl@0
|
574 |
} \x00\x00\x00\x00\x00\x61\x62
|
sl@0
|
575 |
test binary-17.3 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
576 |
binary format {a* @0 a2 @* a*} "foobar" "ab" "blat"
|
sl@0
|
577 |
} abobarblat
|
sl@0
|
578 |
|
sl@0
|
579 |
test binary-18.1 {Tcl_BinaryObjCmd: format} {
|
sl@0
|
580 |
list [catch {binary format u0a3 abc abd} msg] $msg
|
sl@0
|
581 |
} {1 {bad field specifier "u"}}
|
sl@0
|
582 |
|
sl@0
|
583 |
|
sl@0
|
584 |
test binary-19.1 {Tcl_BinaryObjCmd: errors} {
|
sl@0
|
585 |
list [catch {binary s} msg] $msg
|
sl@0
|
586 |
} {1 {wrong # args: should be "binary scan value formatString ?varName varName ...?"}}
|
sl@0
|
587 |
test binary-19.2 {Tcl_BinaryObjCmd: errors} {
|
sl@0
|
588 |
list [catch {binary scan foo} msg] $msg
|
sl@0
|
589 |
} {1 {wrong # args: should be "binary scan value formatString ?varName varName ...?"}}
|
sl@0
|
590 |
test binary-19.3 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
591 |
binary scan {} {}
|
sl@0
|
592 |
} 0
|
sl@0
|
593 |
|
sl@0
|
594 |
test binary-20.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
595 |
list [catch {binary scan abc a} msg] $msg
|
sl@0
|
596 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
597 |
test binary-20.2 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
598 |
catch {unset arg1}
|
sl@0
|
599 |
set arg1 1
|
sl@0
|
600 |
list [catch {binary scan abc a arg1(a)} msg] $msg
|
sl@0
|
601 |
} {1 {can't set "arg1(a)": variable isn't array}}
|
sl@0
|
602 |
test binary-20.3 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
603 |
catch {unset arg1}
|
sl@0
|
604 |
set arg1 abc
|
sl@0
|
605 |
list [binary scan abc a0 arg1] $arg1
|
sl@0
|
606 |
} {1 {}}
|
sl@0
|
607 |
test binary-20.4 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
608 |
catch {unset arg1}
|
sl@0
|
609 |
list [binary scan abc a* arg1] $arg1
|
sl@0
|
610 |
} {1 abc}
|
sl@0
|
611 |
test binary-20.5 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
612 |
catch {unset arg1}
|
sl@0
|
613 |
list [binary scan abc a5 arg1] [info exists arg1]
|
sl@0
|
614 |
} {0 0}
|
sl@0
|
615 |
test binary-20.6 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
616 |
set arg1 foo
|
sl@0
|
617 |
list [binary scan abc a2 arg1] $arg1
|
sl@0
|
618 |
} {1 ab}
|
sl@0
|
619 |
test binary-20.7 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
620 |
catch {unset arg1}
|
sl@0
|
621 |
catch {unset arg2}
|
sl@0
|
622 |
list [binary scan abcdef a2a2 arg1 arg2] $arg1 $arg2
|
sl@0
|
623 |
} {2 ab cd}
|
sl@0
|
624 |
test binary-20.8 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
625 |
catch {unset arg1}
|
sl@0
|
626 |
list [binary scan abc a2 arg1(a)] $arg1(a)
|
sl@0
|
627 |
} {1 ab}
|
sl@0
|
628 |
test binary-20.9 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
629 |
catch {unset arg1}
|
sl@0
|
630 |
list [binary scan abc a arg1(a)] $arg1(a)
|
sl@0
|
631 |
} {1 a}
|
sl@0
|
632 |
|
sl@0
|
633 |
test binary-21.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
634 |
list [catch {binary scan abc A} msg] $msg
|
sl@0
|
635 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
636 |
test binary-21.2 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
637 |
catch {unset arg1}
|
sl@0
|
638 |
set arg1 1
|
sl@0
|
639 |
list [catch {binary scan abc A arg1(a)} msg] $msg
|
sl@0
|
640 |
} {1 {can't set "arg1(a)": variable isn't array}}
|
sl@0
|
641 |
test binary-21.3 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
642 |
catch {unset arg1}
|
sl@0
|
643 |
set arg1 abc
|
sl@0
|
644 |
list [binary scan abc A0 arg1] $arg1
|
sl@0
|
645 |
} {1 {}}
|
sl@0
|
646 |
test binary-21.4 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
647 |
catch {unset arg1}
|
sl@0
|
648 |
list [binary scan abc A* arg1] $arg1
|
sl@0
|
649 |
} {1 abc}
|
sl@0
|
650 |
test binary-21.5 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
651 |
catch {unset arg1}
|
sl@0
|
652 |
list [binary scan abc A5 arg1] [info exists arg1]
|
sl@0
|
653 |
} {0 0}
|
sl@0
|
654 |
test binary-21.6 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
655 |
set arg1 foo
|
sl@0
|
656 |
list [binary scan abc A2 arg1] $arg1
|
sl@0
|
657 |
} {1 ab}
|
sl@0
|
658 |
test binary-21.7 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
659 |
catch {unset arg1}
|
sl@0
|
660 |
catch {unset arg2}
|
sl@0
|
661 |
list [binary scan abcdef A2A2 arg1 arg2] $arg1 $arg2
|
sl@0
|
662 |
} {2 ab cd}
|
sl@0
|
663 |
test binary-21.8 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
664 |
catch {unset arg1}
|
sl@0
|
665 |
list [binary scan abc A2 arg1(a)] $arg1(a)
|
sl@0
|
666 |
} {1 ab}
|
sl@0
|
667 |
test binary-21.9 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
668 |
catch {unset arg1}
|
sl@0
|
669 |
list [binary scan abc A2 arg1(a)] $arg1(a)
|
sl@0
|
670 |
} {1 ab}
|
sl@0
|
671 |
test binary-21.10 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
672 |
catch {unset arg1}
|
sl@0
|
673 |
list [binary scan abc A arg1(a)] $arg1(a)
|
sl@0
|
674 |
} {1 a}
|
sl@0
|
675 |
test binary-21.11 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
676 |
catch {unset arg1}
|
sl@0
|
677 |
list [binary scan "abc def \x00 " A* arg1] $arg1
|
sl@0
|
678 |
} {1 {abc def}}
|
sl@0
|
679 |
test binary-21.12 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
680 |
catch {unset arg1}
|
sl@0
|
681 |
list [binary scan "abc def \x00ghi " A* arg1] $arg1
|
sl@0
|
682 |
} [list 1 "abc def \x00ghi"]
|
sl@0
|
683 |
|
sl@0
|
684 |
test binary-22.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
685 |
list [catch {binary scan abc b} msg] $msg
|
sl@0
|
686 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
687 |
test binary-22.2 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
688 |
catch {unset arg1}
|
sl@0
|
689 |
list [binary scan \x52\x53 b* arg1] $arg1
|
sl@0
|
690 |
} {1 0100101011001010}
|
sl@0
|
691 |
test binary-22.3 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
692 |
catch {unset arg1}
|
sl@0
|
693 |
list [binary scan \x82\x53 b arg1] $arg1
|
sl@0
|
694 |
} {1 0}
|
sl@0
|
695 |
test binary-22.4 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
696 |
catch {unset arg1}
|
sl@0
|
697 |
list [binary scan \x82\x53 b1 arg1] $arg1
|
sl@0
|
698 |
} {1 0}
|
sl@0
|
699 |
test binary-22.5 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
700 |
catch {unset arg1}
|
sl@0
|
701 |
list [binary scan \x82\x53 b0 arg1] $arg1
|
sl@0
|
702 |
} {1 {}}
|
sl@0
|
703 |
test binary-22.6 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
704 |
catch {unset arg1}
|
sl@0
|
705 |
list [binary scan \x52\x53 b5 arg1] $arg1
|
sl@0
|
706 |
} {1 01001}
|
sl@0
|
707 |
test binary-22.7 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
708 |
catch {unset arg1}
|
sl@0
|
709 |
list [binary scan \x52\x53 b8 arg1] $arg1
|
sl@0
|
710 |
} {1 01001010}
|
sl@0
|
711 |
test binary-22.8 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
712 |
catch {unset arg1}
|
sl@0
|
713 |
list [binary scan \x52\x53 b14 arg1] $arg1
|
sl@0
|
714 |
} {1 01001010110010}
|
sl@0
|
715 |
test binary-22.9 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
716 |
catch {unset arg1}
|
sl@0
|
717 |
set arg1 foo
|
sl@0
|
718 |
list [binary scan \x52 b14 arg1] $arg1
|
sl@0
|
719 |
} {0 foo}
|
sl@0
|
720 |
test binary-22.10 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
721 |
catch {unset arg1}
|
sl@0
|
722 |
set arg1 1
|
sl@0
|
723 |
list [catch {binary scan \x52\x53 b1 arg1(a)} msg] $msg
|
sl@0
|
724 |
} {1 {can't set "arg1(a)": variable isn't array}}
|
sl@0
|
725 |
test binary-22.11 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
726 |
catch {unset arg1 arg2}
|
sl@0
|
727 |
set arg1 foo
|
sl@0
|
728 |
set arg2 bar
|
sl@0
|
729 |
list [binary scan \x07\x87\x05 b5b* arg1 arg2] $arg1 $arg2
|
sl@0
|
730 |
} {2 11100 1110000110100000}
|
sl@0
|
731 |
|
sl@0
|
732 |
|
sl@0
|
733 |
test binary-23.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
734 |
list [catch {binary scan abc B} msg] $msg
|
sl@0
|
735 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
736 |
test binary-23.2 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
737 |
catch {unset arg1}
|
sl@0
|
738 |
list [binary scan \x52\x53 B* arg1] $arg1
|
sl@0
|
739 |
} {1 0101001001010011}
|
sl@0
|
740 |
test binary-23.3 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
741 |
catch {unset arg1}
|
sl@0
|
742 |
list [binary scan \x82\x53 B arg1] $arg1
|
sl@0
|
743 |
} {1 1}
|
sl@0
|
744 |
test binary-23.4 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
745 |
catch {unset arg1}
|
sl@0
|
746 |
list [binary scan \x82\x53 B1 arg1] $arg1
|
sl@0
|
747 |
} {1 1}
|
sl@0
|
748 |
test binary-23.5 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
749 |
catch {unset arg1}
|
sl@0
|
750 |
list [binary scan \x52\x53 B0 arg1] $arg1
|
sl@0
|
751 |
} {1 {}}
|
sl@0
|
752 |
test binary-23.6 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
753 |
catch {unset arg1}
|
sl@0
|
754 |
list [binary scan \x52\x53 B5 arg1] $arg1
|
sl@0
|
755 |
} {1 01010}
|
sl@0
|
756 |
test binary-23.7 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
757 |
catch {unset arg1}
|
sl@0
|
758 |
list [binary scan \x52\x53 B8 arg1] $arg1
|
sl@0
|
759 |
} {1 01010010}
|
sl@0
|
760 |
test binary-23.8 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
761 |
catch {unset arg1}
|
sl@0
|
762 |
list [binary scan \x52\x53 B14 arg1] $arg1
|
sl@0
|
763 |
} {1 01010010010100}
|
sl@0
|
764 |
test binary-23.9 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
765 |
catch {unset arg1}
|
sl@0
|
766 |
set arg1 foo
|
sl@0
|
767 |
list [binary scan \x52 B14 arg1] $arg1
|
sl@0
|
768 |
} {0 foo}
|
sl@0
|
769 |
test binary-23.10 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
770 |
catch {unset arg1}
|
sl@0
|
771 |
set arg1 1
|
sl@0
|
772 |
list [catch {binary scan \x52\x53 B1 arg1(a)} msg] $msg
|
sl@0
|
773 |
} {1 {can't set "arg1(a)": variable isn't array}}
|
sl@0
|
774 |
test binary-23.11 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
775 |
catch {unset arg1 arg2}
|
sl@0
|
776 |
set arg1 foo
|
sl@0
|
777 |
set arg2 bar
|
sl@0
|
778 |
list [binary scan \x70\x87\x05 B5B* arg1 arg2] $arg1 $arg2
|
sl@0
|
779 |
} {2 01110 1000011100000101}
|
sl@0
|
780 |
|
sl@0
|
781 |
test binary-24.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
782 |
list [catch {binary scan abc h} msg] $msg
|
sl@0
|
783 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
784 |
test binary-24.2 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
785 |
catch {unset arg1}
|
sl@0
|
786 |
list [binary scan \x52\xa3 h* arg1] $arg1
|
sl@0
|
787 |
} {1 253a}
|
sl@0
|
788 |
test binary-24.3 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
789 |
catch {unset arg1}
|
sl@0
|
790 |
list [binary scan \xc2\xa3 h arg1] $arg1
|
sl@0
|
791 |
} {1 2}
|
sl@0
|
792 |
test binary-24.4 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
793 |
catch {unset arg1}
|
sl@0
|
794 |
list [binary scan \x82\x53 h1 arg1] $arg1
|
sl@0
|
795 |
} {1 2}
|
sl@0
|
796 |
test binary-24.5 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
797 |
catch {unset arg1}
|
sl@0
|
798 |
list [binary scan \x52\x53 h0 arg1] $arg1
|
sl@0
|
799 |
} {1 {}}
|
sl@0
|
800 |
test binary-24.6 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
801 |
catch {unset arg1}
|
sl@0
|
802 |
list [binary scan \xf2\x53 h2 arg1] $arg1
|
sl@0
|
803 |
} {1 2f}
|
sl@0
|
804 |
test binary-24.7 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
805 |
catch {unset arg1}
|
sl@0
|
806 |
list [binary scan \x52\x53 h3 arg1] $arg1
|
sl@0
|
807 |
} {1 253}
|
sl@0
|
808 |
test binary-24.8 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
809 |
catch {unset arg1}
|
sl@0
|
810 |
set arg1 foo
|
sl@0
|
811 |
list [binary scan \x52 h3 arg1] $arg1
|
sl@0
|
812 |
} {0 foo}
|
sl@0
|
813 |
test binary-24.9 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
814 |
catch {unset arg1}
|
sl@0
|
815 |
set arg1 1
|
sl@0
|
816 |
list [catch {binary scan \x52\x53 h1 arg1(a)} msg] $msg
|
sl@0
|
817 |
} {1 {can't set "arg1(a)": variable isn't array}}
|
sl@0
|
818 |
test binary-24.10 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
819 |
catch {unset arg1 arg2}
|
sl@0
|
820 |
set arg1 foo
|
sl@0
|
821 |
set arg2 bar
|
sl@0
|
822 |
list [binary scan \x70\x87\x05 h2h* arg1 arg2] $arg1 $arg2
|
sl@0
|
823 |
} {2 07 7850}
|
sl@0
|
824 |
|
sl@0
|
825 |
test binary-25.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
826 |
list [catch {binary scan abc H} msg] $msg
|
sl@0
|
827 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
828 |
test binary-25.2 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
829 |
catch {unset arg1}
|
sl@0
|
830 |
list [binary scan \x52\xa3 H* arg1] $arg1
|
sl@0
|
831 |
} {1 52a3}
|
sl@0
|
832 |
test binary-25.3 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
833 |
catch {unset arg1}
|
sl@0
|
834 |
list [binary scan \xc2\xa3 H arg1] $arg1
|
sl@0
|
835 |
} {1 c}
|
sl@0
|
836 |
test binary-25.4 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
837 |
catch {unset arg1}
|
sl@0
|
838 |
list [binary scan \x82\x53 H1 arg1] $arg1
|
sl@0
|
839 |
} {1 8}
|
sl@0
|
840 |
test binary-25.5 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
841 |
catch {unset arg1}
|
sl@0
|
842 |
list [binary scan \x52\x53 H0 arg1] $arg1
|
sl@0
|
843 |
} {1 {}}
|
sl@0
|
844 |
test binary-25.6 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
845 |
catch {unset arg1}
|
sl@0
|
846 |
list [binary scan \xf2\x53 H2 arg1] $arg1
|
sl@0
|
847 |
} {1 f2}
|
sl@0
|
848 |
test binary-25.7 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
849 |
catch {unset arg1}
|
sl@0
|
850 |
list [binary scan \x52\x53 H3 arg1] $arg1
|
sl@0
|
851 |
} {1 525}
|
sl@0
|
852 |
test binary-25.8 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
853 |
catch {unset arg1}
|
sl@0
|
854 |
set arg1 foo
|
sl@0
|
855 |
list [binary scan \x52 H3 arg1] $arg1
|
sl@0
|
856 |
} {0 foo}
|
sl@0
|
857 |
test binary-25.9 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
858 |
catch {unset arg1}
|
sl@0
|
859 |
set arg1 1
|
sl@0
|
860 |
list [catch {binary scan \x52\x53 H1 arg1(a)} msg] $msg
|
sl@0
|
861 |
} {1 {can't set "arg1(a)": variable isn't array}}
|
sl@0
|
862 |
test binary-25.10 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
863 |
catch {unset arg1 arg2}
|
sl@0
|
864 |
set arg1 foo
|
sl@0
|
865 |
set arg2 bar
|
sl@0
|
866 |
list [binary scan \x70\x87\x05 H2H* arg1 arg2] $arg1 $arg2
|
sl@0
|
867 |
} {2 70 8705}
|
sl@0
|
868 |
|
sl@0
|
869 |
test binary-26.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
870 |
list [catch {binary scan abc c} msg] $msg
|
sl@0
|
871 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
872 |
test binary-26.2 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
873 |
catch {unset arg1}
|
sl@0
|
874 |
list [binary scan \x52\xa3 c* arg1] $arg1
|
sl@0
|
875 |
} {1 {82 -93}}
|
sl@0
|
876 |
test binary-26.3 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
877 |
catch {unset arg1}
|
sl@0
|
878 |
list [binary scan \x52\xa3 c arg1] $arg1
|
sl@0
|
879 |
} {1 82}
|
sl@0
|
880 |
test binary-26.4 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
881 |
catch {unset arg1}
|
sl@0
|
882 |
list [binary scan \x52\xa3 c1 arg1] $arg1
|
sl@0
|
883 |
} {1 82}
|
sl@0
|
884 |
test binary-26.5 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
885 |
catch {unset arg1}
|
sl@0
|
886 |
list [binary scan \x52\xa3 c0 arg1] $arg1
|
sl@0
|
887 |
} {1 {}}
|
sl@0
|
888 |
test binary-26.6 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
889 |
catch {unset arg1}
|
sl@0
|
890 |
list [binary scan \x52\xa3 c2 arg1] $arg1
|
sl@0
|
891 |
} {1 {82 -93}}
|
sl@0
|
892 |
test binary-26.7 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
893 |
catch {unset arg1}
|
sl@0
|
894 |
list [binary scan \xff c arg1] $arg1
|
sl@0
|
895 |
} {1 -1}
|
sl@0
|
896 |
test binary-26.8 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
897 |
catch {unset arg1}
|
sl@0
|
898 |
set arg1 foo
|
sl@0
|
899 |
list [binary scan \x52 c3 arg1] $arg1
|
sl@0
|
900 |
} {0 foo}
|
sl@0
|
901 |
test binary-26.9 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
902 |
catch {unset arg1}
|
sl@0
|
903 |
set arg1 1
|
sl@0
|
904 |
list [catch {binary scan \x52\x53 c1 arg1(a)} msg] $msg
|
sl@0
|
905 |
} {1 {can't set "arg1(a)": variable isn't array}}
|
sl@0
|
906 |
test binary-26.10 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
907 |
catch {unset arg1 arg2}
|
sl@0
|
908 |
set arg1 foo
|
sl@0
|
909 |
set arg2 bar
|
sl@0
|
910 |
list [binary scan \x70\x87\x05 c2c* arg1 arg2] $arg1 $arg2
|
sl@0
|
911 |
} {2 {112 -121} 5}
|
sl@0
|
912 |
|
sl@0
|
913 |
test binary-27.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
914 |
list [catch {binary scan abc s} msg] $msg
|
sl@0
|
915 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
916 |
test binary-27.2 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
917 |
catch {unset arg1}
|
sl@0
|
918 |
list [binary scan \x52\xa3\x53\x54 s* arg1] $arg1
|
sl@0
|
919 |
} {1 {-23726 21587}}
|
sl@0
|
920 |
test binary-27.3 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
921 |
catch {unset arg1}
|
sl@0
|
922 |
list [binary scan \x52\xa3\x53\x54 s arg1] $arg1
|
sl@0
|
923 |
} {1 -23726}
|
sl@0
|
924 |
test binary-27.4 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
925 |
catch {unset arg1}
|
sl@0
|
926 |
list [binary scan \x52\xa3 s1 arg1] $arg1
|
sl@0
|
927 |
} {1 -23726}
|
sl@0
|
928 |
test binary-27.5 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
929 |
catch {unset arg1}
|
sl@0
|
930 |
list [binary scan \x52\xa3 s0 arg1] $arg1
|
sl@0
|
931 |
} {1 {}}
|
sl@0
|
932 |
test binary-27.6 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
933 |
catch {unset arg1}
|
sl@0
|
934 |
list [binary scan \x52\xa3\x53\x54 s2 arg1] $arg1
|
sl@0
|
935 |
} {1 {-23726 21587}}
|
sl@0
|
936 |
test binary-27.7 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
937 |
catch {unset arg1}
|
sl@0
|
938 |
set arg1 foo
|
sl@0
|
939 |
list [binary scan \x52 s1 arg1] $arg1
|
sl@0
|
940 |
} {0 foo}
|
sl@0
|
941 |
test binary-27.8 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
942 |
catch {unset arg1}
|
sl@0
|
943 |
set arg1 1
|
sl@0
|
944 |
list [catch {binary scan \x52\x53 s1 arg1(a)} msg] $msg
|
sl@0
|
945 |
} {1 {can't set "arg1(a)": variable isn't array}}
|
sl@0
|
946 |
test binary-27.9 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
947 |
catch {unset arg1 arg2}
|
sl@0
|
948 |
set arg1 foo
|
sl@0
|
949 |
set arg2 bar
|
sl@0
|
950 |
list [binary scan \x52\xa3\x53\x54\x05 s2c* arg1 arg2] $arg1 $arg2
|
sl@0
|
951 |
} {2 {-23726 21587} 5}
|
sl@0
|
952 |
|
sl@0
|
953 |
test binary-28.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
954 |
list [catch {binary scan abc S} msg] $msg
|
sl@0
|
955 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
956 |
test binary-28.2 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
957 |
catch {unset arg1}
|
sl@0
|
958 |
list [binary scan \x52\xa3\x53\x54 S* arg1] $arg1
|
sl@0
|
959 |
} {1 {21155 21332}}
|
sl@0
|
960 |
test binary-28.3 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
961 |
catch {unset arg1}
|
sl@0
|
962 |
list [binary scan \x52\xa3\x53\x54 S arg1] $arg1
|
sl@0
|
963 |
} {1 21155}
|
sl@0
|
964 |
test binary-28.4 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
965 |
catch {unset arg1}
|
sl@0
|
966 |
list [binary scan \x52\xa3 S1 arg1] $arg1
|
sl@0
|
967 |
} {1 21155}
|
sl@0
|
968 |
test binary-28.5 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
969 |
catch {unset arg1}
|
sl@0
|
970 |
list [binary scan \x52\xa3 S0 arg1] $arg1
|
sl@0
|
971 |
} {1 {}}
|
sl@0
|
972 |
test binary-28.6 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
973 |
catch {unset arg1}
|
sl@0
|
974 |
list [binary scan \x52\xa3\x53\x54 S2 arg1] $arg1
|
sl@0
|
975 |
} {1 {21155 21332}}
|
sl@0
|
976 |
test binary-28.7 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
977 |
catch {unset arg1}
|
sl@0
|
978 |
set arg1 foo
|
sl@0
|
979 |
list [binary scan \x52 S1 arg1] $arg1
|
sl@0
|
980 |
} {0 foo}
|
sl@0
|
981 |
test binary-28.8 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
982 |
catch {unset arg1}
|
sl@0
|
983 |
set arg1 1
|
sl@0
|
984 |
list [catch {binary scan \x52\x53 S1 arg1(a)} msg] $msg
|
sl@0
|
985 |
} {1 {can't set "arg1(a)": variable isn't array}}
|
sl@0
|
986 |
test binary-28.9 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
987 |
catch {unset arg1 arg2}
|
sl@0
|
988 |
set arg1 foo
|
sl@0
|
989 |
set arg2 bar
|
sl@0
|
990 |
list [binary scan \x52\xa3\x53\x54\x05 S2c* arg1 arg2] $arg1 $arg2
|
sl@0
|
991 |
} {2 {21155 21332} 5}
|
sl@0
|
992 |
|
sl@0
|
993 |
test binary-29.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
994 |
list [catch {binary scan abc i} msg] $msg
|
sl@0
|
995 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
996 |
test binary-29.2 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
997 |
catch {unset arg1}
|
sl@0
|
998 |
list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 i* arg1] $arg1
|
sl@0
|
999 |
} {1 {1414767442 67305985}}
|
sl@0
|
1000 |
test binary-29.3 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1001 |
catch {unset arg1}
|
sl@0
|
1002 |
list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 i arg1] $arg1
|
sl@0
|
1003 |
} {1 1414767442}
|
sl@0
|
1004 |
test binary-29.4 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1005 |
catch {unset arg1}
|
sl@0
|
1006 |
list [binary scan \x52\xa3\x53\x54 i1 arg1] $arg1
|
sl@0
|
1007 |
} {1 1414767442}
|
sl@0
|
1008 |
test binary-29.5 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1009 |
catch {unset arg1}
|
sl@0
|
1010 |
list [binary scan \x52\xa3\x53 i0 arg1] $arg1
|
sl@0
|
1011 |
} {1 {}}
|
sl@0
|
1012 |
test binary-29.6 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1013 |
catch {unset arg1}
|
sl@0
|
1014 |
list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 i2 arg1] $arg1
|
sl@0
|
1015 |
} {1 {1414767442 67305985}}
|
sl@0
|
1016 |
test binary-29.7 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1017 |
catch {unset arg1}
|
sl@0
|
1018 |
set arg1 foo
|
sl@0
|
1019 |
list [binary scan \x52 i1 arg1] $arg1
|
sl@0
|
1020 |
} {0 foo}
|
sl@0
|
1021 |
test binary-29.8 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1022 |
catch {unset arg1}
|
sl@0
|
1023 |
set arg1 1
|
sl@0
|
1024 |
list [catch {binary scan \x52\x53\x53\x54 i1 arg1(a)} msg] $msg
|
sl@0
|
1025 |
} {1 {can't set "arg1(a)": variable isn't array}}
|
sl@0
|
1026 |
test binary-29.9 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1027 |
catch {unset arg1 arg2}
|
sl@0
|
1028 |
set arg1 foo
|
sl@0
|
1029 |
set arg2 bar
|
sl@0
|
1030 |
list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04\x05 i2c* arg1 arg2] $arg1 $arg2
|
sl@0
|
1031 |
} {2 {1414767442 67305985} 5}
|
sl@0
|
1032 |
|
sl@0
|
1033 |
test binary-30.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1034 |
list [catch {binary scan abc I} msg] $msg
|
sl@0
|
1035 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
1036 |
test binary-30.2 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1037 |
catch {unset arg1}
|
sl@0
|
1038 |
list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 I* arg1] $arg1
|
sl@0
|
1039 |
} {1 {1386435412 16909060}}
|
sl@0
|
1040 |
test binary-30.3 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1041 |
catch {unset arg1}
|
sl@0
|
1042 |
list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 I arg1] $arg1
|
sl@0
|
1043 |
} {1 1386435412}
|
sl@0
|
1044 |
test binary-30.4 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1045 |
catch {unset arg1}
|
sl@0
|
1046 |
list [binary scan \x52\xa3\x53\x54 I1 arg1] $arg1
|
sl@0
|
1047 |
} {1 1386435412}
|
sl@0
|
1048 |
test binary-30.5 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1049 |
catch {unset arg1}
|
sl@0
|
1050 |
list [binary scan \x52\xa3\x53 I0 arg1] $arg1
|
sl@0
|
1051 |
} {1 {}}
|
sl@0
|
1052 |
test binary-30.6 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1053 |
catch {unset arg1}
|
sl@0
|
1054 |
list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 I2 arg1] $arg1
|
sl@0
|
1055 |
} {1 {1386435412 16909060}}
|
sl@0
|
1056 |
test binary-30.7 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1057 |
catch {unset arg1}
|
sl@0
|
1058 |
set arg1 foo
|
sl@0
|
1059 |
list [binary scan \x52 I1 arg1] $arg1
|
sl@0
|
1060 |
} {0 foo}
|
sl@0
|
1061 |
test binary-30.8 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1062 |
catch {unset arg1}
|
sl@0
|
1063 |
set arg1 1
|
sl@0
|
1064 |
list [catch {binary scan \x52\x53\x53\x54 I1 arg1(a)} msg] $msg
|
sl@0
|
1065 |
} {1 {can't set "arg1(a)": variable isn't array}}
|
sl@0
|
1066 |
test binary-30.9 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1067 |
catch {unset arg1 arg2}
|
sl@0
|
1068 |
set arg1 foo
|
sl@0
|
1069 |
set arg2 bar
|
sl@0
|
1070 |
list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04\x05 I2c* arg1 arg2] $arg1 $arg2
|
sl@0
|
1071 |
} {2 {1386435412 16909060} 5}
|
sl@0
|
1072 |
|
sl@0
|
1073 |
test binary-31.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1074 |
list [catch {binary scan abc f} msg] $msg
|
sl@0
|
1075 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
1076 |
test binary-31.2 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
|
sl@0
|
1077 |
catch {unset arg1}
|
sl@0
|
1078 |
list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a f* arg1] $arg1
|
sl@0
|
1079 |
} {1 {1.60000002384 3.40000009537}}
|
sl@0
|
1080 |
test binary-31.3 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
|
sl@0
|
1081 |
catch {unset arg1}
|
sl@0
|
1082 |
list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 f* arg1] $arg1
|
sl@0
|
1083 |
} {1 {1.60000002384 3.40000009537}}
|
sl@0
|
1084 |
test binary-31.4 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
|
sl@0
|
1085 |
catch {unset arg1}
|
sl@0
|
1086 |
list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a f arg1] $arg1
|
sl@0
|
1087 |
} {1 1.60000002384}
|
sl@0
|
1088 |
test binary-31.5 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
|
sl@0
|
1089 |
catch {unset arg1}
|
sl@0
|
1090 |
list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 f arg1] $arg1
|
sl@0
|
1091 |
} {1 1.60000002384}
|
sl@0
|
1092 |
test binary-31.6 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
|
sl@0
|
1093 |
catch {unset arg1}
|
sl@0
|
1094 |
list [binary scan \x3f\xcc\xcc\xcd f1 arg1] $arg1
|
sl@0
|
1095 |
} {1 1.60000002384}
|
sl@0
|
1096 |
test binary-31.7 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
|
sl@0
|
1097 |
catch {unset arg1}
|
sl@0
|
1098 |
list [binary scan \xcd\xcc\xcc\x3f f1 arg1] $arg1
|
sl@0
|
1099 |
} {1 1.60000002384}
|
sl@0
|
1100 |
test binary-31.8 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
|
sl@0
|
1101 |
catch {unset arg1}
|
sl@0
|
1102 |
list [binary scan \x3f\xcc\xcc\xcd f0 arg1] $arg1
|
sl@0
|
1103 |
} {1 {}}
|
sl@0
|
1104 |
test binary-31.9 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
|
sl@0
|
1105 |
catch {unset arg1}
|
sl@0
|
1106 |
list [binary scan \xcd\xcc\xcc\x3f f0 arg1] $arg1
|
sl@0
|
1107 |
} {1 {}}
|
sl@0
|
1108 |
test binary-31.10 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
|
sl@0
|
1109 |
catch {unset arg1}
|
sl@0
|
1110 |
list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a f2 arg1] $arg1
|
sl@0
|
1111 |
} {1 {1.60000002384 3.40000009537}}
|
sl@0
|
1112 |
test binary-31.11 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
|
sl@0
|
1113 |
catch {unset arg1}
|
sl@0
|
1114 |
list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 f2 arg1] $arg1
|
sl@0
|
1115 |
} {1 {1.60000002384 3.40000009537}}
|
sl@0
|
1116 |
test binary-31.12 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1117 |
catch {unset arg1}
|
sl@0
|
1118 |
set arg1 foo
|
sl@0
|
1119 |
list [binary scan \x52 f1 arg1] $arg1
|
sl@0
|
1120 |
} {0 foo}
|
sl@0
|
1121 |
test binary-31.13 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1122 |
catch {unset arg1}
|
sl@0
|
1123 |
set arg1 1
|
sl@0
|
1124 |
list [catch {binary scan \x3f\xcc\xcc\xcd f1 arg1(a)} msg] $msg
|
sl@0
|
1125 |
} {1 {can't set "arg1(a)": variable isn't array}}
|
sl@0
|
1126 |
test binary-31.14 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
|
sl@0
|
1127 |
catch {unset arg1 arg2}
|
sl@0
|
1128 |
set arg1 foo
|
sl@0
|
1129 |
set arg2 bar
|
sl@0
|
1130 |
list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a\x05 f2c* arg1 arg2] $arg1 $arg2
|
sl@0
|
1131 |
} {2 {1.60000002384 3.40000009537} 5}
|
sl@0
|
1132 |
test binary-31.15 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
|
sl@0
|
1133 |
catch {unset arg1 arg2}
|
sl@0
|
1134 |
set arg1 foo
|
sl@0
|
1135 |
set arg2 bar
|
sl@0
|
1136 |
list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40\x05 f2c* arg1 arg2] $arg1 $arg2
|
sl@0
|
1137 |
} {2 {1.60000002384 3.40000009537} 5}
|
sl@0
|
1138 |
|
sl@0
|
1139 |
test binary-32.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1140 |
list [catch {binary scan abc d} msg] $msg
|
sl@0
|
1141 |
} {1 {not enough arguments for all format specifiers}}
|
sl@0
|
1142 |
test binary-32.2 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
|
sl@0
|
1143 |
catch {unset arg1}
|
sl@0
|
1144 |
list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33 d* arg1] $arg1
|
sl@0
|
1145 |
} {1 {1.6 3.4}}
|
sl@0
|
1146 |
test binary-32.3 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
|
sl@0
|
1147 |
catch {unset arg1}
|
sl@0
|
1148 |
list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40 d* arg1] $arg1
|
sl@0
|
1149 |
} {1 {1.6 3.4}}
|
sl@0
|
1150 |
test binary-32.4 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
|
sl@0
|
1151 |
catch {unset arg1}
|
sl@0
|
1152 |
list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33 d arg1] $arg1
|
sl@0
|
1153 |
} {1 1.6}
|
sl@0
|
1154 |
test binary-32.5 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
|
sl@0
|
1155 |
catch {unset arg1}
|
sl@0
|
1156 |
list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40 d arg1] $arg1
|
sl@0
|
1157 |
} {1 1.6}
|
sl@0
|
1158 |
test binary-32.6 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
|
sl@0
|
1159 |
catch {unset arg1}
|
sl@0
|
1160 |
list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a d1 arg1] $arg1
|
sl@0
|
1161 |
} {1 1.6}
|
sl@0
|
1162 |
test binary-32.7 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
|
sl@0
|
1163 |
catch {unset arg1}
|
sl@0
|
1164 |
list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f d1 arg1] $arg1
|
sl@0
|
1165 |
} {1 1.6}
|
sl@0
|
1166 |
test binary-32.8 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
|
sl@0
|
1167 |
catch {unset arg1}
|
sl@0
|
1168 |
list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a d0 arg1] $arg1
|
sl@0
|
1169 |
} {1 {}}
|
sl@0
|
1170 |
test binary-32.9 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
|
sl@0
|
1171 |
catch {unset arg1}
|
sl@0
|
1172 |
list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f d0 arg1] $arg1
|
sl@0
|
1173 |
} {1 {}}
|
sl@0
|
1174 |
test binary-32.10 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
|
sl@0
|
1175 |
catch {unset arg1}
|
sl@0
|
1176 |
list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33 d2 arg1] $arg1
|
sl@0
|
1177 |
} {1 {1.6 3.4}}
|
sl@0
|
1178 |
test binary-32.11 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
|
sl@0
|
1179 |
catch {unset arg1}
|
sl@0
|
1180 |
list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40 d2 arg1] $arg1
|
sl@0
|
1181 |
} {1 {1.6 3.4}}
|
sl@0
|
1182 |
test binary-32.12 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1183 |
catch {unset arg1}
|
sl@0
|
1184 |
set arg1 foo
|
sl@0
|
1185 |
list [binary scan \x52 d1 arg1] $arg1
|
sl@0
|
1186 |
} {0 foo}
|
sl@0
|
1187 |
test binary-32.13 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1188 |
catch {unset arg1}
|
sl@0
|
1189 |
set arg1 1
|
sl@0
|
1190 |
list [catch {binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a d1 arg1(a)} msg] $msg
|
sl@0
|
1191 |
} {1 {can't set "arg1(a)": variable isn't array}}
|
sl@0
|
1192 |
test binary-32.14 {Tcl_BinaryObjCmd: scan} {nonPortable macOrUnix} {
|
sl@0
|
1193 |
catch {unset arg1 arg2}
|
sl@0
|
1194 |
set arg1 foo
|
sl@0
|
1195 |
set arg2 bar
|
sl@0
|
1196 |
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
|
sl@0
|
1197 |
} {2 {1.6 3.4} 5}
|
sl@0
|
1198 |
test binary-32.15 {Tcl_BinaryObjCmd: scan} {nonPortable pcOnly} {
|
sl@0
|
1199 |
catch {unset arg1 arg2}
|
sl@0
|
1200 |
set arg1 foo
|
sl@0
|
1201 |
set arg2 bar
|
sl@0
|
1202 |
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
|
sl@0
|
1203 |
} {2 {1.6 3.4} 5}
|
sl@0
|
1204 |
|
sl@0
|
1205 |
test binary-33.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1206 |
catch {unset arg1}
|
sl@0
|
1207 |
catch {unset arg2}
|
sl@0
|
1208 |
list [binary scan abcdefg a2xa3 arg1 arg2] $arg1 $arg2
|
sl@0
|
1209 |
} {2 ab def}
|
sl@0
|
1210 |
test binary-33.2 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1211 |
catch {unset arg1}
|
sl@0
|
1212 |
catch {unset arg2}
|
sl@0
|
1213 |
set arg2 foo
|
sl@0
|
1214 |
list [binary scan abcdefg a3x*a3 arg1 arg2] $arg1 $arg2
|
sl@0
|
1215 |
} {1 abc foo}
|
sl@0
|
1216 |
test binary-33.3 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1217 |
catch {unset arg1}
|
sl@0
|
1218 |
catch {unset arg2}
|
sl@0
|
1219 |
set arg2 foo
|
sl@0
|
1220 |
list [binary scan abcdefg a3x20a3 arg1 arg2] $arg1 $arg2
|
sl@0
|
1221 |
} {1 abc foo}
|
sl@0
|
1222 |
test binary-33.4 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1223 |
catch {unset arg1}
|
sl@0
|
1224 |
catch {unset arg2}
|
sl@0
|
1225 |
set arg2 foo
|
sl@0
|
1226 |
list [binary scan abc a3x20a3 arg1 arg2] $arg1 $arg2
|
sl@0
|
1227 |
} {1 abc foo}
|
sl@0
|
1228 |
test binary-33.5 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1229 |
catch {unset arg1}
|
sl@0
|
1230 |
list [binary scan abcdef x1a1 arg1] $arg1
|
sl@0
|
1231 |
} {1 b}
|
sl@0
|
1232 |
test binary-33.6 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1233 |
catch {unset arg1}
|
sl@0
|
1234 |
list [binary scan abcdef x5a1 arg1] $arg1
|
sl@0
|
1235 |
} {1 f}
|
sl@0
|
1236 |
test binary-33.7 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1237 |
catch {unset arg1}
|
sl@0
|
1238 |
list [binary scan abcdef x0a1 arg1] $arg1
|
sl@0
|
1239 |
} {1 a}
|
sl@0
|
1240 |
|
sl@0
|
1241 |
test binary-34.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1242 |
catch {unset arg1}
|
sl@0
|
1243 |
catch {unset arg2}
|
sl@0
|
1244 |
list [binary scan abcdefg a2Xa3 arg1 arg2] $arg1 $arg2
|
sl@0
|
1245 |
} {2 ab bcd}
|
sl@0
|
1246 |
test binary-34.2 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1247 |
catch {unset arg1}
|
sl@0
|
1248 |
catch {unset arg2}
|
sl@0
|
1249 |
set arg2 foo
|
sl@0
|
1250 |
list [binary scan abcdefg a3X*a3 arg1 arg2] $arg1 $arg2
|
sl@0
|
1251 |
} {2 abc abc}
|
sl@0
|
1252 |
test binary-34.3 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1253 |
catch {unset arg1}
|
sl@0
|
1254 |
catch {unset arg2}
|
sl@0
|
1255 |
set arg2 foo
|
sl@0
|
1256 |
list [binary scan abcdefg a3X20a3 arg1 arg2] $arg1 $arg2
|
sl@0
|
1257 |
} {2 abc abc}
|
sl@0
|
1258 |
test binary-34.4 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1259 |
catch {unset arg1}
|
sl@0
|
1260 |
list [binary scan abc X20a3 arg1] $arg1
|
sl@0
|
1261 |
} {1 abc}
|
sl@0
|
1262 |
test binary-34.5 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1263 |
catch {unset arg1}
|
sl@0
|
1264 |
list [binary scan abcdef x*X1a1 arg1] $arg1
|
sl@0
|
1265 |
} {1 f}
|
sl@0
|
1266 |
test binary-34.6 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1267 |
catch {unset arg1}
|
sl@0
|
1268 |
list [binary scan abcdef x*X5a1 arg1] $arg1
|
sl@0
|
1269 |
} {1 b}
|
sl@0
|
1270 |
test binary-34.7 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1271 |
catch {unset arg1}
|
sl@0
|
1272 |
list [binary scan abcdef x3X0a1 arg1] $arg1
|
sl@0
|
1273 |
} {1 d}
|
sl@0
|
1274 |
|
sl@0
|
1275 |
test binary-35.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1276 |
catch {unset arg1}
|
sl@0
|
1277 |
catch {unset arg2}
|
sl@0
|
1278 |
list [catch {binary scan abcdefg a2@a3 arg1 arg2} msg] $msg
|
sl@0
|
1279 |
} {1 {missing count for "@" field specifier}}
|
sl@0
|
1280 |
test binary-35.2 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1281 |
catch {unset arg1}
|
sl@0
|
1282 |
catch {unset arg2}
|
sl@0
|
1283 |
set arg2 foo
|
sl@0
|
1284 |
list [binary scan abcdefg a3@*a3 arg1 arg2] $arg1 $arg2
|
sl@0
|
1285 |
} {1 abc foo}
|
sl@0
|
1286 |
test binary-35.3 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1287 |
catch {unset arg1}
|
sl@0
|
1288 |
catch {unset arg2}
|
sl@0
|
1289 |
set arg2 foo
|
sl@0
|
1290 |
list [binary scan abcdefg a3@20a3 arg1 arg2] $arg1 $arg2
|
sl@0
|
1291 |
} {1 abc foo}
|
sl@0
|
1292 |
test binary-35.4 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1293 |
catch {unset arg1}
|
sl@0
|
1294 |
list [binary scan abcdef @2a3 arg1] $arg1
|
sl@0
|
1295 |
} {1 cde}
|
sl@0
|
1296 |
test binary-35.5 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1297 |
catch {unset arg1}
|
sl@0
|
1298 |
list [binary scan abcdef x*@1a1 arg1] $arg1
|
sl@0
|
1299 |
} {1 b}
|
sl@0
|
1300 |
test binary-35.6 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1301 |
catch {unset arg1}
|
sl@0
|
1302 |
list [binary scan abcdef x*@0a1 arg1] $arg1
|
sl@0
|
1303 |
} {1 a}
|
sl@0
|
1304 |
|
sl@0
|
1305 |
test binary-36.1 {Tcl_BinaryObjCmd: scan} {
|
sl@0
|
1306 |
list [catch {binary scan abcdef u0a3} msg] $msg
|
sl@0
|
1307 |
} {1 {bad field specifier "u"}}
|
sl@0
|
1308 |
|
sl@0
|
1309 |
# GetFormatSpec is pretty thoroughly tested above, but there are a few
|
sl@0
|
1310 |
# cases we should text explicitly
|
sl@0
|
1311 |
|
sl@0
|
1312 |
test binary-37.1 {GetFormatSpec: whitespace} {
|
sl@0
|
1313 |
binary format "a3 a5 a3" foo barblat baz
|
sl@0
|
1314 |
} foobarblbaz
|
sl@0
|
1315 |
test binary-37.2 {GetFormatSpec: whitespace} {
|
sl@0
|
1316 |
binary format " " foo
|
sl@0
|
1317 |
} {}
|
sl@0
|
1318 |
test binary-37.3 {GetFormatSpec: whitespace} {
|
sl@0
|
1319 |
binary format " a3" foo
|
sl@0
|
1320 |
} foo
|
sl@0
|
1321 |
test binary-37.4 {GetFormatSpec: whitespace} {
|
sl@0
|
1322 |
binary format "" foo
|
sl@0
|
1323 |
} {}
|
sl@0
|
1324 |
test binary-37.5 {GetFormatSpec: whitespace} {
|
sl@0
|
1325 |
binary format "" foo
|
sl@0
|
1326 |
} {}
|
sl@0
|
1327 |
test binary-37.6 {GetFormatSpec: whitespace} {
|
sl@0
|
1328 |
binary format " a3 " foo
|
sl@0
|
1329 |
} foo
|
sl@0
|
1330 |
test binary-37.7 {GetFormatSpec: numbers} {
|
sl@0
|
1331 |
list [catch {binary scan abcdef "x-1" foo} msg] $msg
|
sl@0
|
1332 |
} {1 {bad field specifier "-"}}
|
sl@0
|
1333 |
test binary-37.8 {GetFormatSpec: numbers} {
|
sl@0
|
1334 |
catch {unset arg1}
|
sl@0
|
1335 |
set arg1 foo
|
sl@0
|
1336 |
list [binary scan abcdef "a0x3" arg1] $arg1
|
sl@0
|
1337 |
} {1 {}}
|
sl@0
|
1338 |
test binary-37.9 {GetFormatSpec: numbers} {
|
sl@0
|
1339 |
# test format of neg numbers
|
sl@0
|
1340 |
# bug report/fix provided by Harald Kirsch
|
sl@0
|
1341 |
set x [binary format f* {1 -1 2 -2 0}]
|
sl@0
|
1342 |
binary scan $x f* bla
|
sl@0
|
1343 |
set bla
|
sl@0
|
1344 |
} {1.0 -1.0 2.0 -2.0 0.0}
|
sl@0
|
1345 |
|
sl@0
|
1346 |
test binary-38.1 {FormatNumber: word alignment} {
|
sl@0
|
1347 |
set x [binary format c1s1 1 1]
|
sl@0
|
1348 |
} \x01\x01\x00
|
sl@0
|
1349 |
test binary-38.2 {FormatNumber: word alignment} {
|
sl@0
|
1350 |
set x [binary format c1S1 1 1]
|
sl@0
|
1351 |
} \x01\x00\x01
|
sl@0
|
1352 |
test binary-38.3 {FormatNumber: word alignment} {
|
sl@0
|
1353 |
set x [binary format c1i1 1 1]
|
sl@0
|
1354 |
} \x01\x01\x00\x00\x00
|
sl@0
|
1355 |
test binary-38.4 {FormatNumber: word alignment} {
|
sl@0
|
1356 |
set x [binary format c1I1 1 1]
|
sl@0
|
1357 |
} \x01\x00\x00\x00\x01
|
sl@0
|
1358 |
test binary-38.5 {FormatNumber: word alignment} {nonPortable macOrUnix} {
|
sl@0
|
1359 |
set x [binary format c1d1 1 1.6]
|
sl@0
|
1360 |
} \x01\x3f\xf9\x99\x99\x99\x99\x99\x9a
|
sl@0
|
1361 |
test binary-38.6 {FormatNumber: word alignment} {nonPortable pcOnly} {
|
sl@0
|
1362 |
set x [binary format c1d1 1 1.6]
|
sl@0
|
1363 |
} \x01\x9a\x99\x99\x99\x99\x99\xf9\x3f
|
sl@0
|
1364 |
test binary-38.7 {FormatNumber: word alignment} {nonPortable macOrUnix} {
|
sl@0
|
1365 |
set x [binary format c1f1 1 1.6]
|
sl@0
|
1366 |
} \x01\x3f\xcc\xcc\xcd
|
sl@0
|
1367 |
test binary-38.8 {FormatNumber: word alignment} {nonPortable pcOnly} {
|
sl@0
|
1368 |
set x [binary format c1f1 1 1.6]
|
sl@0
|
1369 |
} \x01\xcd\xcc\xcc\x3f
|
sl@0
|
1370 |
|
sl@0
|
1371 |
test binary-39.1 {ScanNumber: sign extension} {
|
sl@0
|
1372 |
catch {unset arg1}
|
sl@0
|
1373 |
list [binary scan \x52\xa3 c2 arg1] $arg1
|
sl@0
|
1374 |
} {1 {82 -93}}
|
sl@0
|
1375 |
test binary-39.2 {ScanNumber: sign extension} {
|
sl@0
|
1376 |
catch {unset arg1}
|
sl@0
|
1377 |
list [binary scan \x01\x02\x01\x81\x82\x01\x81\x82 s4 arg1] $arg1
|
sl@0
|
1378 |
} {1 {513 -32511 386 -32127}}
|
sl@0
|
1379 |
test binary-39.3 {ScanNumber: sign extension} {
|
sl@0
|
1380 |
catch {unset arg1}
|
sl@0
|
1381 |
list [binary scan \x01\x02\x01\x81\x82\x01\x81\x82 S4 arg1] $arg1
|
sl@0
|
1382 |
} {1 {258 385 -32255 -32382}}
|
sl@0
|
1383 |
test binary-39.4 {ScanNumber: sign extension} {
|
sl@0
|
1384 |
catch {unset arg1}
|
sl@0
|
1385 |
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
|
sl@0
|
1386 |
} {1 {33620225 16843137 16876033 25297153 -2130640639}}
|
sl@0
|
1387 |
test binary-39.5 {ScanNumber: sign extension} {
|
sl@0
|
1388 |
catch {unset arg1}
|
sl@0
|
1389 |
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
|
sl@0
|
1390 |
} {1 {16843010 -2130640639 25297153 16876033 16843137}}
|
sl@0
|
1391 |
|
sl@0
|
1392 |
test binary-40.1 {ScanNumber: floating point overflow} {nonPortable unixOnly} {
|
sl@0
|
1393 |
catch {unset arg1}
|
sl@0
|
1394 |
list [binary scan \xff\xff\xff\xff f1 arg1] $arg1
|
sl@0
|
1395 |
} {1 -NaN}
|
sl@0
|
1396 |
test binary-40.2 {ScanNumber: floating point overflow} {nonPortable macOnly} {
|
sl@0
|
1397 |
catch {unset arg1}
|
sl@0
|
1398 |
list [binary scan \xff\xff\xff\xff f1 arg1] $arg1
|
sl@0
|
1399 |
} {1 -NAN(255)}
|
sl@0
|
1400 |
test binary-40.3 {ScanNumber: floating point overflow} {nonPortable pcOnly} {
|
sl@0
|
1401 |
catch {unset arg1}
|
sl@0
|
1402 |
set result [binary scan \xff\xff\xff\xff f1 arg1]
|
sl@0
|
1403 |
if {([string compare $arg1 -1.\#QNAN] == 0)
|
sl@0
|
1404 |
|| ([string compare $arg1 -NAN] == 0)} {
|
sl@0
|
1405 |
lappend result success
|
sl@0
|
1406 |
} else {
|
sl@0
|
1407 |
lappend result failure
|
sl@0
|
1408 |
}
|
sl@0
|
1409 |
} {1 success}
|
sl@0
|
1410 |
test binary-40.4 {ScanNumber: floating point overflow} {nonPortable unixOnly} {
|
sl@0
|
1411 |
catch {unset arg1}
|
sl@0
|
1412 |
list [binary scan \xff\xff\xff\xff\xff\xff\xff\xff d1 arg1] $arg1
|
sl@0
|
1413 |
} {1 -NaN}
|
sl@0
|
1414 |
test binary-40.5 {ScanNumber: floating point overflow} {nonPortable macOnly} {
|
sl@0
|
1415 |
catch {unset arg1}
|
sl@0
|
1416 |
list [binary scan \xff\xff\xff\xff\xff\xff\xff\xff d1 arg1] $arg1
|
sl@0
|
1417 |
} {1 -NAN(255)}
|
sl@0
|
1418 |
test binary-40.6 {ScanNumber: floating point overflow} {nonPortable pcOnly} {
|
sl@0
|
1419 |
catch {unset arg1}
|
sl@0
|
1420 |
set result [binary scan \xff\xff\xff\xff\xff\xff\xff\xff d1 arg1]
|
sl@0
|
1421 |
if {([string compare $arg1 -1.\#QNAN] == 0)
|
sl@0
|
1422 |
|| ([string compare $arg1 -NAN] == 0)} {
|
sl@0
|
1423 |
lappend result success
|
sl@0
|
1424 |
} else {
|
sl@0
|
1425 |
lappend result failure
|
sl@0
|
1426 |
}
|
sl@0
|
1427 |
} {1 success}
|
sl@0
|
1428 |
|
sl@0
|
1429 |
test binary-41.1 {ScanNumber: word alignment} {
|
sl@0
|
1430 |
catch {unset arg1; unset arg2}
|
sl@0
|
1431 |
list [binary scan \x01\x01\x00 c1s1 arg1 arg2] $arg1 $arg2
|
sl@0
|
1432 |
} {2 1 1}
|
sl@0
|
1433 |
test binary-41.2 {ScanNumber: word alignment} {
|
sl@0
|
1434 |
catch {unset arg1; unset arg2}
|
sl@0
|
1435 |
list [binary scan \x01\x00\x01 c1S1 arg1 arg2] $arg1 $arg2
|
sl@0
|
1436 |
} {2 1 1}
|
sl@0
|
1437 |
test binary-41.3 {ScanNumber: word alignment} {
|
sl@0
|
1438 |
catch {unset arg1; unset arg2}
|
sl@0
|
1439 |
list [binary scan \x01\x01\x00\x00\x00 c1i1 arg1 arg2] $arg1 $arg2
|
sl@0
|
1440 |
} {2 1 1}
|
sl@0
|
1441 |
test binary-41.4 {ScanNumber: word alignment} {
|
sl@0
|
1442 |
catch {unset arg1; unset arg2}
|
sl@0
|
1443 |
list [binary scan \x01\x00\x00\x00\x01 c1I1 arg1 arg2] $arg1 $arg2
|
sl@0
|
1444 |
} {2 1 1}
|
sl@0
|
1445 |
test binary-41.5 {ScanNumber: word alignment} {nonPortable macOrUnix} {
|
sl@0
|
1446 |
catch {unset arg1; unset arg2}
|
sl@0
|
1447 |
list [binary scan \x01\x3f\xcc\xcc\xcd c1f1 arg1 arg2] $arg1 $arg2
|
sl@0
|
1448 |
} {2 1 1.60000002384}
|
sl@0
|
1449 |
test binary-41.6 {ScanNumber: word alignment} {nonPortable pcOnly} {
|
sl@0
|
1450 |
catch {unset arg1; unset arg2}
|
sl@0
|
1451 |
list [binary scan \x01\xcd\xcc\xcc\x3f c1f1 arg1 arg2] $arg1 $arg2
|
sl@0
|
1452 |
} {2 1 1.60000002384}
|
sl@0
|
1453 |
test binary-41.7 {ScanNumber: word alignment} {nonPortable macOrUnix} {
|
sl@0
|
1454 |
catch {unset arg1; unset arg2}
|
sl@0
|
1455 |
list [binary scan \x01\x3f\xf9\x99\x99\x99\x99\x99\x9a c1d1 arg1 arg2] $arg1 $arg2
|
sl@0
|
1456 |
} {2 1 1.6}
|
sl@0
|
1457 |
test binary-41.8 {ScanNumber: word alignment} {nonPortable pcOnly} {
|
sl@0
|
1458 |
catch {unset arg1; unset arg2}
|
sl@0
|
1459 |
list [binary scan \x01\x9a\x99\x99\x99\x99\x99\xf9\x3f c1d1 arg1 arg2] $arg1 $arg2
|
sl@0
|
1460 |
} {2 1 1.6}
|
sl@0
|
1461 |
|
sl@0
|
1462 |
test binary-42.1 {Tcl_BinaryObjCmd: bad arguments} {} {
|
sl@0
|
1463 |
catch {binary ?} result
|
sl@0
|
1464 |
set result
|
sl@0
|
1465 |
} {bad option "?": must be format or scan}
|
sl@0
|
1466 |
|
sl@0
|
1467 |
# Wide int (guaranteed at least 64-bit) handling
|
sl@0
|
1468 |
test binary-43.1 {Tcl_BinaryObjCmd: format wide int} {} {
|
sl@0
|
1469 |
binary format w 7810179016327718216
|
sl@0
|
1470 |
} HelloTcl
|
sl@0
|
1471 |
test binary-43.2 {Tcl_BinaryObjCmd: format wide int} {} {
|
sl@0
|
1472 |
binary format W 7810179016327718216
|
sl@0
|
1473 |
} lcTolleH
|
sl@0
|
1474 |
|
sl@0
|
1475 |
test binary-44.1 {Tcl_BinaryObjCmd: scan wide int} {} {
|
sl@0
|
1476 |
binary scan HelloTcl W x
|
sl@0
|
1477 |
set x
|
sl@0
|
1478 |
} 5216694956358656876
|
sl@0
|
1479 |
test binary-44.2 {Tcl_BinaryObjCmd: scan wide int} {} {
|
sl@0
|
1480 |
binary scan lcTolleH w x
|
sl@0
|
1481 |
set x
|
sl@0
|
1482 |
} 5216694956358656876
|
sl@0
|
1483 |
test binary-44.3 {Tcl_BinaryObjCmd: scan wide int with bit 31 set} {} {
|
sl@0
|
1484 |
binary scan [binary format w [expr {wide(3) << 31}]] w x
|
sl@0
|
1485 |
set x
|
sl@0
|
1486 |
} 6442450944
|
sl@0
|
1487 |
test binary-44.4 {Tcl_BinaryObjCmd: scan wide int with bit 31 set} {} {
|
sl@0
|
1488 |
binary scan [binary format W [expr {wide(3) << 31}]] W x
|
sl@0
|
1489 |
set x
|
sl@0
|
1490 |
} 6442450944
|
sl@0
|
1491 |
|
sl@0
|
1492 |
test binary-45.1 {Tcl_BinaryObjCmd: combined wide int handling} {
|
sl@0
|
1493 |
binary scan [binary format sws 16450 -1 19521] c* x
|
sl@0
|
1494 |
set x
|
sl@0
|
1495 |
} {66 64 -1 -1 -1 -1 -1 -1 -1 -1 65 76}
|
sl@0
|
1496 |
test binary-45.2 {Tcl_BinaryObjCmd: combined wide int handling} {
|
sl@0
|
1497 |
binary scan [binary format sWs 16450 0x7fffffff 19521] c* x
|
sl@0
|
1498 |
set x
|
sl@0
|
1499 |
} {66 64 0 0 0 0 127 -1 -1 -1 65 76}
|
sl@0
|
1500 |
|
sl@0
|
1501 |
test binary-46.1 {Tcl_BinaryObjCmd: handling of non-ISO8859-1 chars} {
|
sl@0
|
1502 |
binary format a* \u20ac
|
sl@0
|
1503 |
} \u00ac
|
sl@0
|
1504 |
test binary-46.2 {Tcl_BinaryObjCmd: handling of non-ISO8859-1 chars} {
|
sl@0
|
1505 |
list [binary scan [binary format a* \u20ac\u20bd] s x] $x
|
sl@0
|
1506 |
} {1 -16980}
|
sl@0
|
1507 |
test binary-46.3 {Tcl_BinaryObjCmd: handling of non-ISO8859-1 chars} {
|
sl@0
|
1508 |
set x {}
|
sl@0
|
1509 |
set y {}
|
sl@0
|
1510 |
set z {}
|
sl@0
|
1511 |
list [binary scan [binary format a* \u20ac\u20bd] aaa x y z] $x $y $z
|
sl@0
|
1512 |
} "2 \u00ac \u00bd {}"
|
sl@0
|
1513 |
test binary-46.4 {Tcl_BinaryObjCmd: handling of non-ISO8859-1 chars} {
|
sl@0
|
1514 |
set x [encoding convertto iso8859-15 \u20ac]
|
sl@0
|
1515 |
set y [binary format a* $x]
|
sl@0
|
1516 |
list $x $y
|
sl@0
|
1517 |
} "\u00a4 \u00a4"
|
sl@0
|
1518 |
test binary-46.5 {Tcl_BinaryObjCmd: handling of non-ISO8859-1 chars} {
|
sl@0
|
1519 |
set x [binary scan \u00a4 a* y]
|
sl@0
|
1520 |
list $x $y [encoding convertfrom iso8859-15 $y]
|
sl@0
|
1521 |
} "1 \u00a4 \u20ac"
|
sl@0
|
1522 |
|
sl@0
|
1523 |
test binary-47.1 {Tcl_BinaryObjCmd: number cache reference count handling} {
|
sl@0
|
1524 |
# This test is only reliable when memory debugging is turned on,
|
sl@0
|
1525 |
# but without even memory debugging it should still generate the
|
sl@0
|
1526 |
# expected answers and might therefore still pick up memory corruption
|
sl@0
|
1527 |
# caused by [Bug 851747].
|
sl@0
|
1528 |
list [binary scan aba ccc x x x] $x
|
sl@0
|
1529 |
} {3 97}
|
sl@0
|
1530 |
|
sl@0
|
1531 |
# cleanup
|
sl@0
|
1532 |
::tcltest::cleanupTests
|
sl@0
|
1533 |
return
|