Artifact
7a882ea17fba4e516b8b400b8ecc772106991a02:
Attachment "patch-tests_binary_test" to
ticket [3551813fff]
added by
stwo
2012-07-30 12:52:05.
0000: 24 4f 70 65 6e 42 53 44 24 0a 2d 2d 2d 20 74 65 $OpenBSD$.--- te
0010: 73 74 73 2f 62 69 6e 61 72 79 2e 74 65 73 74 2e sts/binary.test.
0020: 6f 72 69 67 09 53 75 6e 20 4a 75 6c 20 32 39 20 orig.Sun Jul 29
0030: 32 30 3a 35 33 3a 34 30 20 32 30 31 32 0a 2b 2b 20:53:40 2012.++
0040: 2b 20 74 65 73 74 73 2f 62 69 6e 61 72 79 2e 74 + tests/binary.t
0050: 65 73 74 09 53 75 6e 20 4a 75 6c 20 32 39 20 32 est.Sun Jul 29 2
0060: 31 3a 30 38 3a 35 32 20 32 30 31 32 0a 40 40 20 1:08:52 2012.@@
0070: 2d 31 33 35 34 2c 37 20 2b 31 33 35 34 2c 37 20 -1354,7 +1354,7
0080: 40 40 20 74 65 73 74 20 62 69 6e 61 72 79 2d 33 @@ test binary-3
0090: 35 2e 31 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 5.1 {Tcl_BinaryO
00a0: 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 0a 20 bjCmd: scan} {.
00b0: 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 catch {unset
00c0: 20 61 72 67 31 7d 0a 20 20 20 20 20 63 61 74 63 arg1}. catc
00d0: 68 20 7b 75 6e 73 65 74 20 61 72 67 32 7d 0a 20 h {unset arg2}.
00e0: 20 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20 list [catch
00f0: 7b 62 69 6e 61 72 79 20 73 63 61 6e 20 61 62 63 {binary scan abc
0100: 64 65 66 67 20 61 32 40 61 33 20 61 72 67 31 20 defg a2@a3 arg1
0110: 61 72 67 32 7d 20 6d 73 67 5d 20 24 6d 73 67 0a arg2} msg] $msg.
0120: 2d 7d 20 7b 31 20 7b 6d 69 73 73 69 6e 67 20 63 -} {1 {missing c
0130: 6f 75 6e 74 20 66 6f 72 20 22 40 22 20 66 69 65 ount for "@" fie
0140: 6c 64 20 73 70 65 63 69 66 69 65 72 7d 7d 0a 2b ld specifier}}.+
0150: 7d 20 7b 31 20 7b 6e 6f 74 20 65 6e 6f 75 67 68 } {1 {not enough
0160: 20 61 72 67 75 6d 65 6e 74 73 20 66 6f 72 20 61 arguments for a
0170: 6c 6c 20 66 6f 72 6d 61 74 20 73 70 65 63 69 66 ll format specif
0180: 69 65 72 73 7d 7d 0a 20 74 65 73 74 20 62 69 6e iers}}. test bin
0190: 61 72 79 2d 33 35 2e 32 20 7b 54 63 6c 5f 42 69 ary-35.2 {Tcl_Bi
01a0: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e naryObjCmd: scan
01b0: 7d 20 7b 0a 20 20 20 20 20 63 61 74 63 68 20 7b } {. catch {
01c0: 75 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 20 20 unset arg1}.
01d0: 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 catch {unset ar
01e0: 67 32 7d 0a 40 40 20 2d 32 34 32 35 2c 36 20 2b g2}.@@ -2425,6 +
01f0: 32 34 32 35 2c 32 38 20 40 40 20 74 65 73 74 20 2425,28 @@ test
0200: 62 69 6e 61 72 79 2d 36 35 2e 39 20 7b 6c 61 72 binary-65.9 {lar
0210: 67 65 73 74 20 73 69 67 6e 69 66 69 63 61 6e 64 gest significand
0220: 7d 20 69 65 65 65 46 6c 6f 61 74 69 6e 67 50 6f } ieeeFloatingPo
0230: 69 0a 20 20 20 20 20 62 69 6e 61 72 79 20 73 63 i. binary sc
0240: 61 6e 20 5b 62 69 6e 61 72 79 20 66 6f 72 6d 61 an [binary forma
0250: 74 20 77 20 30 78 34 33 35 30 30 30 30 30 30 30 t w 0x4350000000
0260: 30 30 30 30 30 31 5d 20 71 20 64 0a 20 20 20 20 000001] q d.
0270: 20 73 65 74 20 64 0a 20 7d 20 31 38 30 31 34 33 set d. } 180143
0280: 39 38 35 30 39 34 38 31 39 38 38 2e 30 0a 2b 0a 98509481988.0.+.
0290: 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 37 30 2e +test binary-70.
02a0: 31 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 1 {Tcl_BinaryObj
02b0: 43 6d 64 3a 20 73 63 61 6e 20 40 7d 20 7b 0a 2b Cmd: scan @} {.+
02c0: 20 20 20 20 62 69 6e 61 72 79 20 73 63 61 6e 20 binary scan
02d0: 61 62 63 64 65 66 67 20 40 20 61 72 67 31 0a 2b abcdefg @ arg1.+
02e0: 20 20 20 20 73 65 74 20 61 72 67 31 0a 2b 7d 20 set arg1.+}
02f0: 30 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 37 0.+test binary-7
0300: 30 2e 32 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 0.2 {Tcl_BinaryO
0310: 62 6a 43 6d 64 3a 20 73 63 61 6e 20 40 7d 20 7b bjCmd: scan @} {
0320: 0a 2b 20 20 20 20 62 69 6e 61 72 79 20 73 63 61 .+ binary sca
0330: 6e 20 61 62 63 64 65 66 67 20 40 40 40 20 61 72 n abcdefg @@@ ar
0340: 67 31 20 61 72 67 32 20 61 72 67 33 0a 2b 20 20 g1 arg2 arg3.+
0350: 20 20 6c 69 73 74 20 24 61 72 67 31 20 24 61 72 list $arg1 $ar
0360: 67 32 20 24 61 72 67 33 0a 2b 7d 20 7b 30 20 30 g2 $arg3.+} {0 0
0370: 20 30 7d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 0}.+test binary
0380: 2d 37 30 2e 33 20 7b 54 63 6c 5f 42 69 6e 61 72 -70.3 {Tcl_Binar
0390: 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 20 40 7d yObjCmd: scan @}
03a0: 20 7b 0a 2b 20 20 20 20 62 69 6e 61 72 79 20 73 {.+ binary s
03b0: 63 61 6e 20 61 62 63 64 65 66 67 20 40 32 40 20 can abcdefg @2@
03c0: 61 72 67 31 0a 2b 20 20 20 20 73 65 74 20 61 72 arg1.+ set ar
03d0: 67 31 0a 2b 7d 20 32 0a 2b 74 65 73 74 20 62 69 g1.+} 2.+test bi
03e0: 6e 61 72 79 2d 37 30 2e 34 20 7b 54 63 6c 5f 42 nary-70.4 {Tcl_B
03f0: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 inaryObjCmd: sca
0400: 6e 20 40 7d 20 7b 0a 2b 20 20 20 20 62 69 6e 61 n @} {.+ bina
0410: 72 79 20 73 63 61 6e 20 61 62 63 64 65 66 67 20 ry scan abcdefg
0420: 63 2a 40 20 61 72 67 31 20 61 72 67 32 0a 2b 20 c*@ arg1 arg2.+
0430: 20 20 20 73 65 74 20 61 72 67 32 0a 2b 7d 20 37 set arg2.+} 7
0440: 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 37 30 .+test binary-70
0450: 2e 35 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 .5 {Tcl_BinaryOb
0460: 6a 43 6d 64 3a 20 73 63 61 6e 20 40 7d 20 7b 0a jCmd: scan @} {.
0470: 2b 20 20 20 20 62 69 6e 61 72 79 20 73 63 61 6e + binary scan
0480: 20 61 62 63 64 65 66 67 20 49 40 63 40 20 61 72 abcdefg I@c@ ar
0490: 67 31 20 61 72 67 32 20 61 72 67 33 20 61 72 67 g1 arg2 arg3 arg
04a0: 34 0a 2b 20 20 20 20 6c 69 73 74 20 24 61 72 67 4.+ list $arg
04b0: 32 20 24 61 72 67 34 0a 2b 7d 20 7b 34 20 35 7d 2 $arg4.+} {4 5}
04c0: 0a 2b 0a 20 0a 20 23 20 63 6c 65 61 6e 75 70 0a .+. . # cleanup.
04d0: 20 3a 3a 74 63 6c 74 65 73 74 3a 3a 63 6c 65 61 ::tcltest::clea
04e0: 6e 75 70 54 65 73 74 73 0a nupTests.