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