Tcl Source Code

Hex Artifact Content
Login

Artifact fdb0ac933d78eefe750cde84e5d5053fd81872a2:

Attachment "binary.patch" to ticket [3605721fff] added by pointsman 2013-02-23 08:23:38.
0000: 2d 2d 2d 20 74 65 73 74 73 2f 62 69 6e 61 72 79  --- tests/binary
0010: 2e 74 65 73 74 0a 2b 2b 2b 20 74 65 73 74 73 2f  .test.+++ tests/
0020: 62 69 6e 61 72 79 2e 74 65 73 74 0a 40 40 20 2d  binary.test.@@ -
0030: 31 35 38 31 2c 33 39 20 2b 31 35 38 31 2c 33 39  1581,39 +1581,39
0040: 20 40 40 0a 20 20 20 20 20 75 6e 73 65 74 20 2d   @@.     unset -
0050: 6e 6f 63 6f 6d 70 6c 61 69 6e 20 61 72 67 31 0a  nocomplain arg1.
0060: 20 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72       list [binar
0070: 79 20 73 63 61 6e 20 5c 78 66 66 5c 78 66 66 5c  y scan \xff\xff\
0080: 78 66 66 5c 78 66 66 5c 78 66 66 5c 78 66 66 5c  xff\xff\xff\xff\
0090: 78 66 66 5c 78 66 66 20 64 20 61 72 67 31 5d 20  xff\xff d arg1] 
00a0: 24 61 72 67 31 0a 20 7d 20 2d 6d 61 74 63 68 20  $arg1. } -match 
00b0: 67 6c 6f 62 20 2d 72 65 73 75 6c 74 20 7b 31 20  glob -result {1 
00c0: 2d 4e 61 4e 2a 7d 0a 20 0a 20 74 65 73 74 20 62  -NaN*}. . test b
00d0: 69 6e 61 72 79 2d 34 31 2e 31 20 7b 53 63 61 6e  inary-41.1 {Scan
00e0: 4e 75 6d 62 65 72 3a 20 77 6f 72 64 20 61 6c 69  Number: word ali
00f0: 67 6e 6d 65 6e 74 7d 20 7b 0a 2d 20 20 20 20 75  gnment} {.-    u
0100: 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e  nset -nocomplain
0110: 20 61 72 67 31 3b 20 75 6e 73 65 74 20 61 72 67   arg1; unset arg
0120: 32 0a 2b 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f  2.+    unset -no
0130: 63 6f 6d 70 6c 61 69 6e 20 61 72 67 31 3b 20 75  complain arg1; u
0140: 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e  nset -nocomplain
0150: 20 61 72 67 32 0a 20 20 20 20 20 6c 69 73 74 20   arg2.     list 
0160: 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 30  [binary scan \x0
0170: 31 5c 78 30 31 5c 78 30 30 20 63 31 73 31 20 61  1\x01\x00 c1s1 a
0180: 72 67 31 20 61 72 67 32 5d 20 24 61 72 67 31 20  rg1 arg2] $arg1 
0190: 24 61 72 67 32 0a 20 7d 20 7b 32 20 31 20 31 7d  $arg2. } {2 1 1}
01a0: 0a 20 74 65 73 74 20 62 69 6e 61 72 79 2d 34 31  . test binary-41
01b0: 2e 32 20 7b 53 63 61 6e 4e 75 6d 62 65 72 3a 20  .2 {ScanNumber: 
01c0: 77 6f 72 64 20 61 6c 69 67 6e 6d 65 6e 74 7d 20  word alignment} 
01d0: 7b 0a 2d 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f  {.-    unset -no
01e0: 63 6f 6d 70 6c 61 69 6e 20 61 72 67 31 3b 20 75  complain arg1; u
01f0: 6e 73 65 74 20 61 72 67 32 0a 2b 20 20 20 20 75  nset arg2.+    u
0200: 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e  nset -nocomplain
0210: 20 61 72 67 31 3b 20 75 6e 73 65 74 20 2d 6e 6f   arg1; unset -no
0220: 63 6f 6d 70 6c 61 69 6e 20 61 72 67 32 0a 20 20  complain arg2.  
0230: 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20     list [binary 
0240: 73 63 61 6e 20 5c 78 30 31 5c 78 30 30 5c 78 30  scan \x01\x00\x0
0250: 31 20 63 31 53 31 20 61 72 67 31 20 61 72 67 32  1 c1S1 arg1 arg2
0260: 5d 20 24 61 72 67 31 20 24 61 72 67 32 0a 20 7d  ] $arg1 $arg2. }
0270: 20 7b 32 20 31 20 31 7d 0a 20 74 65 73 74 20 62   {2 1 1}. test b
0280: 69 6e 61 72 79 2d 34 31 2e 33 20 7b 53 63 61 6e  inary-41.3 {Scan
0290: 4e 75 6d 62 65 72 3a 20 77 6f 72 64 20 61 6c 69  Number: word ali
02a0: 67 6e 6d 65 6e 74 7d 20 7b 0a 2d 20 20 20 20 75  gnment} {.-    u
02b0: 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e  nset -nocomplain
02c0: 20 61 72 67 31 3b 20 75 6e 73 65 74 20 61 72 67   arg1; unset arg
02d0: 32 0a 2b 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f  2.+    unset -no
02e0: 63 6f 6d 70 6c 61 69 6e 20 61 72 67 31 3b 20 75  complain arg1; u
02f0: 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e  nset -nocomplain
0300: 20 61 72 67 32 0a 20 20 20 20 20 6c 69 73 74 20   arg2.     list 
0310: 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 30  [binary scan \x0
0320: 31 5c 78 30 31 5c 78 30 30 5c 78 30 30 5c 78 30  1\x01\x00\x00\x0
0330: 30 20 63 31 69 31 20 61 72 67 31 20 61 72 67 32  0 c1i1 arg1 arg2
0340: 5d 20 24 61 72 67 31 20 24 61 72 67 32 0a 20 7d  ] $arg1 $arg2. }
0350: 20 7b 32 20 31 20 31 7d 0a 20 74 65 73 74 20 62   {2 1 1}. test b
0360: 69 6e 61 72 79 2d 34 31 2e 34 20 7b 53 63 61 6e  inary-41.4 {Scan
0370: 4e 75 6d 62 65 72 3a 20 77 6f 72 64 20 61 6c 69  Number: word ali
0380: 67 6e 6d 65 6e 74 7d 20 7b 0a 2d 20 20 20 20 75  gnment} {.-    u
0390: 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e  nset -nocomplain
03a0: 20 61 72 67 31 3b 20 75 6e 73 65 74 20 61 72 67   arg1; unset arg
03b0: 32 0a 2b 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f  2.+    unset -no
03c0: 63 6f 6d 70 6c 61 69 6e 20 61 72 67 31 3b 20 75  complain arg1; u
03d0: 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e  nset -nocomplain
03e0: 20 61 72 67 32 0a 20 20 20 20 20 6c 69 73 74 20   arg2.     list 
03f0: 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 30  [binary scan \x0
0400: 31 5c 78 30 30 5c 78 30 30 5c 78 30 30 5c 78 30  1\x00\x00\x00\x0
0410: 31 20 63 31 49 31 20 61 72 67 31 20 61 72 67 32  1 c1I1 arg1 arg2
0420: 5d 20 24 61 72 67 31 20 24 61 72 67 32 0a 20 7d  ] $arg1 $arg2. }
0430: 20 7b 32 20 31 20 31 7d 0a 20 74 65 73 74 20 62   {2 1 1}. test b
0440: 69 6e 61 72 79 2d 34 31 2e 35 20 7b 53 63 61 6e  inary-41.5 {Scan
0450: 4e 75 6d 62 65 72 3a 20 77 6f 72 64 20 61 6c 69  Number: word ali
0460: 67 6e 6d 65 6e 74 7d 20 62 69 67 45 6e 64 69 61  gnment} bigEndia
0470: 6e 20 7b 0a 2d 20 20 20 20 75 6e 73 65 74 20 2d  n {.-    unset -
0480: 6e 6f 63 6f 6d 70 6c 61 69 6e 20 61 72 67 31 3b  nocomplain arg1;
0490: 20 75 6e 73 65 74 20 61 72 67 32 0a 2b 20 20 20   unset arg2.+   
04a0: 20 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61   unset -nocompla
04b0: 69 6e 20 61 72 67 31 3b 20 75 6e 73 65 74 20 2d  in arg1; unset -
04c0: 6e 6f 63 6f 6d 70 6c 61 69 6e 20 61 72 67 32 0a  nocomplain arg2.
04d0: 20 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72       list [binar
04e0: 79 20 73 63 61 6e 20 5c 78 30 31 5c 78 33 66 5c  y scan \x01\x3f\
04f0: 78 63 63 5c 78 63 63 5c 78 63 64 20 63 31 66 31  xcc\xcc\xcd c1f1
0500: 20 61 72 67 31 20 61 72 67 32 5d 20 24 61 72 67   arg1 arg2] $arg
0510: 31 20 24 61 72 67 32 0a 20 7d 20 7b 32 20 31 20  1 $arg2. } {2 1 
0520: 31 2e 36 30 30 30 30 30 30 32 33 38 34 31 38 35  1.60000002384185
0530: 38 7d 0a 20 74 65 73 74 20 62 69 6e 61 72 79 2d  8}. test binary-
0540: 34 31 2e 36 20 7b 53 63 61 6e 4e 75 6d 62 65 72  41.6 {ScanNumber
0550: 3a 20 77 6f 72 64 20 61 6c 69 67 6e 6d 65 6e 74  : word alignment
0560: 7d 20 6c 69 74 74 6c 65 45 6e 64 69 61 6e 20 7b  } littleEndian {
0570: 0a 2d 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63  .-    unset -noc
0580: 6f 6d 70 6c 61 69 6e 20 61 72 67 31 3b 20 75 6e  omplain arg1; un
0590: 73 65 74 20 61 72 67 32 0a 2b 20 20 20 20 75 6e  set arg2.+    un
05a0: 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20  set -nocomplain 
05b0: 61 72 67 31 3b 20 75 6e 73 65 74 20 2d 6e 6f 63  arg1; unset -noc
05c0: 6f 6d 70 6c 61 69 6e 20 61 72 67 32 0a 20 20 20  omplain arg2.   
05d0: 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73    list [binary s
05e0: 63 61 6e 20 5c 78 30 31 5c 78 63 64 5c 78 63 63  can \x01\xcd\xcc
05f0: 5c 78 63 63 5c 78 33 66 20 63 31 66 31 20 61 72  \xcc\x3f c1f1 ar
0600: 67 31 20 61 72 67 32 5d 20 24 61 72 67 31 20 24  g1 arg2] $arg1 $
0610: 61 72 67 32 0a 20 7d 20 7b 32 20 31 20 31 2e 36  arg2. } {2 1 1.6
0620: 30 30 30 30 30 30 32 33 38 34 31 38 35 38 7d 0a  00000023841858}.
0630: 20 74 65 73 74 20 62 69 6e 61 72 79 2d 34 31 2e   test binary-41.
0640: 37 20 7b 53 63 61 6e 4e 75 6d 62 65 72 3a 20 77  7 {ScanNumber: w
0650: 6f 72 64 20 61 6c 69 67 6e 6d 65 6e 74 7d 20 62  ord alignment} b
0660: 69 67 45 6e 64 69 61 6e 20 7b 0a 2d 20 20 20 20  igEndian {.-    
0670: 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69  unset -nocomplai
0680: 6e 20 61 72 67 31 3b 20 75 6e 73 65 74 20 61 72  n arg1; unset ar
0690: 67 32 0a 2b 20 20 20 20 75 6e 73 65 74 20 2d 6e  g2.+    unset -n
06a0: 6f 63 6f 6d 70 6c 61 69 6e 20 61 72 67 31 3b 20  ocomplain arg1; 
06b0: 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69  unset -nocomplai
06c0: 6e 20 61 72 67 32 0a 20 20 20 20 20 6c 69 73 74  n arg2.     list
06d0: 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78   [binary scan \x
06e0: 30 31 5c 78 33 66 5c 78 66 39 5c 78 39 39 5c 78  01\x3f\xf9\x99\x
06f0: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78  99\x99\x99\x99\x
0700: 39 61 20 63 31 64 31 20 61 72 67 31 20 61 72 67  9a c1d1 arg1 arg
0710: 32 5d 20 24 61 72 67 31 20 24 61 72 67 32 0a 20  2] $arg1 $arg2. 
0720: 7d 20 7b 32 20 31 20 31 2e 36 7d 0a 20 74 65 73  } {2 1 1.6}. tes
0730: 74 20 62 69 6e 61 72 79 2d 34 31 2e 38 20 7b 53  t binary-41.8 {S
0740: 63 61 6e 4e 75 6d 62 65 72 3a 20 77 6f 72 64 20  canNumber: word 
0750: 61 6c 69 67 6e 6d 65 6e 74 7d 20 6c 69 74 74 6c  alignment} littl
0760: 65 45 6e 64 69 61 6e 20 7b 0a 2d 20 20 20 20 75  eEndian {.-    u
0770: 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e  nset -nocomplain
0780: 20 61 72 67 31 3b 20 75 6e 73 65 74 20 61 72 67   arg1; unset arg
0790: 32 0a 2b 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f  2.+    unset -no
07a0: 63 6f 6d 70 6c 61 69 6e 20 61 72 67 31 3b 20 75  complain arg1; u
07b0: 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e  nset -nocomplain
07c0: 20 61 72 67 32 0a 20 20 20 20 20 6c 69 73 74 20   arg2.     list 
07d0: 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 30  [binary scan \x0
07e0: 31 5c 78 39 61 5c 78 39 39 5c 78 39 39 5c 78 39  1\x9a\x99\x99\x9
07f0: 39 5c 78 39 39 5c 78 39 39 5c 78 66 39 5c 78 33  9\x99\x99\xf9\x3
0800: 66 20 63 31 64 31 20 61 72 67 31 20 61 72 67 32  f c1d1 arg1 arg2
0810: 5d 20 24 61 72 67 31 20 24 61 72 67 32 0a 20 7d  ] $arg1 $arg2. }
0820: 20 7b 32 20 31 20 31 2e 36 7d 0a 20 0a 20 74 65   {2 1 1.6}. . te
0830: 73 74 20 62 69 6e 61 72 79 2d 34 32 2e 31 20 7b  st binary-42.1 {
0840: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64  Tcl_BinaryObjCmd
0850: 3a 20 62 61 64 20 61 72 67 75 6d 65 6e 74 73 7d  : bad arguments}
0860: 20 2d 63 6f 6e 73 74 72 61 69 6e 74 73 20 7b 7d   -constraints {}
0870: 20 2d 62 6f 64 79 20 7b 0a 20 20 20 20 20 62 69   -body {.     bi
0880: 6e 61 72 79 20 3f 0a 0a                          nary ?..