summaryrefslogtreecommitdiffstats
path: root/tests/binary.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/binary.test')
-rw-r--r--tests/binary.test2606
1 files changed, 998 insertions, 1608 deletions
diff --git a/tests/binary.test b/tests/binary.test
index 03ef846..e43b9f4 100644
--- a/tests/binary.test
+++ b/tests/binary.test
@@ -1,110 +1,50 @@
-# This file tests the tclBinary.c file and the "binary" Tcl command.
+# This file tests the tclBinary.c file and the "binary" Tcl command.
#
-# This file contains a collection of tests for one or more of the Tcl built-in
-# commands. Sourcing this file into Tcl runs the tests and generates output
-# for errors. No output means no errors were found.
+# This file contains a collection of tests for one or more of the Tcl
+# built-in commands. Sourcing this file into Tcl runs the tests and
+# generates output for errors. No output means no errors were found.
#
-# Copyright © 1997 Sun Microsystems, Inc.
-# Copyright © 1998-1999 Scriptics Corporation.
+# Copyright (c) 1997 by Sun Microsystems, Inc.
+# Copyright (c) 1998-1999 by Scriptics Corporation.
#
-# See the file "license.terms" for information on usage and redistribution of
-# this file, and for a DISCLAIMER OF ALL WARRANTIES.
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {"::tcltest" ni [namespace children]} {
- package require tcltest 2.5
+if {[lsearch [namespace children] ::tcltest] == -1} {
+ package require tcltest
namespace import -force ::tcltest::*
}
-::tcltest::loadTestedCommands
-catch [list package require -exact tcl::test [info patchlevel]]
-
testConstraint bigEndian [expr {$tcl_platform(byteOrder) eq "bigEndian"}]
testConstraint littleEndian [expr {$tcl_platform(byteOrder) eq "littleEndian"}]
-testConstraint testbytestring [llength [info commands testbytestring]]
-
-# Big test for correct ordering of data in [expr]
-proc testIEEE {} {
- variable ieeeValues
- binary scan [binary format dd -1.0 1.0] c* c
- switch -exact -- $c {
- {0 0 0 0 0 0 -16 -65 0 0 0 0 0 0 -16 63} {
- # little endian
- binary scan \x00\x00\x00\x00\x00\x00\xF0\xFF d \
- ieeeValues(-Infinity)
- binary scan \x00\x00\x00\x00\x00\x00\xF0\xBF d \
- ieeeValues(-Normal)
- binary scan \x00\x00\x00\x00\x00\x00\x08\x80 d \
- ieeeValues(-Subnormal)
- binary scan \x00\x00\x00\x00\x00\x00\x00\x80 d \
- ieeeValues(-0)
- binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
- ieeeValues(+0)
- binary scan \x00\x00\x00\x00\x00\x00\x08\x00 d \
- ieeeValues(+Subnormal)
- binary scan \x00\x00\x00\x00\x00\x00\xF0\x3F d \
- ieeeValues(+Normal)
- binary scan \x00\x00\x00\x00\x00\x00\xF0\x7F d \
- ieeeValues(+Infinity)
- binary scan \x00\x00\x00\x00\x00\x00\xF8\x7F d \
- ieeeValues(NaN)
- set ieeeValues(littleEndian) 1
- return 1
- }
- {-65 -16 0 0 0 0 0 0 63 -16 0 0 0 0 0 0} {
- binary scan \xFF\xF0\x00\x00\x00\x00\x00\x00 d \
- ieeeValues(-Infinity)
- binary scan \xBF\xF0\x00\x00\x00\x00\x00\x00 d \
- ieeeValues(-Normal)
- binary scan \x80\x08\x00\x00\x00\x00\x00\x00 d \
- ieeeValues(-Subnormal)
- binary scan \x80\x00\x00\x00\x00\x00\x00\x00 d \
- ieeeValues(-0)
- binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
- ieeeValues(+0)
- binary scan \x00\x08\x00\x00\x00\x00\x00\x00 d \
- ieeeValues(+Subnormal)
- binary scan \x3F\xF0\x00\x00\x00\x00\x00\x00 d \
- ieeeValues(+Normal)
- binary scan \x7F\xF0\x00\x00\x00\x00\x00\x00 d \
- ieeeValues(+Infinity)
- binary scan \x7F\xF8\x00\x00\x00\x00\x00\x00 d \
- ieeeValues(NaN)
- set ieeeValues(littleEndian) 0
- return 1
- }
- default {
- return 0
- }
- }
-}
-
-testConstraint ieeeFloatingPoint [testIEEE]
-
-# ----------------------------------------------------------------------
test binary-0.1 {DupByteArrayInternalRep} {
set hdr [binary format cc 0 0316]
set buf hellomatt
+
set data $hdr
append data $buf
+
string length $data
} 11
-test binary-1.1 {Tcl_BinaryObjCmd: bad args} -body {
- binary
-} -returnCodes error -match glob -result {wrong # args: *}
-test binary-1.2 {Tcl_BinaryObjCmd: bad args} -returnCodes error -body {
- binary foo
-} -match glob -result {unknown or ambiguous subcommand "foo": *}
-test binary-1.3 {Tcl_BinaryObjCmd: format error} -returnCodes error -body {
- binary f
-} -result {wrong # args: should be "binary format formatString ?arg ...?"}
-test binary-1.4 {Tcl_BinaryObjCmd: format} -body {
+test binary-1.1 {Tcl_BinaryObjCmd: bad args} {
+ list [catch {binary} msg] $msg
+} {1 {wrong # args: should be "binary option ?arg arg ...?"}}
+test binary-1.2 {Tcl_BinaryObjCmd: bad args} {
+ list [catch {binary foo} msg] $msg
+} {1 {bad option "foo": must be format or scan}}
+
+test binary-1.3 {Tcl_BinaryObjCmd: format error} {
+ list [catch {binary f} msg] $msg
+} {1 {wrong # args: should be "binary format formatString ?arg arg ...?"}}
+test binary-1.4 {Tcl_BinaryObjCmd: format} {
binary format ""
-} -result {}
+} {}
+
-test binary-2.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format a
-} -result {not enough arguments for all format specifiers}
+test binary-2.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format a } msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-2.2 {Tcl_BinaryObjCmd: format} {
binary format a0 foo
} {}
@@ -127,9 +67,9 @@ test binary-2.8 {Tcl_BinaryObjCmd: format} {
binary format a*X3a2 foobar x
} foox\x00r
-test binary-3.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format A
-} -result {not enough arguments for all format specifiers}
+test binary-3.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format A} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-3.2 {Tcl_BinaryObjCmd: format} {
binary format A0 f
} {}
@@ -152,9 +92,9 @@ test binary-3.8 {Tcl_BinaryObjCmd: format} {
binary format A*X3A2 foobar x
} {foox r}
-test binary-4.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format B
-} -result {not enough arguments for all format specifiers}
+test binary-4.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format B} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-4.2 {Tcl_BinaryObjCmd: format} {
binary format B0 1
} {}
@@ -163,26 +103,26 @@ test binary-4.3 {Tcl_BinaryObjCmd: format} {
} \x80
test binary-4.4 {Tcl_BinaryObjCmd: format} {
binary format B* 010011
-} \x4C
+} \x4c
test binary-4.5 {Tcl_BinaryObjCmd: format} {
binary format B8 01001101
-} \x4D
+} \x4d
test binary-4.6 {Tcl_BinaryObjCmd: format} {
binary format A2X2B9 oo 01001101
-} \x4D\x00
+} \x4d\x00
test binary-4.7 {Tcl_BinaryObjCmd: format} {
binary format B9 010011011010
-} \x4D\x80
+} \x4d\x80
test binary-4.8 {Tcl_BinaryObjCmd: format} {
binary format B2B3 10 010
} \x80\x40
-test binary-4.9 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format B1B5 1 foo
-} -result {expected binary string but got "foo" instead}
+test binary-4.9 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format B1B5 1 foo} msg] $msg
+} {1 {expected binary string but got "foo" instead}}
-test binary-5.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format b
-} -result {not enough arguments for all format specifiers}
+test binary-5.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format b} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-5.2 {Tcl_BinaryObjCmd: format} {
binary format b0 1
} {}
@@ -194,26 +134,26 @@ test binary-5.4 {Tcl_BinaryObjCmd: format} {
} 2
test binary-5.5 {Tcl_BinaryObjCmd: format} {
binary format b8 01001101
-} \xB2
+} \xb2
test binary-5.6 {Tcl_BinaryObjCmd: format} {
binary format A2X2b9 oo 01001101
-} \xB2\x00
+} \xb2\x00
test binary-5.7 {Tcl_BinaryObjCmd: format} {
binary format b9 010011011010
-} \xB2\x01
+} \xb2\x01
test binary-5.8 {Tcl_BinaryObjCmd: format} {
binary format b17 1
-} \x01\x00\x00
+} \x01\00\00
test binary-5.9 {Tcl_BinaryObjCmd: format} {
binary format b2b3 10 010
} \x01\x02
-test binary-5.10 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format b1b5 1 foo
-} -result {expected binary string but got "foo" instead}
+test binary-5.10 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format b1b5 1 foo} msg] $msg
+} {1 {expected binary string but got "foo" instead}}
-test binary-6.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format h
-} -result {not enough arguments for all format specifiers}
+test binary-6.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format h} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-6.2 {Tcl_BinaryObjCmd: format} {
binary format h0 1
} {}
@@ -222,32 +162,32 @@ test binary-6.3 {Tcl_BinaryObjCmd: format} {
} \x01
test binary-6.4 {Tcl_BinaryObjCmd: format} {
binary format h c
-} \x0C
+} \x0c
test binary-6.5 {Tcl_BinaryObjCmd: format} {
binary format h* baadf00d
-} \xAB\xDA\x0F\xD0
+} \xab\xda\x0f\xd0
test binary-6.6 {Tcl_BinaryObjCmd: format} {
binary format h4 c410
-} \x4C\x01
+} \x4c\x01
test binary-6.7 {Tcl_BinaryObjCmd: format} {
binary format h6 c4102
-} \x4C\x01\x02
+} \x4c\x01\x02
test binary-6.8 {Tcl_BinaryObjCmd: format} {
binary format h5 c41020304
-} \x4C\x01\x02
+} \x4c\x01\x02
test binary-6.9 {Tcl_BinaryObjCmd: format} {
binary format a3X3h5 foo 2
} \x02\x00\x00
test binary-6.10 {Tcl_BinaryObjCmd: format} {
binary format h2h3 23 456
} \x32\x54\x06
-test binary-6.11 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format h2 foo
-} -result {expected hexadecimal string but got "foo" instead}
+test binary-6.11 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format h2 foo} msg] $msg
+} {1 {expected hexadecimal string but got "foo" instead}}
-test binary-7.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format H
-} -result {not enough arguments for all format specifiers}
+test binary-7.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format H} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-7.2 {Tcl_BinaryObjCmd: format} {
binary format H0 1
} {}
@@ -256,35 +196,35 @@ test binary-7.3 {Tcl_BinaryObjCmd: format} {
} \x10
test binary-7.4 {Tcl_BinaryObjCmd: format} {
binary format H c
-} \xC0
+} \xc0
test binary-7.5 {Tcl_BinaryObjCmd: format} {
binary format H* baadf00d
-} \xBA\xAD\xF0\x0D
+} \xba\xad\xf0\x0d
test binary-7.6 {Tcl_BinaryObjCmd: format} {
binary format H4 c410
-} \xC4\x10
+} \xc4\x10
test binary-7.7 {Tcl_BinaryObjCmd: format} {
binary format H6 c4102
-} \xC4\x10\x20
+} \xc4\x10\x20
test binary-7.8 {Tcl_BinaryObjCmd: format} {
binary format H5 c41023304
-} \xC4\x10\x20
+} \xc4\x10\x20
test binary-7.9 {Tcl_BinaryObjCmd: format} {
binary format a3X3H5 foo 2
} \x20\x00\x00
test binary-7.10 {Tcl_BinaryObjCmd: format} {
binary format H2H3 23 456
} \x23\x45\x60
-test binary-7.11 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format H2 foo
-} -result {expected hexadecimal string but got "foo" instead}
-
-test binary-8.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format c
-} -result {not enough arguments for all format specifiers}
-test binary-8.2 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format c blat
-} -result {expected integer but got "blat"}
+test binary-7.11 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format H2 foo} msg] $msg
+} {1 {expected hexadecimal string but got "foo" instead}}
+
+test binary-8.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format c} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
+test binary-8.2 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format c blat} msg] $msg
+} {1 {expected integer but got "blat"}}
test binary-8.3 {Tcl_BinaryObjCmd: format} {
binary format c0 0x50
} {}
@@ -303,24 +243,24 @@ test binary-8.7 {Tcl_BinaryObjCmd: format} {
test binary-8.8 {Tcl_BinaryObjCmd: format} {
binary format c* {0x50 0x52}
} PR
-test binary-8.9 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format c2 {0x50}
-} -result {number of elements in list does not match count}
-test binary-8.10 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
+test binary-8.9 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format c2 {0x50}} msg] $msg
+} {1 {number of elements in list does not match count}}
+test binary-8.10 {Tcl_BinaryObjCmd: format} {
set a {0x50 0x51}
- binary format c $a
-} -result "expected integer but got \"0x50 0x51\""
+ list [catch {binary format c $a} msg] $msg
+} [list 1 "expected integer but got \"0x50 0x51\""]
test binary-8.11 {Tcl_BinaryObjCmd: format} {
set a {0x50 0x51}
binary format c1 $a
} P
-test binary-9.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format s
-} -result {not enough arguments for all format specifiers}
-test binary-9.2 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format s blat
-} -result {expected integer but got "blat"}
+test binary-9.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format s} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
+test binary-9.2 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format s blat} msg] $msg
+} {1 {expected integer but got "blat"}}
test binary-9.3 {Tcl_BinaryObjCmd: format} {
binary format s0 0x50
} {}
@@ -342,24 +282,24 @@ test binary-9.8 {Tcl_BinaryObjCmd: format} {
test binary-9.9 {Tcl_BinaryObjCmd: format} {
binary format s2 {0x50 0x52 0x53} 0x54
} P\x00R\x00
-test binary-9.10 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format s2 {0x50}
-} -result {number of elements in list does not match count}
-test binary-9.11 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
+test binary-9.10 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format s2 {0x50}} msg] $msg
+} {1 {number of elements in list does not match count}}
+test binary-9.11 {Tcl_BinaryObjCmd: format} {
set a {0x50 0x51}
- binary format s $a
-} -result "expected integer but got \"0x50 0x51\""
+ list [catch {binary format s $a} msg] $msg
+} [list 1 "expected integer but got \"0x50 0x51\""]
test binary-9.12 {Tcl_BinaryObjCmd: format} {
set a {0x50 0x51}
binary format s1 $a
} P\x00
-test binary-10.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format S
-} -result {not enough arguments for all format specifiers}
-test binary-10.2 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format S blat
-} -result {expected integer but got "blat"}
+test binary-10.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format S} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
+test binary-10.2 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format S blat} msg] $msg
+} {1 {expected integer but got "blat"}}
test binary-10.3 {Tcl_BinaryObjCmd: format} {
binary format S0 0x50
} {}
@@ -381,24 +321,24 @@ test binary-10.8 {Tcl_BinaryObjCmd: format} {
test binary-10.9 {Tcl_BinaryObjCmd: format} {
binary format S2 {0x50 0x52 0x53} 0x54
} \x00P\x00R
-test binary-10.10 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format S2 {0x50}
-} -result {number of elements in list does not match count}
-test binary-10.11 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
+test binary-10.10 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format S2 {0x50}} msg] $msg
+} {1 {number of elements in list does not match count}}
+test binary-10.11 {Tcl_BinaryObjCmd: format} {
set a {0x50 0x51}
- binary format S $a
-} -result "expected integer but got \"0x50 0x51\""
+ list [catch {binary format S $a} msg] $msg
+} [list 1 "expected integer but got \"0x50 0x51\""]
test binary-10.12 {Tcl_BinaryObjCmd: format} {
set a {0x50 0x51}
binary format S1 $a
} \x00P
-test binary-11.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format i
-} -result {not enough arguments for all format specifiers}
-test binary-11.2 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format i blat
-} -result {expected integer but got "blat"}
+test binary-11.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format i} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
+test binary-11.2 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format i blat} msg] $msg
+} {1 {expected integer but got "blat"}}
test binary-11.3 {Tcl_BinaryObjCmd: format} {
binary format i0 0x50
} {}
@@ -423,24 +363,24 @@ test binary-11.9 {Tcl_BinaryObjCmd: format} {
test binary-11.10 {Tcl_BinaryObjCmd: format} {
binary format i* {0x50515253 0x52}
} SRQPR\x00\x00\x00
-test binary-11.11 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format i2 {0x50}
-} -result {number of elements in list does not match count}
-test binary-11.12 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
+test binary-11.11 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format i2 {0x50}} msg] $msg
+} {1 {number of elements in list does not match count}}
+test binary-11.12 {Tcl_BinaryObjCmd: format} {
set a {0x50 0x51}
- binary format i $a
-} -result "expected integer but got \"0x50 0x51\""
+ list [catch {binary format i $a} msg] $msg
+} [list 1 "expected integer but got \"0x50 0x51\""]
test binary-11.13 {Tcl_BinaryObjCmd: format} {
set a {0x50 0x51}
binary format i1 $a
} P\x00\x00\x00
-test binary-12.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format I
-} -result {not enough arguments for all format specifiers}
-test binary-12.2 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format I blat
-} -result {expected integer but got "blat"}
+test binary-12.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format I} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
+test binary-12.2 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format I blat} msg] $msg
+} {1 {expected integer but got "blat"}}
test binary-12.3 {Tcl_BinaryObjCmd: format} {
binary format I0 0x50
} {}
@@ -465,147 +405,135 @@ test binary-12.9 {Tcl_BinaryObjCmd: format} {
test binary-12.10 {Tcl_BinaryObjCmd: format} {
binary format I* {0x50515253 0x52}
} PQRS\x00\x00\x00R
-test binary-12.11 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format i2 {0x50}
-} -result {number of elements in list does not match count}
-test binary-12.12 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
+test binary-12.11 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format i2 {0x50}} msg] $msg
+} {1 {number of elements in list does not match count}}
+test binary-12.12 {Tcl_BinaryObjCmd: format} {
set a {0x50 0x51}
- binary format I $a
-} -result "expected integer but got \"0x50 0x51\""
+ list [catch {binary format I $a} msg] $msg
+} [list 1 "expected integer but got \"0x50 0x51\""]
test binary-12.13 {Tcl_BinaryObjCmd: format} {
set a {0x50 0x51}
binary format I1 $a
} \x00\x00\x00P
-test binary-13.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format f
-} -result {not enough arguments for all format specifiers}
-test binary-13.2 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format f blat
-} -result {expected floating-point number but got "blat"}
+test binary-13.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format f} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
+test binary-13.2 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format f blat} msg] $msg
+} {1 {expected floating-point number but got "blat"}}
test binary-13.3 {Tcl_BinaryObjCmd: format} {
binary format f0 1.6
} {}
test binary-13.4 {Tcl_BinaryObjCmd: format} bigEndian {
binary format f 1.6
-} \x3F\xCC\xCC\xCD
+} \x3f\xcc\xcc\xcd
test binary-13.5 {Tcl_BinaryObjCmd: format} littleEndian {
binary format f 1.6
-} \xCD\xCC\xCC\x3F
+} \xcd\xcc\xcc\x3f
test binary-13.6 {Tcl_BinaryObjCmd: format} bigEndian {
binary format f* {1.6 3.4}
-} \x3F\xCC\xCC\xCD\x40\x59\x99\x9A
+} \x3f\xcc\xcc\xcd\x40\x59\x99\x9a
test binary-13.7 {Tcl_BinaryObjCmd: format} littleEndian {
binary format f* {1.6 3.4}
-} \xCD\xCC\xCC\x3F\x9A\x99\x59\x40
+} \xcd\xcc\xcc\x3f\x9a\x99\x59\x40
test binary-13.8 {Tcl_BinaryObjCmd: format} bigEndian {
binary format f2 {1.6 3.4}
-} \x3F\xCC\xCC\xCD\x40\x59\x99\x9A
+} \x3f\xcc\xcc\xcd\x40\x59\x99\x9a
test binary-13.9 {Tcl_BinaryObjCmd: format} littleEndian {
binary format f2 {1.6 3.4}
-} \xCD\xCC\xCC\x3F\x9A\x99\x59\x40
+} \xcd\xcc\xcc\x3f\x9a\x99\x59\x40
test binary-13.10 {Tcl_BinaryObjCmd: format} bigEndian {
binary format f2 {1.6 3.4 5.6}
-} \x3F\xCC\xCC\xCD\x40\x59\x99\x9A
+} \x3f\xcc\xcc\xcd\x40\x59\x99\x9a
test binary-13.11 {Tcl_BinaryObjCmd: format} littleEndian {
binary format f2 {1.6 3.4 5.6}
-} \xCD\xCC\xCC\x3F\x9A\x99\x59\x40
+} \xcd\xcc\xcc\x3f\x9a\x99\x59\x40
test binary-13.12 {Tcl_BinaryObjCmd: float overflow} bigEndian {
binary format f -3.402825e+38
-} \xFF\x80\x00\x00
+} \xff\x7f\xff\xff
test binary-13.13 {Tcl_BinaryObjCmd: float overflow} littleEndian {
binary format f -3.402825e+38
-} \x00\x00\x80\xFF
+} \xff\xff\x7f\xff
test binary-13.14 {Tcl_BinaryObjCmd: float underflow} bigEndian {
binary format f -3.402825e-100
} \x80\x00\x00\x00
test binary-13.15 {Tcl_BinaryObjCmd: float underflow} littleEndian {
binary format f -3.402825e-100
} \x00\x00\x00\x80
-test binary-13.16 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format f2 {1.6}
-} -result {number of elements in list does not match count}
-test binary-13.17 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
+test binary-13.16 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format f2 {1.6}} msg] $msg
+} {1 {number of elements in list does not match count}}
+test binary-13.17 {Tcl_BinaryObjCmd: format} {
set a {1.6 3.4}
- binary format f $a
-} -result "expected floating-point number but got \"1.6 3.4\""
+ list [catch {binary format f $a} msg] $msg
+} [list 1 "expected floating-point number but got \"1.6 3.4\""]
test binary-13.18 {Tcl_BinaryObjCmd: format} bigEndian {
set a {1.6 3.4}
binary format f1 $a
-} \x3F\xCC\xCC\xCD
+} \x3f\xcc\xcc\xcd
test binary-13.19 {Tcl_BinaryObjCmd: format} littleEndian {
set a {1.6 3.4}
binary format f1 $a
-} \xCD\xCC\xCC\x3F
-test binary-13.20 {Tcl_BinaryObjCmd: format float Inf} bigEndian {
- binary format f Inf
-} \x7F\x80\x00\x00
-test binary-13.21 {Tcl_BinaryObjCmd: format float Inf} littleEndian {
- binary format f Inf
-} \x00\x00\x80\x7F
-test binary-13.22 {Tcl_BinaryObjCmd: format float -Inf} bigEndian {
- binary format f -Inf
-} \xFF\x80\x00\x00
-test binary-13.23 {Tcl_BinaryObjCmd: format float -Inf} littleEndian {
- binary format f -Inf
-} \x00\x00\x80\xFF
-
-test binary-14.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format d
-} -result {not enough arguments for all format specifiers}
-test binary-14.2 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format d blat
-} -result {expected floating-point number but got "blat"}
+} \xcd\xcc\xcc\x3f
+
+test binary-14.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format d} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
+test binary-14.2 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format d blat} msg] $msg
+} {1 {expected floating-point number but got "blat"}}
test binary-14.3 {Tcl_BinaryObjCmd: format} {
binary format d0 1.6
} {}
test binary-14.4 {Tcl_BinaryObjCmd: format} bigEndian {
binary format d 1.6
-} \x3F\xF9\x99\x99\x99\x99\x99\x9A
+} \x3f\xf9\x99\x99\x99\x99\x99\x9a
test binary-14.5 {Tcl_BinaryObjCmd: format} littleEndian {
binary format d 1.6
-} \x9A\x99\x99\x99\x99\x99\xF9\x3F
+} \x9a\x99\x99\x99\x99\x99\xf9\x3f
test binary-14.6 {Tcl_BinaryObjCmd: format} bigEndian {
binary format d* {1.6 3.4}
-} \x3F\xF9\x99\x99\x99\x99\x99\x9A\x40\x0B\x33\x33\x33\x33\x33\x33
+} \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33
test binary-14.7 {Tcl_BinaryObjCmd: format} littleEndian {
binary format d* {1.6 3.4}
-} \x9A\x99\x99\x99\x99\x99\xF9\x3F\x33\x33\x33\x33\x33\x33\x0B\x40
+} \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40
test binary-14.8 {Tcl_BinaryObjCmd: format} bigEndian {
binary format d2 {1.6 3.4}
-} \x3F\xF9\x99\x99\x99\x99\x99\x9A\x40\x0B\x33\x33\x33\x33\x33\x33
+} \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33
test binary-14.9 {Tcl_BinaryObjCmd: format} littleEndian {
binary format d2 {1.6 3.4}
-} \x9A\x99\x99\x99\x99\x99\xF9\x3F\x33\x33\x33\x33\x33\x33\x0B\x40
+} \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40
test binary-14.10 {Tcl_BinaryObjCmd: format} bigEndian {
binary format d2 {1.6 3.4 5.6}
-} \x3F\xF9\x99\x99\x99\x99\x99\x9A\x40\x0B\x33\x33\x33\x33\x33\x33
+} \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33
test binary-14.11 {Tcl_BinaryObjCmd: format} littleEndian {
binary format d2 {1.6 3.4 5.6}
-} \x9A\x99\x99\x99\x99\x99\xF9\x3F\x33\x33\x33\x33\x33\x33\x0B\x40
-test binary-14.14 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format d2 {1.6}
-} -result {number of elements in list does not match count}
-test binary-14.15 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
+} \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40
+test binary-14.14 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format d2 {1.6}} msg] $msg
+} {1 {number of elements in list does not match count}}
+test binary-14.15 {Tcl_BinaryObjCmd: format} {
set a {1.6 3.4}
- binary format d $a
-} -result "expected floating-point number but got \"1.6 3.4\""
+ list [catch {binary format d $a} msg] $msg
+} [list 1 "expected floating-point number but got \"1.6 3.4\""]
test binary-14.16 {Tcl_BinaryObjCmd: format} bigEndian {
set a {1.6 3.4}
binary format d1 $a
-} \x3F\xF9\x99\x99\x99\x99\x99\x9A
+} \x3f\xf9\x99\x99\x99\x99\x99\x9a
test binary-14.17 {Tcl_BinaryObjCmd: format} littleEndian {
set a {1.6 3.4}
binary format d1 $a
-} \x9A\x99\x99\x99\x99\x99\xF9\x3F
+} \x9a\x99\x99\x99\x99\x99\xf9\x3f
test binary-14.18 {FormatNumber: Bug 1116542} {
binary scan [binary format d 1.25] d w
set w
} 1.25
-test binary-15.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format ax*a "y" "z"
-} -result {cannot use "*" in format string with "x"}
+test binary-15.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format ax*a "y" "z"} msg] $msg
+} {1 {cannot use "*" in format string with "x"}}
test binary-15.2 {Tcl_BinaryObjCmd: format} {
binary format axa "y" "z"
} y\x00z
@@ -654,849 +582,810 @@ test binary-17.3 {Tcl_BinaryObjCmd: format} {
binary format {a* @0 a2 @* a*} "foobar" "ab" "blat"
} abobarblat
-test binary-18.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format u0a3 abc abd
-} -result {bad field specifier "u"}
+test binary-18.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format u0a3 abc abd} msg] $msg
+} {1 {bad field specifier "u"}}
-test binary-19.1 {Tcl_BinaryObjCmd: errors} -returnCodes error -body {
- binary s
-} -result {wrong # args: should be "binary scan value formatString ?varName ...?"}
-test binary-19.2 {Tcl_BinaryObjCmd: errors} -returnCodes error -body {
- binary scan foo
-} -result {wrong # args: should be "binary scan value formatString ?varName ...?"}
+
+test binary-19.1 {Tcl_BinaryObjCmd: errors} {
+ list [catch {binary s} msg] $msg
+} {1 {wrong # args: should be "binary scan value formatString ?varName varName ...?"}}
+test binary-19.2 {Tcl_BinaryObjCmd: errors} {
+ list [catch {binary scan foo} msg] $msg
+} {1 {wrong # args: should be "binary scan value formatString ?varName varName ...?"}}
test binary-19.3 {Tcl_BinaryObjCmd: scan} {
binary scan {} {}
} 0
-test binary-20.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc a
-} -result {not enough arguments for all format specifiers}
-test binary-20.2 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-20.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc a} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
+test binary-20.2 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan abc a arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
-test binary-20.3 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -body {
+ list [catch {binary scan abc a arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
+test binary-20.3 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 abc
list [binary scan abc a0 arg1] $arg1
-} -result {1 {}}
-test binary-20.4 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -body {
+} {1 {}}
+test binary-20.4 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
list [binary scan abc a* arg1] $arg1
-} -result {1 abc}
-test binary-20.5 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -body {
+} {1 abc}
+test binary-20.5 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
list [binary scan abc a5 arg1] [info exists arg1]
-} -result {0 0}
+} {0 0}
test binary-20.6 {Tcl_BinaryObjCmd: scan} {
set arg1 foo
list [binary scan abc a2 arg1] $arg1
} {1 ab}
-test binary-20.7 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
- unset -nocomplain arg2
-} -body {
+test binary-20.7 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
+ catch {unset arg2}
list [binary scan abcdef a2a2 arg1 arg2] $arg1 $arg2
-} -result {2 ab cd}
-test binary-20.8 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -body {
+} {2 ab cd}
+test binary-20.8 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
list [binary scan abc a2 arg1(a)] $arg1(a)
-} -result {1 ab}
-test binary-20.9 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -body {
+} {1 ab}
+test binary-20.9 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
list [binary scan abc a arg1(a)] $arg1(a)
-} -result {1 a}
-
-test binary-21.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc A
-} -result {not enough arguments for all format specifiers}
-test binary-21.2 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+} {1 a}
+
+test binary-21.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc A} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
+test binary-21.2 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan abc A arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
-test binary-21.3 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -body {
+ list [catch {binary scan abc A arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
+test binary-21.3 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 abc
list [binary scan abc A0 arg1] $arg1
-} -result {1 {}}
-test binary-21.4 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -body {
+} {1 {}}
+test binary-21.4 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
list [binary scan abc A* arg1] $arg1
-} -result {1 abc}
-test binary-21.5 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -body {
+} {1 abc}
+test binary-21.5 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
list [binary scan abc A5 arg1] [info exists arg1]
-} -result {0 0}
+} {0 0}
test binary-21.6 {Tcl_BinaryObjCmd: scan} {
set arg1 foo
list [binary scan abc A2 arg1] $arg1
} {1 ab}
-test binary-21.7 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
- unset -nocomplain arg2
-} -body {
+test binary-21.7 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
+ catch {unset arg2}
list [binary scan abcdef A2A2 arg1 arg2] $arg1 $arg2
-} -result {2 ab cd}
-test binary-21.8 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -body {
+} {2 ab cd}
+test binary-21.8 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
list [binary scan abc A2 arg1(a)] $arg1(a)
-} -result {1 ab}
-test binary-21.9 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -body {
+} {1 ab}
+test binary-21.9 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
list [binary scan abc A2 arg1(a)] $arg1(a)
-} -result {1 ab}
-test binary-21.10 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -body {
+} {1 ab}
+test binary-21.10 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
list [binary scan abc A arg1(a)] $arg1(a)
-} -result {1 a}
-test binary-21.11 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -body {
+} {1 a}
+test binary-21.11 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
list [binary scan "abc def \x00 " A* arg1] $arg1
-} -result {1 {abc def}}
-test binary-21.12 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -body {
+} {1 {abc def}}
+test binary-21.12 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
list [binary scan "abc def \x00ghi " A* arg1] $arg1
-} -result [list 1 "abc def \x00ghi"]
-test binary-21.13 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -body {
- list [binary scan "abc def \x00 " C* arg1] $arg1
-} -result {1 {abc def }}
-test binary-21.14 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -body {
- list [binary scan "abc def \x00ghi" C* arg1] $arg1
-} -result {1 {abc def }}
-test binary-22.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc b
-} -result {not enough arguments for all format specifiers}
+} [list 1 "abc def \x00ghi"]
+
+test binary-22.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc b} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-22.2 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x52\x53 b* arg1] $arg1
} {1 0100101011001010}
test binary-22.3 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x82\x53 b arg1] $arg1
} {1 0}
test binary-22.4 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x82\x53 b1 arg1] $arg1
} {1 0}
test binary-22.5 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x82\x53 b0 arg1] $arg1
} {1 {}}
test binary-22.6 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x52\x53 b5 arg1] $arg1
} {1 01001}
test binary-22.7 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x52\x53 b8 arg1] $arg1
} {1 01001010}
test binary-22.8 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x52\x53 b14 arg1] $arg1
} {1 01001010110010}
test binary-22.9 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 b14 arg1] $arg1
} {0 foo}
-test binary-22.10 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-22.10 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x52\x53 b1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
-test binary-22.11 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1 arg2
-} -body {
+ list [catch {binary scan \x52\x53 b1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
+test binary-22.11 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x07\x87\x05 b5b* arg1 arg2] $arg1 $arg2
-} -result {2 11100 1110000110100000}
+} {2 11100 1110000110100000}
-test binary-23.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc B
-} -result {not enough arguments for all format specifiers}
+
+test binary-23.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc B} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-23.2 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x52\x53 B* arg1] $arg1
} {1 0101001001010011}
test binary-23.3 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x82\x53 B arg1] $arg1
} {1 1}
test binary-23.4 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x82\x53 B1 arg1] $arg1
} {1 1}
test binary-23.5 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x52\x53 B0 arg1] $arg1
} {1 {}}
test binary-23.6 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x52\x53 B5 arg1] $arg1
} {1 01010}
test binary-23.7 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x52\x53 B8 arg1] $arg1
} {1 01010010}
test binary-23.8 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x52\x53 B14 arg1] $arg1
} {1 01010010010100}
test binary-23.9 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 B14 arg1] $arg1
} {0 foo}
-test binary-23.10 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-23.10 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x52\x53 B1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
-test binary-23.11 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1 arg2
-} -body {
+ list [catch {binary scan \x52\x53 B1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
+test binary-23.11 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x70\x87\x05 B5B* arg1 arg2] $arg1 $arg2
-} -result {2 01110 1000011100000101}
+} {2 01110 1000011100000101}
-test binary-24.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc h
-} -result {not enough arguments for all format specifiers}
+test binary-24.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc h} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-24.2 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 h* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 h* arg1] $arg1
} {1 253a}
test binary-24.3 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \xC2\xA3 h arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xc2\xa3 h arg1] $arg1
} {1 2}
test binary-24.4 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x82\x53 h1 arg1] $arg1
} {1 2}
test binary-24.5 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x52\x53 h0 arg1] $arg1
} {1 {}}
test binary-24.6 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \xF2\x53 h2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xf2\x53 h2 arg1] $arg1
} {1 2f}
test binary-24.7 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x52\x53 h3 arg1] $arg1
} {1 253}
test binary-24.8 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 h3 arg1] $arg1
} {0 foo}
-test binary-24.9 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-24.9 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x52\x53 h1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
-test binary-24.10 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1 arg2
-} -body {
+ list [catch {binary scan \x52\x53 h1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
+test binary-24.10 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x70\x87\x05 h2h* arg1 arg2] $arg1 $arg2
-} -result {2 07 7850}
+} {2 07 7850}
-test binary-25.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc H
-} -result {not enough arguments for all format specifiers}
+test binary-25.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc H} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-25.2 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 H* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 H* arg1] $arg1
} {1 52a3}
test binary-25.3 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \xC2\xA3 H arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xc2\xa3 H arg1] $arg1
} {1 c}
test binary-25.4 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x82\x53 H1 arg1] $arg1
} {1 8}
test binary-25.5 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x52\x53 H0 arg1] $arg1
} {1 {}}
test binary-25.6 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \xF2\x53 H2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xf2\x53 H2 arg1] $arg1
} {1 f2}
test binary-25.7 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x52\x53 H3 arg1] $arg1
} {1 525}
test binary-25.8 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 H3 arg1] $arg1
} {0 foo}
-test binary-25.9 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-25.9 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x52\x53 H1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
+ list [catch {binary scan \x52\x53 H1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
test binary-25.10 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x70\x87\x05 H2H* arg1 arg2] $arg1 $arg2
} {2 70 8705}
-test binary-26.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc c
-} -result {not enough arguments for all format specifiers}
+test binary-26.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc c} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-26.2 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 c* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 c* arg1] $arg1
} {1 {82 -93}}
test binary-26.3 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 c arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 c arg1] $arg1
} {1 82}
test binary-26.4 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 c1 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 c1 arg1] $arg1
} {1 82}
test binary-26.5 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 c0 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 c0 arg1] $arg1
} {1 {}}
test binary-26.6 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 c2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 c2 arg1] $arg1
} {1 {82 -93}}
test binary-26.7 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \xFF c arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xff c arg1] $arg1
} {1 -1}
test binary-26.8 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 c3 arg1] $arg1
} {0 foo}
-test binary-26.9 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-26.9 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x52\x53 c1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
+ list [catch {binary scan \x52\x53 c1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
test binary-26.10 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x70\x87\x05 c2c* arg1 arg2] $arg1 $arg2
} {2 {112 -121} 5}
test binary-26.11 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 cu* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 cu* arg1] $arg1
} {1 {82 163}}
test binary-26.12 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 cu arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 cu arg1] $arg1
} {1 82}
test binary-26.13 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \xFF cu arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xff cu arg1] $arg1
} {1 255}
test binary-26.14 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x80\x80 cuc arg1 arg2] $arg1 $arg2
} {2 128 -128}
test binary-26.15 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x80\x80 ccu arg1 arg2] $arg1 $arg2
} {2 -128 128}
-test binary-27.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc s
-} -result {not enough arguments for all format specifiers}
+test binary-27.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc s} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-27.2 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 s* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 s* arg1] $arg1
} {1 {-23726 21587}}
test binary-27.3 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 s arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 s arg1] $arg1
} {1 -23726}
test binary-27.4 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 s1 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 s1 arg1] $arg1
} {1 -23726}
test binary-27.5 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 s0 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 s0 arg1] $arg1
} {1 {}}
test binary-27.6 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 s2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 s2 arg1] $arg1
} {1 {-23726 21587}}
test binary-27.7 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 s1 arg1] $arg1
} {0 foo}
-test binary-27.8 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-27.8 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x52\x53 s1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
+ list [catch {binary scan \x52\x53 s1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
test binary-27.9 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \x52\xA3\x53\x54\x05 s2c* arg1 arg2] $arg1 $arg2
+ list [binary scan \x52\xa3\x53\x54\x05 s2c* arg1 arg2] $arg1 $arg2
} {2 {-23726 21587} 5}
test binary-27.10 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 su* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 su* arg1] $arg1
} {1 {41810 21587}}
test binary-27.11 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \xFF\xFF\xFF\xFF sus arg1 arg2] $arg1 $arg2
+ list [binary scan \xff\xff\xff\xff sus arg1 arg2] $arg1 $arg2
} {2 65535 -1}
test binary-27.12 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \xFF\xFF\xFF\xFF ssu arg1 arg2] $arg1 $arg2
+ list [binary scan \xff\xff\xff\xff ssu arg1 arg2] $arg1 $arg2
} {2 -1 65535}
-test binary-28.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc S
-} -result {not enough arguments for all format specifiers}
+test binary-28.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc S} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-28.2 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 S* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 S* arg1] $arg1
} {1 {21155 21332}}
test binary-28.3 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 S arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 S arg1] $arg1
} {1 21155}
test binary-28.4 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 S1 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 S1 arg1] $arg1
} {1 21155}
test binary-28.5 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 S0 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 S0 arg1] $arg1
} {1 {}}
test binary-28.6 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 S2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 S2 arg1] $arg1
} {1 {21155 21332}}
test binary-28.7 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 S1 arg1] $arg1
} {0 foo}
-test binary-28.8 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-28.8 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x52\x53 S1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
+ list [catch {binary scan \x52\x53 S1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
test binary-28.9 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \x52\xA3\x53\x54\x05 S2c* arg1 arg2] $arg1 $arg2
+ list [binary scan \x52\xa3\x53\x54\x05 S2c* arg1 arg2] $arg1 $arg2
} {2 {21155 21332} 5}
test binary-28.10 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 Su* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 Su* arg1] $arg1
} {1 {21155 21332}}
test binary-28.11 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \xA3\x52\x54\x53 Su* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xa3\x52\x54\x53 Su* arg1] $arg1
} {1 {41810 21587}}
-test binary-29.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc i
-} -result {not enough arguments for all format specifiers}
+test binary-29.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc i} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-29.2 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04 i* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 i* arg1] $arg1
} {1 {1414767442 67305985}}
test binary-29.3 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04 i arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 i arg1] $arg1
} {1 1414767442}
test binary-29.4 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 i1 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 i1 arg1] $arg1
} {1 1414767442}
test binary-29.5 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53 i0 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53 i0 arg1] $arg1
} {1 {}}
test binary-29.6 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04 i2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 i2 arg1] $arg1
} {1 {1414767442 67305985}}
test binary-29.7 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 i1 arg1] $arg1
} {0 foo}
-test binary-29.8 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-29.8 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x52\x53\x53\x54 i1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
+ list [catch {binary scan \x52\x53\x53\x54 i1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
test binary-29.9 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04\x05 i2c* arg1 arg2] $arg1 $arg2
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04\x05 i2c* arg1 arg2] $arg1 $arg2
} {2 {1414767442 67305985} 5}
test binary-29.10 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
- list [binary scan \xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF iui arg1 arg2] $arg1 $arg2
+ catch {unset arg1 arg2}
+ list [binary scan \xff\xff\xff\xff\xff\xff\xff\xff iui arg1 arg2] $arg1 $arg2
} {2 4294967295 -1}
test binary-29.11 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
- list [binary scan \xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF iiu arg1 arg2] $arg1 $arg2
+ catch {unset arg1 arg2}
+ list [binary scan \xff\xff\xff\xff\xff\xff\xff\xff iiu arg1 arg2] $arg1 $arg2
} {2 -1 4294967295}
test binary-29.12 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
list [binary scan \x80\x00\x00\x00\x00\x00\x00\x80 iuiu arg1 arg2] $arg1 $arg2
} {2 128 2147483648}
-test binary-30.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc I
-} -result {not enough arguments for all format specifiers}
+test binary-30.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc I} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-30.2 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04 I* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 I* arg1] $arg1
} {1 {1386435412 16909060}}
test binary-30.3 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04 I arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 I arg1] $arg1
} {1 1386435412}
test binary-30.4 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 I1 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 I1 arg1] $arg1
} {1 1386435412}
test binary-30.5 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53 I0 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53 I0 arg1] $arg1
} {1 {}}
test binary-30.6 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04 I2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 I2 arg1] $arg1
} {1 {1386435412 16909060}}
test binary-30.7 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 I1 arg1] $arg1
} {0 foo}
-test binary-30.8 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-30.8 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x52\x53\x53\x54 I1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
+ list [catch {binary scan \x52\x53\x53\x54 I1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
test binary-30.9 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04\x05 I2c* arg1 arg2] $arg1 $arg2
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04\x05 I2c* arg1 arg2] $arg1 $arg2
} {2 {1386435412 16909060} 5}
test binary-30.10 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
- list [binary scan \xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF IuI arg1 arg2] $arg1 $arg2
+ catch {unset arg1 arg2}
+ list [binary scan \xff\xff\xff\xff\xff\xff\xff\xff IuI arg1 arg2] $arg1 $arg2
} {2 4294967295 -1}
test binary-30.11 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
- list [binary scan \xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF IIu arg1 arg2] $arg1 $arg2
+ catch {unset arg1 arg2}
+ list [binary scan \xff\xff\xff\xff\xff\xff\xff\xff IIu arg1 arg2] $arg1 $arg2
} {2 -1 4294967295}
test binary-30.12 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
list [binary scan \x80\x00\x00\x00\x00\x00\x00\x80 IuIu arg1 arg2] $arg1 $arg2
} {2 2147483648 128}
-test binary-31.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc f
-} -result {not enough arguments for all format specifiers}
+test binary-31.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc f} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-31.2 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xCC\xCC\xCD\x40\x59\x99\x9A f* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a f* arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-31.3 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \xCD\xCC\xCC\x3F\x9A\x99\x59\x40 f* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 f* arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-31.4 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xCC\xCC\xCD\x40\x59\x99\x9A f arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a f arg1] $arg1
} {1 1.600000023841858}
test binary-31.5 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \xCD\xCC\xCC\x3F\x9A\x99\x59\x40 f arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 f arg1] $arg1
} {1 1.600000023841858}
test binary-31.6 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xCC\xCC\xCD f1 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xcc\xcc\xcd f1 arg1] $arg1
} {1 1.600000023841858}
test binary-31.7 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \xCD\xCC\xCC\x3F f1 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xcd\xcc\xcc\x3f f1 arg1] $arg1
} {1 1.600000023841858}
test binary-31.8 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xCC\xCC\xCD f0 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xcc\xcc\xcd f0 arg1] $arg1
} {1 {}}
test binary-31.9 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \xCD\xCC\xCC\x3F f0 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xcd\xcc\xcc\x3f f0 arg1] $arg1
} {1 {}}
test binary-31.10 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xCC\xCC\xCD\x40\x59\x99\x9A f2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a f2 arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-31.11 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \xCD\xCC\xCC\x3F\x9A\x99\x59\x40 f2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 f2 arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-31.12 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 f1 arg1] $arg1
} {0 foo}
-test binary-31.13 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-31.13 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x3F\xCC\xCC\xCD f1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
+ list [catch {binary scan \x3f\xcc\xcc\xcd f1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
test binary-31.14 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \x3F\xCC\xCC\xCD\x40\x59\x99\x9A\x05 f2c* arg1 arg2] $arg1 $arg2
+ list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a\x05 f2c* arg1 arg2] $arg1 $arg2
} {2 {1.600000023841858 3.4000000953674316} 5}
test binary-31.15 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \xCD\xCC\xCC\x3F\x9A\x99\x59\x40\x05 f2c* arg1 arg2] $arg1 $arg2
+ list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40\x05 f2c* arg1 arg2] $arg1 $arg2
} {2 {1.600000023841858 3.4000000953674316} 5}
-test binary-32.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc d
-} -result {not enough arguments for all format specifiers}
+test binary-32.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc d} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-32.2 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xF9\x99\x99\x99\x99\x99\x9A\x40\x0B\x33\x33\x33\x33\x33\x33 d* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33 d* arg1] $arg1
} {1 {1.6 3.4}}
test binary-32.3 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x9A\x99\x99\x99\x99\x99\xF9\x3F\x33\x33\x33\x33\x33\x33\x0B\x40 d* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40 d* arg1] $arg1
} {1 {1.6 3.4}}
test binary-32.4 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xF9\x99\x99\x99\x99\x99\x9A\x40\x0B\x33\x33\x33\x33\x33\x33 d arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33 d arg1] $arg1
} {1 1.6}
test binary-32.5 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x9A\x99\x99\x99\x99\x99\xF9\x3F\x33\x33\x33\x33\x33\x33\x0B\x40 d arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40 d arg1] $arg1
} {1 1.6}
test binary-32.6 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xF9\x99\x99\x99\x99\x99\x9A d1 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a d1 arg1] $arg1
} {1 1.6}
test binary-32.7 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x9A\x99\x99\x99\x99\x99\xF9\x3F d1 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f d1 arg1] $arg1
} {1 1.6}
test binary-32.8 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xF9\x99\x99\x99\x99\x99\x9A d0 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a d0 arg1] $arg1
} {1 {}}
test binary-32.9 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x9A\x99\x99\x99\x99\x99\xF9\x3F d0 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f d0 arg1] $arg1
} {1 {}}
test binary-32.10 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xF9\x99\x99\x99\x99\x99\x9A\x40\x0B\x33\x33\x33\x33\x33\x33 d2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33 d2 arg1] $arg1
} {1 {1.6 3.4}}
test binary-32.11 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x9A\x99\x99\x99\x99\x99\xF9\x3F\x33\x33\x33\x33\x33\x33\x0B\x40 d2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40 d2 arg1] $arg1
} {1 {1.6 3.4}}
test binary-32.12 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 d1 arg1] $arg1
} {0 foo}
-test binary-32.13 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-32.13 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x3F\xF9\x99\x99\x99\x99\x99\x9A d1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
+ list [catch {binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a d1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
test binary-32.14 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- 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
+ 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
} {2 {1.6 3.4} 5}
test binary-32.15 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- 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
+ 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
} {2 {1.6 3.4} 5}
test binary-33.1 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- unset -nocomplain arg2
+ catch {unset arg1}
+ catch {unset arg2}
list [binary scan abcdefg a2xa3 arg1 arg2] $arg1 $arg2
} {2 ab def}
test binary-33.2 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- unset -nocomplain arg2
+ catch {unset arg1}
+ catch {unset arg2}
set arg2 foo
list [binary scan abcdefg a3x*a3 arg1 arg2] $arg1 $arg2
} {1 abc foo}
test binary-33.3 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- unset -nocomplain arg2
+ catch {unset arg1}
+ catch {unset arg2}
set arg2 foo
list [binary scan abcdefg a3x20a3 arg1 arg2] $arg1 $arg2
} {1 abc foo}
test binary-33.4 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- unset -nocomplain arg2
+ catch {unset arg1}
+ catch {unset arg2}
set arg2 foo
list [binary scan abc a3x20a3 arg1 arg2] $arg1 $arg2
} {1 abc foo}
test binary-33.5 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan abcdef x1a1 arg1] $arg1
} {1 b}
test binary-33.6 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan abcdef x5a1 arg1] $arg1
} {1 f}
test binary-33.7 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan abcdef x0a1 arg1] $arg1
} {1 a}
test binary-34.1 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- unset -nocomplain arg2
+ catch {unset arg1}
+ catch {unset arg2}
list [binary scan abcdefg a2Xa3 arg1 arg2] $arg1 $arg2
} {2 ab bcd}
test binary-34.2 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- unset -nocomplain arg2
+ catch {unset arg1}
+ catch {unset arg2}
set arg2 foo
list [binary scan abcdefg a3X*a3 arg1 arg2] $arg1 $arg2
} {2 abc abc}
test binary-34.3 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- unset -nocomplain arg2
+ catch {unset arg1}
+ catch {unset arg2}
set arg2 foo
list [binary scan abcdefg a3X20a3 arg1 arg2] $arg1 $arg2
} {2 abc abc}
test binary-34.4 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan abc X20a3 arg1] $arg1
} {1 abc}
test binary-34.5 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan abcdef x*X1a1 arg1] $arg1
} {1 f}
test binary-34.6 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan abcdef x*X5a1 arg1] $arg1
} {1 b}
test binary-34.7 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan abcdef x3X0a1 arg1] $arg1
} {1 d}
-test binary-35.1 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
- unset -nocomplain arg2
-} -returnCodes error -body {
- binary scan abcdefg a2@a3 arg1 arg2
-} -result {missing count for "@" field specifier}
+test binary-35.1 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
+ catch {unset arg2}
+ list [catch {binary scan abcdefg a2@a3 arg1 arg2} msg] $msg
+} {1 {missing count for "@" field specifier}}
test binary-35.2 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- unset -nocomplain arg2
+ catch {unset arg1}
+ catch {unset arg2}
set arg2 foo
list [binary scan abcdefg a3@*a3 arg1 arg2] $arg1 $arg2
} {1 abc foo}
test binary-35.3 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
- unset -nocomplain arg2
+ catch {unset arg1}
+ catch {unset arg2}
set arg2 foo
list [binary scan abcdefg a3@20a3 arg1 arg2] $arg1 $arg2
} {1 abc foo}
test binary-35.4 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan abcdef @2a3 arg1] $arg1
} {1 cde}
test binary-35.5 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan abcdef x*@1a1 arg1] $arg1
} {1 b}
test binary-35.6 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan abcdef x*@0a1 arg1] $arg1
} {1 a}
-test binary-36.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abcdef u0a3
-} -result {bad field specifier "u"}
+test binary-36.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abcdef u0a3} msg] $msg
+} {1 {bad field specifier "u"}}
-# GetFormatSpec is pretty thoroughly tested above, but there are a few cases
-# we should text explicitly
+# GetFormatSpec is pretty thoroughly tested above, but there are a few
+# cases we should text explicitly
test binary-37.1 {GetFormatSpec: whitespace} {
binary format "a3 a5 a3" foo barblat baz
@@ -1516,11 +1405,11 @@ test binary-37.5 {GetFormatSpec: whitespace} {
test binary-37.6 {GetFormatSpec: whitespace} {
binary format " a3 " foo
} foo
-test binary-37.7 {GetFormatSpec: numbers} -returnCodes error -body {
- binary scan abcdef "x-1" foo
-} -result {bad field specifier "-"}
+test binary-37.7 {GetFormatSpec: numbers} {
+ list [catch {binary scan abcdef "x-1" foo} msg] $msg
+} {1 {bad field specifier "-"}}
test binary-37.8 {GetFormatSpec: numbers} {
- unset -nocomplain arg1
+ catch {unset arg1}
set arg1 foo
list [binary scan abcdef "a0x3" arg1] $arg1
} {1 {}}
@@ -1531,18 +1420,6 @@ test binary-37.9 {GetFormatSpec: numbers} {
binary scan $x f* bla
set bla
} {1.0 -1.0 2.0 -2.0 0.0}
-test binary-37.10 {GetFormatSpec: count overflow} {
- binary scan x a[format %ld 0x7fffffff] r
-} 0
-test binary-37.11 {GetFormatSpec: count overflow} {
- binary scan x a[format %ld 0x10000000] r
-} 0
-test binary-37.12 {GetFormatSpec: count overflow} {
- binary scan x a[format %ld 0x100000000] r
-} 0
-test binary-37.13 {GetFormatSpec: count overflow} {
- binary scan x a[format %lld 0x10000000000000000] r
-} 0
test binary-38.1 {FormatNumber: word alignment} {
set x [binary format c1s1 1 1]
@@ -1558,111 +1435,111 @@ test binary-38.4 {FormatNumber: word alignment} {
} \x01\x00\x00\x00\x01
test binary-38.5 {FormatNumber: word alignment} bigEndian {
set x [binary format c1d1 1 1.6]
-} \x01\x3F\xF9\x99\x99\x99\x99\x99\x9A
+} \x01\x3f\xf9\x99\x99\x99\x99\x99\x9a
test binary-38.6 {FormatNumber: word alignment} littleEndian {
set x [binary format c1d1 1 1.6]
-} \x01\x9A\x99\x99\x99\x99\x99\xF9\x3F
+} \x01\x9a\x99\x99\x99\x99\x99\xf9\x3f
test binary-38.7 {FormatNumber: word alignment} bigEndian {
set x [binary format c1f1 1 1.6]
-} \x01\x3F\xCC\xCC\xCD
+} \x01\x3f\xcc\xcc\xcd
test binary-38.8 {FormatNumber: word alignment} littleEndian {
set x [binary format c1f1 1 1.6]
-} \x01\xCD\xCC\xCC\x3F
+} \x01\xcd\xcc\xcc\x3f
test binary-39.1 {ScanNumber: sign extension} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 c2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 c2 arg1] $arg1
} {1 {82 -93}}
test binary-39.2 {ScanNumber: sign extension} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x01\x02\x01\x81\x82\x01\x81\x82 s4 arg1] $arg1
} {1 {513 -32511 386 -32127}}
test binary-39.3 {ScanNumber: sign extension} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x01\x02\x01\x81\x82\x01\x81\x82 S4 arg1] $arg1
} {1 {258 385 -32255 -32382}}
test binary-39.4 {ScanNumber: sign extension} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x01\x01\x01\x02\x81\x01\x01\x01\x01\x82\x01\x01\x01\x01\x82\x01\x01\x01\x01\x81 i5 arg1] $arg1
} {1 {33620225 16843137 16876033 25297153 -2130640639}}
test binary-39.5 {ScanNumber: sign extension} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x01\x01\x01\x02\x81\x01\x01\x01\x01\x82\x01\x01\x01\x01\x82\x01\x01\x01\x01\x81 I5 arg1] $arg1
} {1 {16843010 -2130640639 25297153 16876033 16843137}}
test binary-39.6 {ScanNumber: no sign extension} {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 cu2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 cu2 arg1] $arg1
} {1 {82 163}}
test binary-39.7 {ScanNumber: no sign extension} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x01\x02\x01\x81\x82\x01\x81\x82 su4 arg1] $arg1
} {1 {513 33025 386 33409}}
test binary-39.8 {ScanNumber: no sign extension} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x01\x02\x01\x81\x82\x01\x81\x82 Su4 arg1] $arg1
} {1 {258 385 33281 33154}}
test binary-39.9 {ScanNumber: no sign extension} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x01\x01\x01\x02\x81\x01\x01\x01\x01\x82\x01\x01\x01\x01\x82\x01\x01\x01\x01\x81 iu5 arg1] $arg1
} {1 {33620225 16843137 16876033 25297153 2164326657}}
test binary-39.10 {ScanNumber: no sign extension} {
- unset -nocomplain arg1
+ catch {unset arg1}
list [binary scan \x01\x01\x01\x02\x81\x01\x01\x01\x01\x82\x01\x01\x01\x01\x82\x01\x01\x01\x01\x81 Iu5 arg1] $arg1
} {1 {16843010 2164326657 25297153 16876033 16843137}}
-test binary-40.3 {ScanNumber: NaN} -body {
- unset -nocomplain arg1
- list [binary scan \xFF\xFF\xFF\xFF f1 arg1] $arg1
-} -match glob -result {1 -NaN*}
-test binary-40.4 {ScanNumber: NaN} -body {
- unset -nocomplain arg1
- list [binary scan \xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF d arg1] $arg1
-} -match glob -result {1 -NaN*}
-
-test binary-41.1 {ScanNumber: word alignment} -setup {
- unset -nocomplain arg1 arg2
-} -body {
+test binary-40.3 {ScanNumber: NaN} \
+ -body {
+ catch {unset arg1}
+ list [binary scan \xff\xff\xff\xff f1 arg1] $arg1
+ } \
+ -match glob \
+ -result {1 -NaN*}
+
+test binary-40.4 {ScanNumber: NaN} \
+ -body {
+ catch {unset arg1}
+ list [binary scan \xff\xff\xff\xff\xff\xff\xff\xff d arg1] $arg1
+ } \
+ -match glob \
+ -result {1 -NaN*}
+
+test binary-41.1 {ScanNumber: word alignment} {
+ catch {unset arg1; unset arg2}
list [binary scan \x01\x01\x00 c1s1 arg1 arg2] $arg1 $arg2
-} -result {2 1 1}
-test binary-41.2 {ScanNumber: word alignment} -setup {
- unset -nocomplain arg1 arg2
-} -body {
+} {2 1 1}
+test binary-41.2 {ScanNumber: word alignment} {
+ catch {unset arg1; unset arg2}
list [binary scan \x01\x00\x01 c1S1 arg1 arg2] $arg1 $arg2
-} -result {2 1 1}
-test binary-41.3 {ScanNumber: word alignment} -setup {
- unset -nocomplain arg1 arg2
-} -body {
+} {2 1 1}
+test binary-41.3 {ScanNumber: word alignment} {
+ catch {unset arg1; unset arg2}
list [binary scan \x01\x01\x00\x00\x00 c1i1 arg1 arg2] $arg1 $arg2
-} -result {2 1 1}
-test binary-41.4 {ScanNumber: word alignment} -setup {
- unset -nocomplain arg1 arg2
-} -body {
+} {2 1 1}
+test binary-41.4 {ScanNumber: word alignment} {
+ catch {unset arg1; unset arg2}
list [binary scan \x01\x00\x00\x00\x01 c1I1 arg1 arg2] $arg1 $arg2
-} -result {2 1 1}
-test binary-41.5 {ScanNumber: word alignment} -setup {
- unset -nocomplain arg1 arg2
-} -constraints bigEndian -body {
- list [binary scan \x01\x3F\xCC\xCC\xCD c1f1 arg1 arg2] $arg1 $arg2
-} -result {2 1 1.600000023841858}
-test binary-41.6 {ScanNumber: word alignment} -setup {
- unset -nocomplain arg1 arg2
-} -constraints littleEndian -body {
- list [binary scan \x01\xCD\xCC\xCC\x3F c1f1 arg1 arg2] $arg1 $arg2
-} -result {2 1 1.600000023841858}
-test binary-41.7 {ScanNumber: word alignment} -setup {
- unset -nocomplain arg1 arg2
-} -constraints bigEndian -body {
- list [binary scan \x01\x3F\xF9\x99\x99\x99\x99\x99\x9A c1d1 arg1 arg2] $arg1 $arg2
-} -result {2 1 1.6}
-test binary-41.8 {ScanNumber: word alignment} -setup {
- unset -nocomplain arg1 arg2
-} -constraints littleEndian -body {
- list [binary scan \x01\x9A\x99\x99\x99\x99\x99\xF9\x3F c1d1 arg1 arg2] $arg1 $arg2
-} -result {2 1 1.6}
-
-test binary-42.1 {Tcl_BinaryObjCmd: bad arguments} -constraints {} -body {
- binary ?
-} -returnCodes error -match glob -result {unknown or ambiguous subcommand "?": *}
+} {2 1 1}
+test binary-41.5 {ScanNumber: word alignment} bigEndian {
+ catch {unset arg1; unset arg2}
+ list [binary scan \x01\x3f\xcc\xcc\xcd c1f1 arg1 arg2] $arg1 $arg2
+} {2 1 1.600000023841858}
+test binary-41.6 {ScanNumber: word alignment} littleEndian {
+ catch {unset arg1; unset arg2}
+ list [binary scan \x01\xcd\xcc\xcc\x3f c1f1 arg1 arg2] $arg1 $arg2
+} {2 1 1.600000023841858}
+test binary-41.7 {ScanNumber: word alignment} bigEndian {
+ catch {unset arg1; unset arg2}
+ list [binary scan \x01\x3f\xf9\x99\x99\x99\x99\x99\x9a c1d1 arg1 arg2] $arg1 $arg2
+} {2 1 1.6}
+test binary-41.8 {ScanNumber: word alignment} littleEndian {
+ catch {unset arg1; unset arg2}
+ list [binary scan \x01\x9a\x99\x99\x99\x99\x99\xf9\x3f c1d1 arg1 arg2] $arg1 $arg2
+} {2 1 1.6}
+
+test binary-42.1 {Tcl_BinaryObjCmd: bad arguments} {} {
+ catch {binary ?} result
+ set result
+} {bad option "?": must be format or scan}
# Wide int (guaranteed at least 64-bit) handling
test binary-43.1 {Tcl_BinaryObjCmd: format wide int} {} {
@@ -1672,27 +1549,6 @@ test binary-43.2 {Tcl_BinaryObjCmd: format wide int} {} {
binary format W 7810179016327718216
} lcTolleH
-test binary-43.5 {Tcl_BinaryObjCmd: scan wide int} {} {
- unset -nocomplain arg1
- list [binary scan \x80[string repeat \x00 7] W arg1] $arg1
-} {1 -9223372036854775808}
-test binary-43.6 {Tcl_BinaryObjCmd: scan unsigned wide int} {} {
- unset -nocomplain arg1
- list [binary scan \x80[string repeat \x00 7] Wu arg1] $arg1
-} {1 9223372036854775808}
-test binary-43.7 {Tcl_BinaryObjCmd: scan unsigned wide int} {} {
- unset -nocomplain arg1
- list [binary scan [string repeat \x00 7]\x80 wu arg1] $arg1
-} {1 9223372036854775808}
-test binary-43.8 {Tcl_BinaryObjCmd: scan unsigned wide int} {} {
- unset -nocomplain arg1 arg2
- list [binary scan \x80[string repeat \x00 7]\x80[string repeat \x00 7] WuW arg1 arg2] $arg1 $arg2
-} {2 9223372036854775808 -9223372036854775808}
-test binary-43.9 {Tcl_BinaryObjCmd: scan unsigned wide int} {} {
- unset -nocomplain arg1 arg2
- list [binary scan [string repeat \x00 7]\x80[string repeat \x00 7]\x80 wuw arg1 arg2] $arg1 $arg2
-} {2 9223372036854775808 -9223372036854775808}
-
test binary-44.1 {Tcl_BinaryObjCmd: scan wide int} {} {
binary scan HelloTcl W x
set x
@@ -1709,14 +1565,26 @@ test binary-44.4 {Tcl_BinaryObjCmd: scan wide int with bit 31 set} {} {
binary scan [binary format W [expr {wide(3) << 31}]] W x
set x
} 6442450944
-test binary-44.5 {Tcl_BinaryObjCmd: scan wide int with bit 31 and 64 set} {} {
- binary scan [binary format w [expr {(wide(3) << 31) + (wide(3) << 64)}]] w x
- set x
-} 6442450944
-test binary-44.6 {Tcl_BinaryObjCmd: scan wide int with bit 31 and 64 set} {} {
- binary scan [binary format W [expr {(wide(3) << 31) + (wide(3) << 64)}]] W x
- set x
-} 6442450944
+test binary-43.5 {Tcl_BinaryObjCmd: scan wide int} {} {
+ catch {unset arg1}
+ list [binary scan \x80[string repeat \x00 7] W arg1] $arg1
+} {1 -9223372036854775808}
+test binary-43.6 {Tcl_BinaryObjCmd: scan unsigned wide int} {} {
+ catch {unset arg1}
+ list [binary scan \x80[string repeat \x00 7] Wu arg1] $arg1
+} {1 9223372036854775808}
+test binary-43.7 {Tcl_BinaryObjCmd: scan unsigned wide int} {} {
+ catch {unset arg1}
+ list [binary scan [string repeat \x00 7]\x80 wu arg1] $arg1
+} {1 9223372036854775808}
+test binary-43.8 {Tcl_BinaryObjCmd: scan unsigned wide int} {} {
+ catch {unset arg1 arg2}
+ list [binary scan \x80[string repeat \x00 7]\x80[string repeat \x00 7] WuW arg1 arg2] $arg1 $arg2
+} {2 9223372036854775808 -9223372036854775808}
+test binary-43.9 {Tcl_BinaryObjCmd: scan unsigned wide int} {} {
+ catch {unset arg1 arg2}
+ list [binary scan [string repeat \x00 7]\x80[string repeat \x00 7]\x80 wuw arg1 arg2] $arg1 $arg2
+} {2 9223372036854775808 -9223372036854775808}
test binary-45.1 {Tcl_BinaryObjCmd: combined wide int handling} {
binary scan [binary format sws 16450 -1 19521] c* x
@@ -1728,44 +1596,44 @@ test binary-45.2 {Tcl_BinaryObjCmd: combined wide int handling} {
} {66 64 0 0 0 0 127 -1 -1 -1 65 76}
test binary-46.1 {Tcl_BinaryObjCmd: handling of non-ISO8859-1 chars} {
- binary format a* €
-} \xAC
+ binary format a* \u20ac
+} \u00ac
test binary-46.2 {Tcl_BinaryObjCmd: handling of non-ISO8859-1 chars} {
- list [binary scan [binary format a* €₽] s x] $x
+ list [binary scan [binary format a* \u20ac\u20bd] s x] $x
} {1 -16980}
test binary-46.3 {Tcl_BinaryObjCmd: handling of non-ISO8859-1 chars} {
set x {}
set y {}
set z {}
- list [binary scan [binary format a* €₽] aaa x y z] $x $y $z
-} "2 \xAC \xBD {}"
+ list [binary scan [binary format a* \u20ac\u20bd] aaa x y z] $x $y $z
+} "2 \u00ac \u00bd {}"
test binary-46.4 {Tcl_BinaryObjCmd: handling of non-ISO8859-1 chars} {
- set x [encoding convertto iso8859-15 €]
+ set x [encoding convertto iso8859-15 \u20ac]
set y [binary format a* $x]
list $x $y
-} "\xA4 \xA4"
+} "\u00a4 \u00a4"
test binary-46.5 {Tcl_BinaryObjCmd: handling of non-ISO8859-1 chars} {
- set x [binary scan \xA4 a* y]
+ set x [binary scan \u00a4 a* y]
list $x $y [encoding convertfrom iso8859-15 $y]
-} "1 \xA4 €"
+} "1 \u00a4 \u20ac"
test binary-47.1 {Tcl_BinaryObjCmd: number cache reference count handling} {
- # This test is only reliable when memory debugging is turned on, but
- # without even memory debugging it should still generate the expected
- # answers and might therefore still pick up memory corruption caused by
- # [Bug 851747].
+ # This test is only reliable when memory debugging is turned on,
+ # but without even memory debugging it should still generate the
+ # expected answers and might therefore still pick up memory corruption
+ # caused by [Bug 851747].
list [binary scan aba ccc x x x] $x
} {3 97}
### TIP#129: endian specifiers ----
# format t
-test binary-48.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format t
-} -result {not enough arguments for all format specifiers}
-test binary-48.2 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format t blat
-} -result {expected integer but got "blat"}
+test binary-48.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format t} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
+test binary-48.2 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format t blat} msg] $msg
+} {1 {expected integer but got "blat"}}
test binary-48.3 {Tcl_BinaryObjCmd: format} {
binary format S0 0x50
} {}
@@ -1793,10 +1661,10 @@ test binary-48.10 {Tcl_BinaryObjCmd: format} bigEndian {
test binary-48.11 {Tcl_BinaryObjCmd: format} littleEndian {
binary format t2 {0x50 0x52}
} P\x00R\x00
-test binary-48.12 {Tcl_BinaryObjCmd: format} bigEndian {
+test binary-48.12 {Tcl_BinaryObjCmd: format} bigEndian {
binary format t* {0x5051 0x52}
} PQ\x00R
-test binary-48.13 {Tcl_BinaryObjCmd: format} littleEndian {
+test binary-48.13 {Tcl_BinaryObjCmd: format} littleEndian {
binary format t* {0x5051 0x52}
} QPR\x00
test binary-48.14 {Tcl_BinaryObjCmd: format} bigEndian {
@@ -1805,13 +1673,13 @@ test binary-48.14 {Tcl_BinaryObjCmd: format} bigEndian {
test binary-48.15 {Tcl_BinaryObjCmd: format} littleEndian {
binary format t2 {0x50 0x52 0x53} 0x54
} P\x00R\x00
-test binary-48.16 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format t2 {0x50}
-} -result {number of elements in list does not match count}
-test binary-48.17 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
+test binary-48.16 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format t2 {0x50}} msg] $msg
+} {1 {number of elements in list does not match count}}
+test binary-48.17 {Tcl_BinaryObjCmd: format} {
set a {0x50 0x51}
- binary format t $a
-} -result "expected integer but got \"0x50 0x51\""
+ list [catch {binary format t $a} msg] $msg
+} [list 1 "expected integer but got \"0x50 0x51\""]
test binary-48.18 {Tcl_BinaryObjCmd: format} bigEndian {
set a {0x50 0x51}
binary format t1 $a
@@ -1822,12 +1690,12 @@ test binary-48.19 {Tcl_BinaryObjCmd: format} littleEndian {
} P\x00
# format n
-test binary-49.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format n
-} -result {not enough arguments for all format specifiers}
-test binary-49.2 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format n blat
-} -result {expected integer but got "blat"}
+test binary-49.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format n} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
+test binary-49.2 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format n blat} msg] $msg
+} {1 {expected integer but got "blat"}}
test binary-49.3 {Tcl_BinaryObjCmd: format} {
binary format n0 0x50
} {}
@@ -1852,13 +1720,13 @@ test binary-49.9 {Tcl_BinaryObjCmd: format} littleEndian {
test binary-49.10 {Tcl_BinaryObjCmd: format} littleEndian {
binary format n* {0x50515253 0x52}
} SRQPR\x00\x00\x00
-test binary-49.11 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format n2 {0x50}
-} -result {number of elements in list does not match count}
-test binary-49.12 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
+test binary-49.11 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format n2 {0x50}} msg] $msg
+} {1 {number of elements in list does not match count}}
+test binary-49.12 {Tcl_BinaryObjCmd: format} {
set a {0x50 0x51}
- binary format n $a
-} -result "expected integer but got \"0x50 0x51\""
+ list [catch {binary format n $a} msg] $msg
+} [list 1 "expected integer but got \"0x50 0x51\""]
test binary-49.13 {Tcl_BinaryObjCmd: format} littleEndian {
set a {0x50 0x51}
binary format n1 $a
@@ -1901,501 +1769,463 @@ test binary-50.4 {Tcl_BinaryObjCmd: scan wide int with bit 31 set} bigEndian {
set x
} 6442450944
+
# format Q/q
-test binary-51.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format Q
-} -result {not enough arguments for all format specifiers}
-test binary-51.2 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format q blat
-} -result {expected floating-point number but got "blat"}
+test binary-51.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format Q} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
+test binary-51.2 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format q blat} msg] $msg
+} {1 {expected floating-point number but got "blat"}}
test binary-51.3 {Tcl_BinaryObjCmd: format} {
binary format q0 1.6
} {}
test binary-51.4 {Tcl_BinaryObjCmd: format} {} {
binary format Q 1.6
-} \x3F\xF9\x99\x99\x99\x99\x99\x9A
+} \x3f\xf9\x99\x99\x99\x99\x99\x9a
test binary-51.5 {Tcl_BinaryObjCmd: format} {} {
binary format q 1.6
-} \x9A\x99\x99\x99\x99\x99\xF9\x3F
+} \x9a\x99\x99\x99\x99\x99\xf9\x3f
test binary-51.6 {Tcl_BinaryObjCmd: format} {} {
binary format Q* {1.6 3.4}
-} \x3F\xF9\x99\x99\x99\x99\x99\x9A\x40\x0B\x33\x33\x33\x33\x33\x33
+} \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33
test binary-51.7 {Tcl_BinaryObjCmd: format} {} {
binary format q* {1.6 3.4}
-} \x9A\x99\x99\x99\x99\x99\xF9\x3F\x33\x33\x33\x33\x33\x33\x0B\x40
+} \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40
test binary-51.8 {Tcl_BinaryObjCmd: format} {} {
binary format Q2 {1.6 3.4}
-} \x3F\xF9\x99\x99\x99\x99\x99\x9A\x40\x0B\x33\x33\x33\x33\x33\x33
+} \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33
test binary-51.9 {Tcl_BinaryObjCmd: format} {} {
binary format q2 {1.6 3.4}
-} \x9A\x99\x99\x99\x99\x99\xF9\x3F\x33\x33\x33\x33\x33\x33\x0B\x40
+} \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40
test binary-51.10 {Tcl_BinaryObjCmd: format} {} {
binary format Q2 {1.6 3.4 5.6}
-} \x3F\xF9\x99\x99\x99\x99\x99\x9A\x40\x0B\x33\x33\x33\x33\x33\x33
+} \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33
test binary-51.11 {Tcl_BinaryObjCmd: format} {} {
binary format q2 {1.6 3.4 5.6}
-} \x9A\x99\x99\x99\x99\x99\xF9\x3F\x33\x33\x33\x33\x33\x33\x0B\x40
-test binary-51.14 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format q2 {1.6}
-} -result {number of elements in list does not match count}
-test binary-51.15 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
+} \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40
+test binary-51.14 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format q2 {1.6}} msg] $msg
+} {1 {number of elements in list does not match count}}
+test binary-51.15 {Tcl_BinaryObjCmd: format} {
set a {1.6 3.4}
- binary format q $a
-} -result "expected floating-point number but got \"1.6 3.4\""
+ list [catch {binary format q $a} msg] $msg
+} [list 1 "expected floating-point number but got \"1.6 3.4\""]
test binary-51.16 {Tcl_BinaryObjCmd: format} {} {
set a {1.6 3.4}
binary format Q1 $a
-} \x3F\xF9\x99\x99\x99\x99\x99\x9A
+} \x3f\xf9\x99\x99\x99\x99\x99\x9a
test binary-51.17 {Tcl_BinaryObjCmd: format} {} {
set a {1.6 3.4}
binary format q1 $a
-} \x9A\x99\x99\x99\x99\x99\xF9\x3F
+} \x9a\x99\x99\x99\x99\x99\xf9\x3f
# format R/r
-test binary-53.1 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format r
-} -result {not enough arguments for all format specifiers}
-test binary-53.2 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format r blat
-} -result {expected floating-point number but got "blat"}
+test binary-53.1 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format r} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
+test binary-53.2 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format r blat} msg] $msg
+} {1 {expected floating-point number but got "blat"}}
test binary-53.3 {Tcl_BinaryObjCmd: format} {
binary format f0 1.6
} {}
test binary-53.4 {Tcl_BinaryObjCmd: format} {} {
binary format R 1.6
-} \x3F\xCC\xCC\xCD
+} \x3f\xcc\xcc\xcd
test binary-53.5 {Tcl_BinaryObjCmd: format} {} {
binary format r 1.6
-} \xCD\xCC\xCC\x3F
+} \xcd\xcc\xcc\x3f
test binary-53.6 {Tcl_BinaryObjCmd: format} {} {
binary format R* {1.6 3.4}
-} \x3F\xCC\xCC\xCD\x40\x59\x99\x9A
+} \x3f\xcc\xcc\xcd\x40\x59\x99\x9a
test binary-53.7 {Tcl_BinaryObjCmd: format} {} {
binary format r* {1.6 3.4}
-} \xCD\xCC\xCC\x3F\x9A\x99\x59\x40
+} \xcd\xcc\xcc\x3f\x9a\x99\x59\x40
test binary-53.8 {Tcl_BinaryObjCmd: format} {} {
binary format R2 {1.6 3.4}
-} \x3F\xCC\xCC\xCD\x40\x59\x99\x9A
+} \x3f\xcc\xcc\xcd\x40\x59\x99\x9a
test binary-53.9 {Tcl_BinaryObjCmd: format} {} {
binary format r2 {1.6 3.4}
-} \xCD\xCC\xCC\x3F\x9A\x99\x59\x40
+} \xcd\xcc\xcc\x3f\x9a\x99\x59\x40
test binary-53.10 {Tcl_BinaryObjCmd: format} {} {
binary format R2 {1.6 3.4 5.6}
-} \x3F\xCC\xCC\xCD\x40\x59\x99\x9A
+} \x3f\xcc\xcc\xcd\x40\x59\x99\x9a
test binary-53.11 {Tcl_BinaryObjCmd: format} {} {
binary format r2 {1.6 3.4 5.6}
-} \xCD\xCC\xCC\x3F\x9A\x99\x59\x40
+} \xcd\xcc\xcc\x3f\x9a\x99\x59\x40
test binary-53.12 {Tcl_BinaryObjCmd: float overflow} {} {
binary format R -3.402825e+38
-} \xFF\x80\x00\x00
+} \xff\x7f\xff\xff
test binary-53.13 {Tcl_BinaryObjCmd: float overflow} {} {
binary format r -3.402825e+38
-} \x00\x00\x80\xFF
+} \xff\xff\x7f\xff
test binary-53.14 {Tcl_BinaryObjCmd: float underflow} {} {
binary format R -3.402825e-100
} \x80\x00\x00\x00
test binary-53.15 {Tcl_BinaryObjCmd: float underflow} {} {
binary format r -3.402825e-100
} \x00\x00\x00\x80
-test binary-53.16 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
- binary format r2 {1.6}
-} -result {number of elements in list does not match count}
-test binary-53.17 {Tcl_BinaryObjCmd: format} -returnCodes error -body {
+test binary-53.16 {Tcl_BinaryObjCmd: format} {
+ list [catch {binary format r2 {1.6}} msg] $msg
+} {1 {number of elements in list does not match count}}
+test binary-53.17 {Tcl_BinaryObjCmd: format} {
set a {1.6 3.4}
- binary format r $a
-} -result "expected floating-point number but got \"1.6 3.4\""
+ list [catch {binary format r $a} msg] $msg
+} [list 1 "expected floating-point number but got \"1.6 3.4\""]
test binary-53.18 {Tcl_BinaryObjCmd: format} {} {
set a {1.6 3.4}
binary format R1 $a
-} \x3F\xCC\xCC\xCD
+} \x3f\xcc\xcc\xcd
test binary-53.19 {Tcl_BinaryObjCmd: format} {} {
set a {1.6 3.4}
binary format r1 $a
-} \xCD\xCC\xCC\x3F
-test binary-53.20 {Tcl_BinaryObjCmd: float Inf} {} {
- binary format R Inf
-} \x7F\x80\x00\x00
-test binary-53.21 {Tcl_BinaryObjCmd: float Inf} {} {
- binary format r Inf
-} \x00\x00\x80\x7F
-test binary-53.22 {Binary float Inf round trip} -body {
- binary scan [binary format R Inf] R inf
- binary scan [binary format R -Inf] R inf_
- list $inf $inf_
-} -result {Inf -Inf}
-test binary-53.23 {Binary float round to FLT_MAX} -body {
- binary scan [binary format H* 7f7fffff] R fltmax
- binary scan [binary format H* 47effffff0000000] Q round_to_fltmax
- binary scan [binary format R $round_to_fltmax] R fltmax1
- expr {$fltmax eq $fltmax1}
-} -result 1
-test binary-53.24 {Binary float round to -FLT_MAX} -body {
- binary scan [binary format H* ff7fffff] R fltmax
- binary scan [binary format H* c7effffff0000000] Q round_to_fltmax
- binary scan [binary format R $round_to_fltmax] R fltmax1
- expr {$fltmax eq $fltmax1}
-} -result 1
-test binary-53.25 {Binary float round to Inf} -body {
- binary scan [binary format H* 47effffff0000001] Q round_to_inf
- binary scan [binary format R $round_to_inf] R inf1
- expr {$inf1 eq Inf}
-} -result 1
-test binary-53.26 {Binary float round to -Inf} -body {
- binary scan [binary format H* c7effffff0000001] Q round_to_inf
- binary scan [binary format R $round_to_inf] R inf1
- expr {$inf1 eq -Inf}
-} -result 1
+} \xcd\xcc\xcc\x3f
# scan t (s)
-test binary-54.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc t
-} -result {not enough arguments for all format specifiers}
+test binary-54.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc t} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-54.2 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 t* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 t* arg1] $arg1
} {1 {-23726 21587}}
test binary-54.3 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 t arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 t arg1] $arg1
} {1 -23726}
test binary-54.4 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 t1 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 t1 arg1] $arg1
} {1 -23726}
test binary-54.5 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 t0 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3 t0 arg1] $arg1
} {1 {}}
test binary-54.6 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 t2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 t2 arg1] $arg1
} {1 {-23726 21587}}
test binary-54.7 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 t1 arg1] $arg1
} {0 foo}
-test binary-54.8 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-54.8 {Tcl_BinaryObjCmd: scan} {} {
+ catch {unset arg1}
set arg1 1
- binary scan \x52\x53 t1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
+ list [catch {binary scan \x52\x53 t1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
test binary-54.9 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \x52\xA3\x53\x54\x05 t2c* arg1 arg2] $arg1 $arg2
+ list [binary scan \x52\xa3\x53\x54\x05 t2c* arg1 arg2] $arg1 $arg2
} {2 {-23726 21587} 5}
-test binary-54.10 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1 arg2
+test binary-54.10 {Tcl_BinaryObjCmd: scan} littleEndian {
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x00\x80\x00\x80 tut arg1 arg2] $arg1 $arg2
} {2 32768 -32768}
-test binary-54.11 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1 arg2
+test binary-54.11 {Tcl_BinaryObjCmd: scan} littleEndian {
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x00\x80\x00\x80 ttu arg1 arg2] $arg1 $arg2
} {2 -32768 32768}
# scan t (b)
-test binary-55.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc t
-} -result {not enough arguments for all format specifiers}
-test binary-55.2 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 t* arg1] $arg1
+test binary-55.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc t} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
+test binary-55.2 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 t* arg1] $arg1
} {1 {21155 21332}}
-test binary-55.3 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 t arg1] $arg1
+test binary-55.3 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 t arg1] $arg1
} {1 21155}
-test binary-55.4 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 t1 arg1] $arg1
+test binary-55.4 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1}
+ list [binary scan \x52\xa3 t1 arg1] $arg1
} {1 21155}
-test binary-55.5 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3 t0 arg1] $arg1
+test binary-55.5 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1}
+ list [binary scan \x52\xa3 t0 arg1] $arg1
} {1 {}}
-test binary-55.6 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 t2 arg1] $arg1
+test binary-55.6 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 t2 arg1] $arg1
} {1 {21155 21332}}
-test binary-55.7 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
+test binary-55.7 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 t1 arg1] $arg1
} {0 foo}
-test binary-55.8 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-55.8 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x52\x53 t1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
-test binary-55.9 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1 arg2
+ list [catch {binary scan \x52\x53 t1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
+test binary-55.9 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \x52\xA3\x53\x54\x05 t2c* arg1 arg2] $arg1 $arg2
+ list [binary scan \x52\xa3\x53\x54\x05 t2c* arg1 arg2] $arg1 $arg2
} {2 {21155 21332} 5}
-test binary-55.10 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1 arg2
+test binary-55.10 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x80\x00\x80\x00 tut arg1 arg2] $arg1 $arg2
} {2 32768 -32768}
-test binary-55.11 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1 arg2
+test binary-55.11 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x80\x00\x80\x00 ttu arg1 arg2] $arg1 $arg2
} {2 -32768 32768}
# scan n (s)
-test binary-56.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc n
-} -result {not enough arguments for all format specifiers}
+test binary-56.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc n} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-56.2 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04 n* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 n* arg1] $arg1
} {1 {1414767442 67305985}}
-test binary-56.3 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04 n arg1] $arg1
+test binary-56.3 {Tcl_BinaryObjCmd: scan} littleEndian {
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 n arg1] $arg1
} {1 1414767442}
-test binary-56.4 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 n1 arg1] $arg1
+test binary-56.4 {Tcl_BinaryObjCmd: scan} littleEndian {
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 n1 arg1] $arg1
} {1 1414767442}
-test binary-56.5 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53 n0 arg1] $arg1
+test binary-56.5 {Tcl_BinaryObjCmd: scan} littleEndian {
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53 n0 arg1] $arg1
} {1 {}}
-test binary-56.6 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04 n2 arg1] $arg1
+test binary-56.6 {Tcl_BinaryObjCmd: scan} littleEndian {
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 n2 arg1] $arg1
} {1 {1414767442 67305985}}
-test binary-56.7 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
+test binary-56.7 {Tcl_BinaryObjCmd: scan} littleEndian {
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 n1 arg1] $arg1
} {0 foo}
-test binary-56.8 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-56.8 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x52\x53\x53\x54 n1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
-test binary-56.9 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1 arg2
+ list [catch {binary scan \x52\x53\x53\x54 n1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
+test binary-56.9 {Tcl_BinaryObjCmd: scan} littleEndian {
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04\x05 n2c* arg1 arg2] $arg1 $arg2
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04\x05 n2c* arg1 arg2] $arg1 $arg2
} {2 {1414767442 67305985} 5}
-test binary-56.10 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1 arg2
+test binary-56.10 {Tcl_BinaryObjCmd: scan} littleEndian {
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x80\x00\x00\x00\x80\x00\x00\x00 nun arg1 arg2] $arg1 $arg2
} {2 128 128}
-test binary-56.11 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1 arg2
+test binary-56.11 {Tcl_BinaryObjCmd: scan} littleEndian {
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x00\x00\x00\x80\x00\x00\x00\x80 nun arg1 arg2] $arg1 $arg2
} {2 2147483648 -2147483648}
# scan n (b)
-test binary-57.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc n
-} -result {not enough arguments for all format specifiers}
-test binary-57.2 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04 n* arg1] $arg1
+test binary-57.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc n} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
+test binary-57.2 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 n* arg1] $arg1
} {1 {1386435412 16909060}}
-test binary-57.3 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04 n arg1] $arg1
+test binary-57.3 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 n arg1] $arg1
} {1 1386435412}
-test binary-57.4 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54 n1 arg1] $arg1
+test binary-57.4 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54 n1 arg1] $arg1
} {1 1386435412}
-test binary-57.5 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53 n0 arg1] $arg1
+test binary-57.5 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53 n0 arg1] $arg1
} {1 {}}
-test binary-57.6 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04 n2 arg1] $arg1
+test binary-57.6 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1}
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04 n2 arg1] $arg1
} {1 {1386435412 16909060}}
-test binary-57.7 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
+test binary-57.7 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 n1 arg1] $arg1
} {0 foo}
-test binary-57.8 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-57.8 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x52\x53\x53\x54 n1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
-test binary-57.9 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1 arg2
+ list [catch {binary scan \x52\x53\x53\x54 n1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
+test binary-57.9 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \x52\xA3\x53\x54\x01\x02\x03\x04\x05 n2c* arg1 arg2] $arg1 $arg2
+ list [binary scan \x52\xa3\x53\x54\x01\x02\x03\x04\x05 n2c* arg1 arg2] $arg1 $arg2
} {2 {1386435412 16909060} 5}
-test binary-57.10 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1 arg2
+test binary-57.10 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x80\x00\x00\x00\x80\x00\x00\x00 nun arg1 arg2] $arg1 $arg2
} {2 2147483648 -2147483648}
-test binary-57.11 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1 arg2
+test binary-57.11 {Tcl_BinaryObjCmd: scan} bigEndian {
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
list [binary scan \x00\x00\x00\x80\x00\x00\x00\x80 nun arg1 arg2] $arg1 $arg2
} {2 128 128}
# scan Q/q
-test binary-58.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc q
-} -result {not enough arguments for all format specifiers}
+test binary-58.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc q} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-58.2 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xF9\x99\x99\x99\x99\x99\x9A\x40\x0B\x33\x33\x33\x33\x33\x33 Q* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33 Q* arg1] $arg1
} {1 {1.6 3.4}}
test binary-58.3 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x9A\x99\x99\x99\x99\x99\xF9\x3F\x33\x33\x33\x33\x33\x33\x0B\x40 q* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40 q* arg1] $arg1
} {1 {1.6 3.4}}
test binary-58.4 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xF9\x99\x99\x99\x99\x99\x9A\x40\x0B\x33\x33\x33\x33\x33\x33 Q arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33 Q arg1] $arg1
} {1 1.6}
test binary-58.5 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x9A\x99\x99\x99\x99\x99\xF9\x3F\x33\x33\x33\x33\x33\x33\x0B\x40 q arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40 q arg1] $arg1
} {1 1.6}
test binary-58.6 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xF9\x99\x99\x99\x99\x99\x9A Q1 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a Q1 arg1] $arg1
} {1 1.6}
test binary-58.7 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x9A\x99\x99\x99\x99\x99\xF9\x3F q1 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f q1 arg1] $arg1
} {1 1.6}
test binary-58.8 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xF9\x99\x99\x99\x99\x99\x9A Q0 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a Q0 arg1] $arg1
} {1 {}}
test binary-58.9 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x9A\x99\x99\x99\x99\x99\xF9\x3F q0 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f q0 arg1] $arg1
} {1 {}}
test binary-58.10 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xF9\x99\x99\x99\x99\x99\x9A\x40\x0B\x33\x33\x33\x33\x33\x33 Q2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33 Q2 arg1] $arg1
} {1 {1.6 3.4}}
test binary-58.11 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \x9A\x99\x99\x99\x99\x99\xF9\x3F\x33\x33\x33\x33\x33\x33\x0B\x40 q2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40 q2 arg1] $arg1
} {1 {1.6 3.4}}
test binary-58.12 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 q1 arg1] $arg1
} {0 foo}
-test binary-58.13 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-58.13 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x3F\xF9\x99\x99\x99\x99\x99\x9A q1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
+ list [catch {binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a q1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
test binary-58.14 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \x3F\xF9\x99\x99\x99\x99\x99\x9A\x40\x0B\x33\x33\x33\x33\x33\x33\x05 Q2c* arg1 arg2] $arg1 $arg2
+ list [binary scan \x3f\xf9\x99\x99\x99\x99\x99\x9a\x40\x0b\x33\x33\x33\x33\x33\x33\x05 Q2c* arg1 arg2] $arg1 $arg2
} {2 {1.6 3.4} 5}
test binary-58.15 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \x9A\x99\x99\x99\x99\x99\xF9\x3F\x33\x33\x33\x33\x33\x33\x0B\x40\x05 q2c* arg1 arg2] $arg1 $arg2
+ list [binary scan \x9a\x99\x99\x99\x99\x99\xf9\x3f\x33\x33\x33\x33\x33\x33\x0b\x40\x05 q2c* arg1 arg2] $arg1 $arg2
} {2 {1.6 3.4} 5}
# scan R/r
-test binary-59.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body {
- binary scan abc r
-} -result {not enough arguments for all format specifiers}
+test binary-59.1 {Tcl_BinaryObjCmd: scan} {
+ list [catch {binary scan abc r} msg] $msg
+} {1 {not enough arguments for all format specifiers}}
test binary-59.2 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xCC\xCC\xCD\x40\x59\x99\x9A R* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a R* arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-59.3 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \xCD\xCC\xCC\x3F\x9A\x99\x59\x40 r* arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 r* arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-59.4 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xCC\xCC\xCD\x40\x59\x99\x9A R arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a R arg1] $arg1
} {1 1.600000023841858}
test binary-59.5 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \xCD\xCC\xCC\x3F\x9A\x99\x59\x40 r arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 r arg1] $arg1
} {1 1.600000023841858}
test binary-59.6 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xCC\xCC\xCD R1 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xcc\xcc\xcd R1 arg1] $arg1
} {1 1.600000023841858}
test binary-59.7 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \xCD\xCC\xCC\x3F r1 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xcd\xcc\xcc\x3f r1 arg1] $arg1
} {1 1.600000023841858}
test binary-59.8 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xCC\xCC\xCD R0 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xcc\xcc\xcd R0 arg1] $arg1
} {1 {}}
test binary-59.9 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \xCD\xCC\xCC\x3F r0 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xcd\xcc\xcc\x3f r0 arg1] $arg1
} {1 {}}
test binary-59.10 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1
- list [binary scan \x3F\xCC\xCC\xCD\x40\x59\x99\x9A R2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a R2 arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-59.11 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1
- list [binary scan \xCD\xCC\xCC\x3F\x9A\x99\x59\x40 r2 arg1] $arg1
+ catch {unset arg1}
+ list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 r2 arg1] $arg1
} {1 {1.600000023841858 3.4000000953674316}}
test binary-59.12 {Tcl_BinaryObjCmd: scan} {
- unset -nocomplain arg1
+ catch {unset arg1}
set arg1 foo
list [binary scan \x52 r1 arg1] $arg1
} {0 foo}
-test binary-59.13 {Tcl_BinaryObjCmd: scan} -setup {
- unset -nocomplain arg1
-} -returnCodes error -body {
+test binary-59.13 {Tcl_BinaryObjCmd: scan} {
+ catch {unset arg1}
set arg1 1
- binary scan \x3F\xCC\xCC\xCD r1 arg1(a)
-} -result {can't set "arg1(a)": variable isn't array}
+ list [catch {binary scan \x3f\xcc\xcc\xcd r1 arg1(a)} msg] $msg
+} {1 {can't set "arg1(a)": variable isn't array}}
test binary-59.14 {Tcl_BinaryObjCmd: scan} bigEndian {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \x3F\xCC\xCC\xCD\x40\x59\x99\x9A\x05 R2c* arg1 arg2] $arg1 $arg2
+ list [binary scan \x3f\xcc\xcc\xcd\x40\x59\x99\x9a\x05 R2c* arg1 arg2] $arg1 $arg2
} {2 {1.600000023841858 3.4000000953674316} 5}
test binary-59.15 {Tcl_BinaryObjCmd: scan} littleEndian {
- unset -nocomplain arg1 arg2
+ catch {unset arg1 arg2}
set arg1 foo
set arg2 bar
- list [binary scan \xCD\xCC\xCC\x3F\x9A\x99\x59\x40\x05 r2c* arg1 arg2] $arg1 $arg2
+ list [binary scan \xcd\xcc\xcc\x3f\x9a\x99\x59\x40\x05 r2c* arg1 arg2] $arg1 $arg2
} {2 {1.600000023841858 3.4000000953674316} 5}
test binary-60.1 {[binary format] with NaN} -body {
@@ -2413,7 +2243,7 @@ test binary-61.2 {Tcl_BinaryObjCmd: scan wide int} littleEndian {
binary scan lcTolleH m x
set x
} 5216694956358656876
-test binary-61.3 {Tcl_BinaryObjCmd: scan wide int with bit 31 set} littleEndian {
+test binary-61.3 {Tcl_BinaryObjCmd: scan wide int with bit 31 set} littleEndian {
binary scan [binary format w [expr {wide(3) << 31}]] m x
set x
} 6442450944
@@ -2422,6 +2252,65 @@ test binary-61.4 {Tcl_BinaryObjCmd: scan wide int with bit 31 set} bigEndian {
set x
} 6442450944
+# Big test for correct ordering of data in [expr]
+
+proc testIEEE {} {
+ variable ieeeValues
+ binary scan [binary format dd -1.0 1.0] c* c
+ switch -exact -- $c {
+ {0 0 0 0 0 0 -16 -65 0 0 0 0 0 0 -16 63} {
+ # little endian
+ binary scan \x00\x00\x00\x00\x00\x00\xf0\xff d \
+ ieeeValues(-Infinity)
+ binary scan \x00\x00\x00\x00\x00\x00\xf0\xbf d \
+ ieeeValues(-Normal)
+ binary scan \x00\x00\x00\x00\x00\x00\x08\x80 d \
+ ieeeValues(-Subnormal)
+ binary scan \x00\x00\x00\x00\x00\x00\x00\x80 d \
+ ieeeValues(-0)
+ binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(+0)
+ binary scan \x00\x00\x00\x00\x00\x00\x08\x00 d \
+ ieeeValues(+Subnormal)
+ binary scan \x00\x00\x00\x00\x00\x00\xf0\x3f d \
+ ieeeValues(+Normal)
+ binary scan \x00\x00\x00\x00\x00\x00\xf0\x7f d \
+ ieeeValues(+Infinity)
+ binary scan \x00\x00\x00\x00\x00\x00\xf8\x7f d \
+ ieeeValues(NaN)
+ set ieeeValues(littleEndian) 1
+ return 1
+ }
+ {-65 -16 0 0 0 0 0 0 63 -16 0 0 0 0 0 0} {
+ binary scan \xff\xf0\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(-Infinity)
+ binary scan \xbf\xf0\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(-Normal)
+ binary scan \x80\x08\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(-Subnormal)
+ binary scan \x80\x00\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(-0)
+ binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(+0)
+ binary scan \x00\x08\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(+Subnormal)
+ binary scan \x3f\xf0\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(+Normal)
+ binary scan \x7f\xf0\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(+Infinity)
+ binary scan \x7f\xf8\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(NaN)
+ set ieeeValues(littleEndian) 0
+ return 1
+ }
+ default {
+ return 0
+ }
+ }
+}
+
+testConstraint ieeeFloatingPoint [testIEEE]
+
# scan/format infinities
test binary-62.1 {infinity} ieeeFloatingPoint {
@@ -2441,27 +2330,11 @@ test binary-62.4 {infinity} ieeeFloatingPoint {
format 0x%016lx $w
} 0xfff0000000000000
test binary-62.5 {infinity} ieeeFloatingPoint {
- binary scan [binary format w 0x7FF0000000000000] q d
+ binary scan [binary format w 0x7ff0000000000000] q d
set d
} Inf
test binary-62.6 {infinity} ieeeFloatingPoint {
- binary scan [binary format w 0xFFF0000000000000] q d
- set d
-} -Inf
-test binary-62.7 {infinity} ieeeFloatingPoint {
- binary scan [binary format r Inf] iu i
- format 0x%08x $i
-} 0x7f800000
-test binary-62.8 {infinity} ieeeFloatingPoint {
- binary scan [binary format r -Inf] iu i
- format 0x%08x $i
-} 0xff800000
-test binary-62.9 {infinity} ieeeFloatingPoint {
- binary scan [binary format i 0x7F800000] r d
- set d
-} Inf
-test binary-62.10 {infinity} ieeeFloatingPoint {
- binary scan [binary format i 0xFF800000] r d
+ binary scan [binary format w 0xfff0000000000000] q d
set d
} -Inf
@@ -2469,19 +2342,19 @@ test binary-62.10 {infinity} ieeeFloatingPoint {
test binary-63.1 {NaN} ieeeFloatingPoint {
binary scan [binary format q NaN] w w
- format 0x%016lx [expr {$w & 0xFFF3FFFFFFFFFFFF}]
+ format 0x%016lx [expr {$w & 0xfff3ffffffffffff}]
} 0x7ff0000000000000
test binary-63.2 {NaN} ieeeFloatingPoint {
binary scan [binary format q -NaN] w w
- format 0x%016lx [expr {$w & 0xFFF3FFFFFFFFFFFF}]
+ format 0x%016lx [expr {$w & 0xfff3ffffffffffff}]
} 0xfff0000000000000
test binary-63.3 {NaN} ieeeFloatingPoint {
binary scan [binary format q NaN(3123456789aBc)] w w
- format 0x%016lx [expr {$w & 0xFFF3FFFFFFFFFFFF}]
+ format 0x%016lx [expr {$w & 0xfff3ffffffffffff}]
} 0x7ff3123456789abc
test binary-63.4 {NaN} ieeeFloatingPoint {
binary scan [binary format q {NaN( 3123456789aBc)}] w w
- format 0x%016lx [expr {$w & 0xFFF3FFFFFFFFFFFF}]
+ format 0x%016lx [expr {$w & 0xfff3ffffffffffff}]
} 0x7ff3123456789abc
# Make sure TclParseNumber() rejects invalid nan-hex formats [Bug 3402540]
@@ -2501,14 +2374,20 @@ test binary-63.9 {NaN} -constraints ieeeFloatingPoint -body {
binary format q Nan(1234567890abcd)
} -returnCodes error -match glob -result {expected floating-point number*}
-test binary-64.1 {NaN} -constraints ieeeFloatingPoint -body {
- binary scan [binary format w 0x7ff8000000000000] q d
- set d
-} -match glob -result NaN*
-test binary-64.2 {NaN} -constraints ieeeFloatingPoint -body {
- binary scan [binary format w 0x7ff0123456789aBc] q d
- set d
-} -match glob -result NaN(*123456789abc)
+test binary-64.1 {NaN} \
+ -constraints ieeeFloatingPoint \
+ -body {
+ binary scan [binary format w 0x7ff8000000000000] q d
+ set d
+ } \
+ -match glob -result NaN*
+test binary-64.2 {NaN} \
+ -constraints ieeeFloatingPoint \
+ -body {
+ binary scan [binary format w 0x7ff0123456789aBc] q d
+ set d
+ } \
+ -match glob -result NaN(*123456789abc)
test binary-65.1 {largest significand} ieeeFloatingPoint {
binary scan [binary format w 0x3fcfffffffffffff] q d
@@ -2547,496 +2426,7 @@ test binary-65.9 {largest significand} ieeeFloatingPoint {
set d
} 18014398509481988.0
-test binary-70.1 {binary encode hex} -body {
- binary encode hex
-} -returnCodes error -match glob -result "wrong # args: *"
-test binary-70.2 {binary encode hex} -body {
- binary encode hex a
-} -result {61}
-test binary-70.3 {binary encode hex} -body {
- binary encode hex {}
-} -result {}
-test binary-70.4 {binary encode hex} -body {
- binary encode hex [string repeat a 20]
-} -result [string repeat 61 20]
-test binary-70.5 {binary encode hex} -body {
- binary encode hex \x00\x01\x02\x03\x04\x00\x01\x02\x03\x04
-} -result {00010203040001020304}
-
-test binary-71.1 {binary decode hex} -body {
- binary decode hex
-} -returnCodes error -match glob -result "wrong # args: *"
-test binary-71.2 {binary decode hex} -body {
- binary decode hex 61
-} -result {a}
-test binary-71.3 {binary decode hex} -body {
- binary decode hex {}
-} -result {}
-test binary-71.4 {binary decode hex} -body {
- binary decode hex [string repeat 61 20]
-} -result [string repeat a 20]
-test binary-71.5 {binary decode hex} -body {
- binary decode hex 00010203040001020304
-} -result "\x00\x01\x02\x03\x04\x00\x01\x02\x03\x04"
-test binary-71.6 {binary decode hex} -body {
- binary decode hex "61 61"
-} -result {aa}
-test binary-71.7 {binary decode hex} -body {
- binary decode hex "61\n\n\n61"
-} -result {aa}
-test binary-71.8 {binary decode hex} -match glob -body {
- binary decode hex -strict "61 61"
-} -returnCodes error -result {invalid hexadecimal digit " " * at position 2}
-test binary-71.9 {binary decode hex} -body {
- set r [binary decode hex "6"]
- list [string length $r] $r
-} -result {0 {}}
-test binary-71.10 {binary decode hex} -body {
- string length [binary decode hex " "]
-} -result 0
-test binary-71.11 {binary decode hex: Bug b98fa55285} -body {
- apply {{} {
- set str "137b6f95e7519389e7c4b36599781e2ccf492699649249aae43fbe8c26\n"
- set decoded [binary decode hex $str]
- list [string length $decoded] [scan [string index $decoded end] %c]
- }}
-} -result {29 38}
-test binary-71.12 {binary decode hex: Bug b98fa55285 cross check} -body {
- apply {{} {
- set str "137b6f95e7519389e7c4b36599781e2ccf492699649249aae43fbe8c2\n"
- set decoded [binary decode hex $str]
- list [string length $decoded] [scan [string index $decoded end] %c]
- }}
-} -result {28 140}
-test binary-71.13 {binary decode hex: Bug b98fa55285 cross check} -body {
- apply {{} {
- set str "137b6f95e7519389e7c4b36599781e2ccf492699649249aae43fbe8c2\n\n"
- set decoded [binary decode hex $str]
- list [string length $decoded] [scan [string index $decoded end] %c]
- }}
-} -result {28 140}
-test binary-71.14 {binary decode hex: Bug b98fa55285 cross check} -body {
- apply {{} {
- set str "137b6f95e7519389e7c4b36599781e2ccf492699649249aae43fbe8c2\n\n\n"
- set decoded [binary decode hex $str]
- list [string length $decoded] [scan [string index $decoded end] %c]
- }}
-} -result {28 140}
-
-test binary-72.1 {binary encode base64} -body {
- binary encode base64
-} -returnCodes error -match glob -result "wrong # args: *"
-test binary-72.2 {binary encode base64} -body {
- binary encode base64 abc
-} -result {YWJj}
-test binary-72.3 {binary encode base64} -body {
- binary encode base64 {}
-} -result {}
-test binary-72.4 {binary encode base64} -body {
- binary encode base64 [string repeat abc 20]
-} -result [string repeat YWJj 20]
-test binary-72.5 {binary encode base64} -body {
- binary encode base64 \x00\x01\x02\x03\x04\x00\x01\x02\x03
-} -result {AAECAwQAAQID}
-test binary-72.6 {binary encode base64} -body {
- binary encode base64 \x00
-} -result {AA==}
-test binary-72.7 {binary encode base64} -body {
- binary encode base64 \x00\x00
-} -result {AAA=}
-test binary-72.8 {binary encode base64} -body {
- binary encode base64 \x00\x00\x00
-} -result {AAAA}
-test binary-72.9 {binary encode base64} -body {
- binary encode base64 \x00\x00\x00\x00
-} -result {AAAAAA==}
-test binary-72.10 {binary encode base64} -body {
- binary encode base64 -maxlen 0 -wrapchar : abcabcabc
-} -result {YWJjYWJjYWJj}
-test binary-72.11 {binary encode base64} -body {
- binary encode base64 -maxlen 1 -wrapchar : abcabcabc
-} -result {Y:W:J:j:Y:W:J:j:Y:W:J:j}
-test binary-72.12 {binary encode base64} -body {
- binary encode base64 -maxlen 2 -wrapchar : abcabcabc
-} -result {YW:Jj:YW:Jj:YW:Jj}
-test binary-72.13 {binary encode base64} -body {
- binary encode base64 -maxlen 3 -wrapchar : abcabcabc
-} -result {YWJ:jYW:JjY:WJj}
-test binary-72.14 {binary encode base64} -body {
- binary encode base64 -maxlen 4 -wrapchar : abcabcabc
-} -result {YWJj:YWJj:YWJj}
-test binary-72.15 {binary encode base64} -body {
- binary encode base64 -maxlen 5 -wrapchar : abcabcabc
-} -result {YWJjY:WJjYW:Jj}
-test binary-72.16 {binary encode base64} -body {
- binary encode base64 -maxlen 6 -wrapchar : abcabcabc
-} -result {YWJjYW:JjYWJj}
-test binary-72.17 {binary encode base64} -body {
- binary encode base64 -maxlen 7 -wrapchar : abcabcabc
-} -result {YWJjYWJ:jYWJj}
-test binary-72.18 {binary encode base64} -body {
- binary encode base64 -maxlen 8 -wrapchar : abcabcabc
-} -result {YWJjYWJj:YWJj}
-test binary-72.19 {binary encode base64} -body {
- binary encode base64 -maxlen 9 -wrapchar : abcabcabc
-} -result {YWJjYWJjY:WJj}
-test binary-72.20 {binary encode base64} -body {
- binary encode base64 -maxlen 10 -wrapchar : abcabcabc
-} -result {YWJjYWJjYW:Jj}
-test binary-72.21 {binary encode base64} -body {
- binary encode base64 -maxlen 11 -wrapchar : abcabcabc
-} -result {YWJjYWJjYWJ:j}
-test binary-72.22 {binary encode base64} -body {
- binary encode base64 -maxlen 12 -wrapchar : abcabcabc
-} -result {YWJjYWJjYWJj}
-test binary-72.23 {binary encode base64} -body {
- binary encode base64 -maxlen 13 -wrapchar : abcabcabc
-} -result {YWJjYWJjYWJj}
-test binary-72.24 {binary encode base64} -body {
- binary encode base64 -maxlen 60 -wrapchar : abcabcabc
-} -result {YWJjYWJjYWJj}
-test binary-72.25 {binary encode base64} -body {
- binary encode base64 -maxlen 2 -wrapchar * abcabcabc
-} -result {YW*Jj*YW*Jj*YW*Jj}
-test binary-72.26 {binary encode base64} -body {
- binary encode base64 -maxlen 6 -wrapchar -*- abcabcabc
-} -result {YWJjYW-*-JjYWJj}
-test binary-72.27 {binary encode base64} -body {
- binary encode base64 -maxlen 4 -wrapchar -*- abcabcabc
-} -result {YWJj-*-YWJj-*-YWJj}
-test binary-72.28 {binary encode base64} -body {
- binary encode base64 -maxlen 6 -wrapchar 0123456789 abcabcabc
-} -result {YWJjYW0123456789JjYWJj}
-test binary-72.29 {binary encode base64} {
- string length [binary encode base64 -maxlen 3 -wrapchar \xCA abc]
-} 5
-test binary-72.30 {binary encode base64} {
- string length [binary encode base64 -maxlen 4294967296 abc]
-} 4
-test binary-72.31 {binary encode base64} -body {
- string length [binary encode base64 -maxlen 18446744073709551616 abc]
-} -returnCodes 1 -result {integer value too large to represent}
-
-test binary-73.1 {binary decode base64} -body {
- binary decode base64
-} -returnCodes error -match glob -result "wrong # args: *"
-test binary-73.2 {binary decode base64} -body {
- binary decode base64 YWJj
-} -result {abc}
-test binary-73.3 {binary decode base64} -body {
- binary decode base64 {}
-} -result {}
-test binary-73.4 {binary decode base64} -body {
- binary decode base64 [string repeat YWJj 20]
-} -result [string repeat abc 20]
-test binary-73.5 {binary decode base64} -body {
- binary decode base64 AAECAwQAAQID
-} -result "\x00\x01\x02\x03\x04\x00\x01\x02\x03"
-test binary-73.6 {binary decode base64} -body {
- binary decode base64 AA==
-} -result "\x00"
-test binary-73.7 {binary decode base64} -body {
- binary decode base64 AAA=
-} -result "\x00\x00"
-test binary-73.8 {binary decode base64} -body {
- binary decode base64 AAAA
-} -result "\x00\x00\x00"
-test binary-73.9 {binary decode base64} -body {
- binary decode base64 AAAAAA==
-} -result "\x00\x00\x00\x00"
-test binary-73.10 {binary decode base64} -body {
- set s "[string repeat YWJj 10]\n[string repeat YWJj 10]"
- binary decode base64 $s
-} -result [string repeat abc 20]
-test binary-73.11 {binary decode base64} -body {
- set s "[string repeat YWJj 10]\n [string repeat YWJj 10]"
- binary decode base64 $s
-} -result [string repeat abc 20]
-test binary-73.12 {binary decode base64} -body {
- binary decode base64 -strict ":YWJj"
-} -returnCodes error -match glob -result {invalid base64 character ":" * at position 0}
-test binary-73.13 {binary decode base64} -body {
- set s "[string repeat YWJj 10]:[string repeat YWJj 10]"
- binary decode base64 -strict $s
-} -returnCodes error -match glob -result {invalid base64 character ":" * at position 40}
-test binary-73.14 {binary decode base64} -body {
- set s "[string repeat YWJj 10]\n [string repeat YWJj 10]"
- binary decode base64 -strict $s
-} -returnCodes error -match glob -result {invalid base64 character *}
-test binary-73.20 {binary decode base64} -body {
- set r [binary decode base64 Y]
- list [string length $r] $r
-} -result {0 {}}
-test binary-73.21 {binary decode base64} -body {
- set r [binary decode base64 YW]
- list [string length $r] $r
-} -result {1 a}
-test binary-73.22 {binary decode base64} -body {
- set r [binary decode base64 YWJ]
- list [string length $r] $r
-} -result {2 ab}
-test binary-73.23 {binary decode base64} -body {
- set r [binary decode base64 YWJj]
- list [string length $r] $r
-} -result {3 abc}
-test binary-73.24 {binary decode base64} -body {
- string length [binary decode base64 " "]
-} -result 0
-test binary-73.25 {binary decode base64} -body {
- list [string length [set r [binary decode base64 WA==\n]]] $r
-} -result {1 X}
-test binary-73.26 {binary decode base64} -body {
- list [string length [set r [binary decode base64 WFk=\n]]] $r
-} -result {2 XY}
-test binary-73.27 {binary decode base64} -body {
- list [string length [set r [binary decode base64 WFla\n]]] $r
-} -result {3 XYZ}
-test binary-73.28 {binary decode base64} -body {
- list [string length [set r [binary decode base64 -strict WA==\n]]] $r
-} -returnCodes error -match glob -result {invalid base64 character *}
-test binary-73.29 {binary decode base64} -body {
- list [string length [set r [binary decode base64 -strict WFk=\n]]] $r
-} -returnCodes error -match glob -result {invalid base64 character *}
-test binary-73.30 {binary decode base64} -body {
- list [string length [set r [binary decode base64 -strict WFla\n]]] $r
-} -returnCodes error -match glob -result {invalid base64 character *}
-test binary-73.31 {binary decode base64} -body {
- list [string length [set r [binary decode base64 -strict WA==WFla]]] $r
-} -returnCodes error -match glob -result {invalid base64 character *}
-test binary-73.32 {binary decode base64, bug [00d04c4f12]} -body {
- list \
- [string length [binary decode base64 =]] \
- [string length [binary decode base64 " ="]] \
- [string length [binary decode base64 " ="]] \
- [string length [binary decode base64 "\r\n\t="]] \
-} -result [lrepeat 4 0]
-test binary-73.33 {binary decode base64, bug [00d04c4f12]} -body {
- list \
- [string length [binary decode base64 ==]] \
- [string length [binary decode base64 " =="]] \
- [string length [binary decode base64 " =="]] \
- [string length [binary decode base64 " =="]] \
-} -result [lrepeat 4 0]
-test binary-73.34 {binary decode base64, (compatibility) unfulfilled base64 (single char) in non-strict mode} -body {
- list \
- [expr {[binary decode base64 a] eq [binary decode base64 ""]}] \
- [expr {[binary decode base64 abcda] eq [binary decode base64 "abcd"]}]
-} -result [lrepeat 2 1]
-test binary-73.35 {binary decode base64, bad base64 in strict mode} -body {
- set r {}
- foreach c {a " a" " a" " a" " a" abcda abcdabcda a= a== abcda= abcda==} {
- lappend r \
- [catch {binary decode base64 $c}] \
- [catch {binary decode base64 -strict $c}]
- }
- set r
-} -result [lrepeat 11 0 1]
-test binary-73.36 {binary decode base64: check encoded & decoded equals original} -body {
- set r {}
- for {set i 0} {$i < 255 && [llength $r] < 20} {incr i} {
- foreach c {1 2 3 4 5 6 7 8} {
- set c [string repeat [format %c $i] $c]
- if {[set a [binary decode base64 [set x [binary encode base64 $c]]]] ne $c} {
- lappend r "encode & decode is wrong on string `$c` (encoded: $x): `$a` != `$c`"
- }
- }
- }
- join $r \n
-} -result {}
-test binary-73.37 {binary decode base64: Bug ffeb2097af} {
- binary decode base64 [binary encode base64 -maxlen 3 -wrapchar : abc]
-} abc
-
-test binary-74.1 {binary encode uuencode} -body {
- binary encode uuencode
-} -returnCodes error -match glob -result "wrong # args: *"
-test binary-74.2 {binary encode uuencode} -body {
- binary encode uuencode abc
-} -result {#86)C
-}
-test binary-74.3 {binary encode uuencode} -body {
- binary encode uuencode {}
-} -result {}
-test binary-74.4 {binary encode uuencode} -body {
- binary encode uuencode [string repeat abc 20]
-} -result "M[string repeat 86)C 15]\n/[string repeat 86)C 5]\n"
-test binary-74.5 {binary encode uuencode} -body {
- binary encode uuencode \x00\x01\x02\x03\x04\x00\x01\x02\x03
-} -result ")``\$\"`P0``0(#\n"
-test binary-74.6 {binary encode uuencode} -body {
- binary encode uuencode \0
-} -result {!``
-}
-test binary-74.7 {binary encode uuencode} -body {
- binary encode uuencode \x00\x00
-} -result "\"```
-"
-test binary-74.8 {binary encode uuencode} -body {
- binary encode uuencode \x00\x00\x00
-} -result {#````
-}
-test binary-74.9 {binary encode uuencode} -body {
- binary encode uuencode \x00\x00\x00\x00
-} -result {$``````
-}
-test binary-74.10 {binary encode uuencode} -returnCodes error -body {
- binary encode uuencode -foo 30 abcabcabc
-} -result {bad option "-foo": must be -maxlen or -wrapchar}
-test binary-74.11 {binary encode uuencode} -returnCodes error -body {
- binary encode uuencode -maxlen 4 abcabcabc
-} -result {line length out of range}
-test binary-74.12 {binary encode uuencode} -body {
- binary encode uuencode -maxlen 5 -wrapchar \t abcabcabc
-} -result #86)C\t#86)C\t#86)C\t
-test binary-74.13 {binary encode uuencode} -body {
- binary encode uuencode -maxlen 85 -wrapchar \t abcabcabc
-} -result )86)C86)C86)C\t
-test binary-74.14 {binary encode uuencode} -returnCodes error -body {
- binary encode uuencode -maxlen 86 abcabcabc
-} -result {line length out of range}
-
-test binary-75.1 {binary decode uuencode} -body {
- binary decode uuencode
-} -returnCodes error -match glob -result "wrong # args: *"
-test binary-75.2 {binary decode uuencode} -body {
- binary decode uuencode "#86)C\n"
-} -result {abc}
-test binary-75.3 {binary decode uuencode} -body {
- binary decode uuencode {}
-} -result {}
-test binary-75.3.1 {binary decode uuencode} -body {
- binary decode uuencode `\n
-} -result {}
-test binary-75.4 {binary decode uuencode} -body {
- binary decode uuencode "M[string repeat 86)C 15]\n/[string repeat 86)C 5]\n"
-} -result [string repeat abc 20]
-test binary-75.5 {binary decode uuencode} -body {
- binary decode uuencode ")``\$\"`P0``0(#"
-} -result "\x00\x01\x02\x03\x04\x00\x01\x02\x03"
-test binary-75.6 {binary decode uuencode} -body {
- string length [binary decode uuencode "`\n"]
-} -result 0
-test binary-75.7 {binary decode uuencode} -body {
- string length [binary decode uuencode "!`\n"]
-} -result 1
-test binary-75.8 {binary decode uuencode} -body {
- string length [binary decode uuencode "\"``\n"]
-} -result 2
-test binary-75.9 {binary decode uuencode} -body {
- string length [binary decode uuencode "#```\n"]
-} -result 3
-test binary-75.10 {binary decode uuencode} -body {
- set s ">[string repeat 86)C 10]\n>[string repeat 86)C 10]"
- binary decode uuencode $s
-} -result [string repeat abc 20]
-test binary-75.11 {binary decode uuencode} -body {
- set s ">[string repeat 86)C 10]\n\t>\t[string repeat 86)C 10]\r"
- binary decode uuencode $s
-} -result [string repeat abc 20]
-test binary-75.12 {binary decode uuencode} -body {
- binary decode uuencode -strict "|86)C"
-} -returnCodes error -match glob -result {invalid uuencode character "|" * at position 0}
-test binary-75.13 {binary decode uuencode} -body {
- set s ">[string repeat 86)C 10]|[string repeat 86)C 10]"
- binary decode uuencode -strict $s
-} -returnCodes error -match glob -result {invalid uuencode character "|" * at position 41}
-test binary-75.14 {binary decode uuencode} -body {
- set s ">[string repeat 86)C 10]\na[string repeat 86)C 10]"
- binary decode uuencode -strict $s
-} -returnCodes error -match glob -result {invalid uuencode character *}
-test binary-75.20 {binary decode uuencode} -body {
- set r [binary decode uuencode " 8"]
- list [string length $r] $r
-} -result {0 {}}
-test binary-75.21 {binary decode uuencode} -body {
- set r [binary decode uuencode "!86"]
- list [string length $r] $r
-} -result {1 a}
-test binary-75.22 {binary decode uuencode} -body {
- set r [binary decode uuencode "\"86)"]
- list [string length $r] $r
-} -result {2 ab}
-test binary-75.23 {binary decode uuencode} -body {
- set r [binary decode uuencode "#86)C"]
- list [string length $r] $r
-} -result {3 abc}
-test binary-75.24 {binary decode uuencode} -body {
- set s "#04)\# "
- binary decode uuencode $s
-} -result ABC
-test binary-75.25 {binary decode uuencode} -body {
- set s "#04)\#z"
- binary decode uuencode $s
-} -returnCodes error -match glob -result {invalid uuencode character "z" * at position 5}
-test binary-75.26 {binary decode uuencode} -body {
- string length [binary decode uuencode " "]
-} -result 0
-
-test binary-76.1 {binary string appending growth algorithm} unix {
- # Create zero-length byte array first
- set f [open /dev/null rb]
- chan configure $f -blocking 0
- set str [read $f 2]
- close $f
- # Append to it
- string length [append str [binary format a* foo]]
-} 3
-test binary-76.2 {binary string appending growth algorithm} win {
- # Create zero-length byte array first
- set f [open NUL rb]
- chan configure $f -blocking 0
- set str [read $f 2]
- close $f
- # Append to it
- string length [append str [binary format a* foo]]
-} 3
-
-test binary-77.1 {string cat ops on all bytearrays} {
- apply {{a b} {
- return [binary format H* $a][binary format H* $b]
- }} ab cd
-} [binary format H* abcd]
-test binary-77.2 {string cat ops on all bytearrays} {
- apply {{a b} {
- set one [binary format H* $a]
- return $one[binary format H* $b]
- }} ab cd
-} [binary format H* abcd]
-
-test binary-78.1 {unicode (out of BMP) to byte-array conversion, bug-[bd94500678]} -body {
- # just test for BO-segfault (high surrogate w/o advance source pointer for out of BMP char if TCL_UTF_MAX == 3):
- binary encode hex \U0001f415
- binary scan \U0001f415 a* v; set v
- set str {}
-} -result {}
-
-
-testConstraint testsetbytearraylength \
- [expr {"testsetbytearraylength" in [info commands]}]
-
-test binary-79.1 {Tcl_SetByteArrayLength} testsetbytearraylength {
- testsetbytearraylength [string cat A B C] 1
-} A
-test binary-79.2 {Tcl_SetByteArrayLength} testsetbytearraylength {
- testsetbytearraylength [string cat Ł B C] 1
-} A
-
-test binary-80.1 {Tcl_GetBytesFromObj} -constraints testbytestring -returnCodes 1 -body {
- testbytestring "乎"
-} -result "expected byte sequence but character 0 was '乎' (U+004E4E)"
-test binary-80.2 {Tcl_GetBytesFromObj} -constraints testbytestring -returnCodes 1 -body {
- testbytestring [testbytestring "\x00\xA0\xA0\xA0\xE4\xB9\x8E"]
-} -result "expected byte sequence but character 4 was '乎' (U+004E4E)"
-test binary-80.3 {Tcl_GetBytesFromObj} -constraints testbytestring -returnCodes 1 -body {
- testbytestring [testbytestring "\xC0\x80\xA0\xA0\xA0\xE4\xB9\x8E"]
-} -result "expected byte sequence but character 4 was '乎' (U+004E4E)"
-test binary-80.4 {Tcl_GetBytesFromObj} -constraints testbytestring -returnCodes 1 -body {
- testbytestring [testbytestring "\xC0\x80\xA0\xA0\xA0\xF0\x9F\x98\x81"]
-} -result "expected byte sequence but character 4 was '\U01F601' (U+01F601)"
-
-# ----------------------------------------------------------------------
# cleanup
-
::tcltest::cleanupTests
return