/ Hex Artifact Content
Login

Artifact b3475005ea19d53bf8c4573fb6e4a4498be5b434:


0000: 23 20 32 30 30 31 20 53 65 70 74 65 6d 62 65 72  # 2001 September
0010: 20 31 35 0a 23 0a 23 20 54 68 65 20 61 75 74 68   15.#.# The auth
0020: 6f 72 20 64 69 73 63 6c 61 69 6d 73 20 63 6f 70  or disclaims cop
0030: 79 72 69 67 68 74 20 74 6f 20 74 68 69 73 20 73  yright to this s
0040: 6f 75 72 63 65 20 63 6f 64 65 2e 20 20 49 6e 20  ource code.  In 
0050: 70 6c 61 63 65 20 6f 66 0a 23 20 61 20 6c 65 67  place of.# a leg
0060: 61 6c 20 6e 6f 74 69 63 65 2c 20 68 65 72 65 20  al notice, here 
0070: 69 73 20 61 20 62 6c 65 73 73 69 6e 67 3a 0a 23  is a blessing:.#
0080: 0a 23 20 20 20 20 4d 61 79 20 79 6f 75 20 64 6f  .#    May you do
0090: 20 67 6f 6f 64 20 61 6e 64 20 6e 6f 74 20 65 76   good and not ev
00a0: 69 6c 2e 0a 23 20 20 20 20 4d 61 79 20 79 6f 75  il..#    May you
00b0: 20 66 69 6e 64 20 66 6f 72 67 69 76 65 6e 65 73   find forgivenes
00c0: 73 20 66 6f 72 20 79 6f 75 72 73 65 6c 66 20 61  s for yourself a
00d0: 6e 64 20 66 6f 72 67 69 76 65 20 6f 74 68 65 72  nd forgive other
00e0: 73 2e 0a 23 20 20 20 20 4d 61 79 20 79 6f 75 20  s..#    May you 
00f0: 73 68 61 72 65 20 66 72 65 65 6c 79 2c 20 6e 65  share freely, ne
0100: 76 65 72 20 74 61 6b 69 6e 67 20 6d 6f 72 65 20  ver taking more 
0110: 74 68 61 6e 20 79 6f 75 20 67 69 76 65 2e 0a 23  than you give..#
0120: 0a 23 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  .#**************
0130: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0140: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0150: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0160: 2a 2a 2a 2a 2a 2a 2a 2a 2a 0a 23 20 54 68 69 73  *********.# This
0170: 20 66 69 6c 65 20 69 6d 70 6c 65 6d 65 6e 74 73   file implements
0180: 20 72 65 67 72 65 73 73 69 6f 6e 20 74 65 73 74   regression test
0190: 73 20 66 6f 72 20 53 51 4c 69 74 65 20 6c 69 62  s for SQLite lib
01a0: 72 61 72 79 2e 20 20 54 68 65 0a 23 20 66 6f 63  rary.  The.# foc
01b0: 75 73 20 6f 66 20 74 68 69 73 20 66 69 6c 65 20  us of this file 
01c0: 69 73 20 74 65 73 74 69 6e 67 20 65 78 70 72 65  is testing expre
01d0: 73 73 69 6f 6e 73 2e 0a 23 0a 23 20 24 49 64 3a  ssions..#.# $Id:
01e0: 20 65 78 70 72 2e 74 65 73 74 2c 76 20 31 2e 31   expr.test,v 1.1
01f0: 35 20 32 30 30 31 2f 30 39 2f 31 36 20 30 30 3a  5 2001/09/16 00:
0200: 31 33 3a 32 38 20 64 72 68 20 45 78 70 20 24 0a  13:28 drh Exp $.
0210: 0a 73 65 74 20 74 65 73 74 64 69 72 20 5b 66 69  .set testdir [fi
0220: 6c 65 20 64 69 72 6e 61 6d 65 20 24 61 72 67 76  le dirname $argv
0230: 30 5d 0a 73 6f 75 72 63 65 20 24 74 65 73 74 64  0].source $testd
0240: 69 72 2f 74 65 73 74 65 72 2e 74 63 6c 0a 0a 23  ir/tester.tcl..#
0250: 20 43 72 65 61 74 65 20 61 20 74 61 62 6c 65 20   Create a table 
0260: 74 6f 20 77 6f 72 6b 20 77 69 74 68 2e 0a 23 0a  to work with..#.
0270: 65 78 65 63 73 71 6c 20 7b 43 52 45 41 54 45 20  execsql {CREATE 
0280: 54 41 42 4c 45 20 74 65 73 74 31 28 69 31 20 69  TABLE test1(i1 i
0290: 6e 74 2c 20 69 32 20 69 6e 74 2c 20 72 31 20 72  nt, i2 int, r1 r
02a0: 65 61 6c 2c 20 72 32 20 72 65 61 6c 2c 20 74 31  eal, r2 real, t1
02b0: 20 74 65 78 74 2c 20 74 32 20 74 65 78 74 29 7d   text, t2 text)}
02c0: 0a 65 78 65 63 73 71 6c 20 7b 49 4e 53 45 52 54  .execsql {INSERT
02d0: 20 49 4e 54 4f 20 74 65 73 74 31 20 56 41 4c 55   INTO test1 VALU
02e0: 45 53 28 31 2c 32 2c 31 2e 31 2c 32 2e 32 2c 27  ES(1,2,1.1,2.2,'
02f0: 68 65 6c 6c 6f 27 2c 27 77 6f 72 6c 64 27 29 7d  hello','world')}
0300: 0a 70 72 6f 63 20 74 65 73 74 5f 65 78 70 72 20  .proc test_expr 
0310: 7b 6e 61 6d 65 20 73 65 74 74 69 6e 67 73 20 65  {name settings e
0320: 78 70 72 20 72 65 73 75 6c 74 7d 20 7b 0a 20 20  xpr result} {.  
0330: 64 6f 5f 74 65 73 74 20 24 6e 61 6d 65 20 5b 66  do_test $name [f
0340: 6f 72 6d 61 74 20 7b 0a 20 20 20 20 65 78 65 63  ormat {.    exec
0350: 73 71 6c 20 7b 55 50 44 41 54 45 20 74 65 73 74  sql {UPDATE test
0360: 31 20 53 45 54 20 25 73 7d 0a 20 20 20 20 65 78  1 SET %s}.    ex
0370: 65 63 73 71 6c 20 7b 53 45 4c 45 43 54 20 25 73  ecsql {SELECT %s
0380: 20 46 52 4f 4d 20 74 65 73 74 31 7d 0a 20 20 7d   FROM test1}.  }
0390: 20 24 73 65 74 74 69 6e 67 73 20 24 65 78 70 72   $settings $expr
03a0: 5d 20 24 72 65 73 75 6c 74 0a 7d 0a 0a 74 65 73  ] $result.}..tes
03b0: 74 5f 65 78 70 72 20 65 78 70 72 2d 31 2e 31 20  t_expr expr-1.1 
03c0: 7b 69 31 3d 31 30 2c 20 69 32 3d 32 30 7d 20 7b  {i1=10, i2=20} {
03d0: 69 31 2b 69 32 7d 20 33 30 0a 74 65 73 74 5f 65  i1+i2} 30.test_e
03e0: 78 70 72 20 65 78 70 72 2d 31 2e 32 20 7b 69 31  xpr expr-1.2 {i1
03f0: 3d 31 30 2c 20 69 32 3d 32 30 7d 20 7b 69 31 2d  =10, i2=20} {i1-
0400: 69 32 7d 20 2d 31 30 0a 74 65 73 74 5f 65 78 70  i2} -10.test_exp
0410: 72 20 65 78 70 72 2d 31 2e 33 20 7b 69 31 3d 31  r expr-1.3 {i1=1
0420: 30 2c 20 69 32 3d 32 30 7d 20 7b 69 31 2a 69 32  0, i2=20} {i1*i2
0430: 7d 20 32 30 30 0a 74 65 73 74 5f 65 78 70 72 20  } 200.test_expr 
0440: 65 78 70 72 2d 31 2e 34 20 7b 69 31 3d 31 30 2c  expr-1.4 {i1=10,
0450: 20 69 32 3d 32 30 7d 20 7b 69 31 2f 69 32 7d 20   i2=20} {i1/i2} 
0460: 30 2e 35 0a 74 65 73 74 5f 65 78 70 72 20 65 78  0.5.test_expr ex
0470: 70 72 2d 31 2e 35 20 7b 69 31 3d 31 30 2c 20 69  pr-1.5 {i1=10, i
0480: 32 3d 32 30 7d 20 7b 69 32 2f 69 31 7d 20 32 0a  2=20} {i2/i1} 2.
0490: 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 31  test_expr expr-1
04a0: 2e 36 20 7b 69 31 3d 31 30 2c 20 69 32 3d 32 30  .6 {i1=10, i2=20
04b0: 7d 20 7b 69 32 3c 69 31 7d 20 30 0a 74 65 73 74  } {i2<i1} 0.test
04c0: 5f 65 78 70 72 20 65 78 70 72 2d 31 2e 37 20 7b  _expr expr-1.7 {
04d0: 69 31 3d 31 30 2c 20 69 32 3d 32 30 7d 20 7b 69  i1=10, i2=20} {i
04e0: 32 3c 3d 69 31 7d 20 30 0a 74 65 73 74 5f 65 78  2<=i1} 0.test_ex
04f0: 70 72 20 65 78 70 72 2d 31 2e 38 20 7b 69 31 3d  pr expr-1.8 {i1=
0500: 31 30 2c 20 69 32 3d 32 30 7d 20 7b 69 32 3e 69  10, i2=20} {i2>i
0510: 31 7d 20 31 0a 74 65 73 74 5f 65 78 70 72 20 65  1} 1.test_expr e
0520: 78 70 72 2d 31 2e 39 20 7b 69 31 3d 31 30 2c 20  xpr-1.9 {i1=10, 
0530: 69 32 3d 32 30 7d 20 7b 69 32 3e 3d 69 31 7d 20  i2=20} {i2>=i1} 
0540: 31 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72  1.test_expr expr
0550: 2d 31 2e 31 30 20 7b 69 31 3d 31 30 2c 20 69 32  -1.10 {i1=10, i2
0560: 3d 32 30 7d 20 7b 69 32 21 3d 69 31 7d 20 31 0a  =20} {i2!=i1} 1.
0570: 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 31  test_expr expr-1
0580: 2e 31 31 20 7b 69 31 3d 31 30 2c 20 69 32 3d 32  .11 {i1=10, i2=2
0590: 30 7d 20 7b 69 32 3d 69 31 7d 20 30 0a 74 65 73  0} {i2=i1} 0.tes
05a0: 74 5f 65 78 70 72 20 65 78 70 72 2d 31 2e 31 32  t_expr expr-1.12
05b0: 20 7b 69 31 3d 31 30 2c 20 69 32 3d 32 30 7d 20   {i1=10, i2=20} 
05c0: 7b 69 32 3c 3e 69 31 7d 20 31 0a 74 65 73 74 5f  {i2<>i1} 1.test_
05d0: 65 78 70 72 20 65 78 70 72 2d 31 2e 31 33 20 7b  expr expr-1.13 {
05e0: 69 31 3d 31 30 2c 20 69 32 3d 32 30 7d 20 7b 69  i1=10, i2=20} {i
05f0: 32 3d 3d 69 31 7d 20 30 0a 74 65 73 74 5f 65 78  2==i1} 0.test_ex
0600: 70 72 20 65 78 70 72 2d 31 2e 31 34 20 7b 69 31  pr expr-1.14 {i1
0610: 3d 32 30 2c 20 69 32 3d 32 30 7d 20 7b 69 32 3c  =20, i2=20} {i2<
0620: 69 31 7d 20 30 0a 74 65 73 74 5f 65 78 70 72 20  i1} 0.test_expr 
0630: 65 78 70 72 2d 31 2e 31 35 20 7b 69 31 3d 32 30  expr-1.15 {i1=20
0640: 2c 20 69 32 3d 32 30 7d 20 7b 69 32 3c 3d 69 31  , i2=20} {i2<=i1
0650: 7d 20 31 0a 74 65 73 74 5f 65 78 70 72 20 65 78  } 1.test_expr ex
0660: 70 72 2d 31 2e 31 36 20 7b 69 31 3d 32 30 2c 20  pr-1.16 {i1=20, 
0670: 69 32 3d 32 30 7d 20 7b 69 32 3e 69 31 7d 20 30  i2=20} {i2>i1} 0
0680: 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d  .test_expr expr-
0690: 31 2e 31 37 20 7b 69 31 3d 32 30 2c 20 69 32 3d  1.17 {i1=20, i2=
06a0: 32 30 7d 20 7b 69 32 3e 3d 69 31 7d 20 31 0a 74  20} {i2>=i1} 1.t
06b0: 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 31 2e  est_expr expr-1.
06c0: 31 38 20 7b 69 31 3d 32 30 2c 20 69 32 3d 32 30  18 {i1=20, i2=20
06d0: 7d 20 7b 69 32 21 3d 69 31 7d 20 30 0a 74 65 73  } {i2!=i1} 0.tes
06e0: 74 5f 65 78 70 72 20 65 78 70 72 2d 31 2e 31 39  t_expr expr-1.19
06f0: 20 7b 69 31 3d 32 30 2c 20 69 32 3d 32 30 7d 20   {i1=20, i2=20} 
0700: 7b 69 32 3d 69 31 7d 20 31 0a 74 65 73 74 5f 65  {i2=i1} 1.test_e
0710: 78 70 72 20 65 78 70 72 2d 31 2e 32 30 20 7b 69  xpr expr-1.20 {i
0720: 31 3d 32 30 2c 20 69 32 3d 32 30 7d 20 7b 69 32  1=20, i2=20} {i2
0730: 3c 3e 69 31 7d 20 30 0a 74 65 73 74 5f 65 78 70  <>i1} 0.test_exp
0740: 72 20 65 78 70 72 2d 31 2e 32 31 20 7b 69 31 3d  r expr-1.21 {i1=
0750: 32 30 2c 20 69 32 3d 32 30 7d 20 7b 69 32 3d 3d  20, i2=20} {i2==
0760: 69 31 7d 20 31 0a 74 65 73 74 5f 65 78 70 72 20  i1} 1.test_expr 
0770: 65 78 70 72 2d 31 2e 32 32 20 7b 69 31 3d 31 2c  expr-1.22 {i1=1,
0780: 20 69 32 3d 32 2c 20 72 31 3d 33 2e 30 7d 20 7b   i2=2, r1=3.0} {
0790: 69 31 2b 69 32 2a 72 31 7d 20 7b 37 7d 0a 74 65  i1+i2*r1} {7}.te
07a0: 73 74 5f 65 78 70 72 20 65 78 70 72 2d 31 2e 32  st_expr expr-1.2
07b0: 33 20 7b 69 31 3d 31 2c 20 69 32 3d 32 2c 20 72  3 {i1=1, i2=2, r
07c0: 31 3d 33 2e 30 7d 20 7b 28 69 31 2b 69 32 29 2a  1=3.0} {(i1+i2)*
07d0: 72 31 7d 20 7b 39 7d 0a 74 65 73 74 5f 65 78 70  r1} {9}.test_exp
07e0: 72 20 65 78 70 72 2d 31 2e 32 34 20 7b 69 31 3d  r expr-1.24 {i1=
07f0: 31 2c 20 69 32 3d 32 7d 20 7b 6d 69 6e 28 69 31  1, i2=2} {min(i1
0800: 2c 69 32 2c 69 31 2b 69 32 2c 69 31 2d 69 32 29  ,i2,i1+i2,i1-i2)
0810: 7d 20 7b 2d 31 7d 0a 74 65 73 74 5f 65 78 70 72  } {-1}.test_expr
0820: 20 65 78 70 72 2d 31 2e 32 35 20 7b 69 31 3d 31   expr-1.25 {i1=1
0830: 2c 20 69 32 3d 32 7d 20 7b 6d 61 78 28 69 31 2c  , i2=2} {max(i1,
0840: 69 32 2c 69 31 2b 69 32 2c 69 31 2d 69 32 29 7d  i2,i1+i2,i1-i2)}
0850: 20 7b 33 7d 0a 74 65 73 74 5f 65 78 70 72 20 65   {3}.test_expr e
0860: 78 70 72 2d 31 2e 32 36 20 7b 69 31 3d 31 2c 20  xpr-1.26 {i1=1, 
0870: 69 32 3d 32 7d 20 7b 6d 61 78 28 69 31 2c 69 32  i2=2} {max(i1,i2
0880: 2c 69 31 2b 69 32 2c 69 31 2d 69 32 29 7d 20 7b  ,i1+i2,i1-i2)} {
0890: 33 7d 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70  3}.test_expr exp
08a0: 72 2d 31 2e 32 37 20 7b 69 31 3d 31 2c 20 69 32  r-1.27 {i1=1, i2
08b0: 3d 32 7d 20 7b 69 31 3d 3d 31 20 41 4e 44 20 69  =2} {i1==1 AND i
08c0: 32 3d 32 7d 20 7b 31 7d 0a 74 65 73 74 5f 65 78  2=2} {1}.test_ex
08d0: 70 72 20 65 78 70 72 2d 31 2e 32 38 20 7b 69 31  pr expr-1.28 {i1
08e0: 3d 31 2c 20 69 32 3d 32 7d 20 7b 69 31 3d 32 20  =1, i2=2} {i1=2 
08f0: 41 4e 44 20 69 32 3d 31 7d 20 7b 30 7d 0a 74 65  AND i2=1} {0}.te
0900: 73 74 5f 65 78 70 72 20 65 78 70 72 2d 31 2e 32  st_expr expr-1.2
0910: 39 20 7b 69 31 3d 31 2c 20 69 32 3d 32 7d 20 7b  9 {i1=1, i2=2} {
0920: 69 31 3d 31 20 41 4e 44 20 69 32 3d 31 7d 20 7b  i1=1 AND i2=1} {
0930: 30 7d 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70  0}.test_expr exp
0940: 72 2d 31 2e 33 30 20 7b 69 31 3d 31 2c 20 69 32  r-1.30 {i1=1, i2
0950: 3d 32 7d 20 7b 69 31 3d 32 20 41 4e 44 20 69 32  =2} {i1=2 AND i2
0960: 3d 32 7d 20 7b 30 7d 0a 74 65 73 74 5f 65 78 70  =2} {0}.test_exp
0970: 72 20 65 78 70 72 2d 31 2e 33 31 20 7b 69 31 3d  r expr-1.31 {i1=
0980: 31 2c 20 69 32 3d 32 7d 20 7b 69 31 3d 3d 31 20  1, i2=2} {i1==1 
0990: 4f 52 20 69 32 3d 32 7d 20 7b 31 7d 0a 74 65 73  OR i2=2} {1}.tes
09a0: 74 5f 65 78 70 72 20 65 78 70 72 2d 31 2e 33 32  t_expr expr-1.32
09b0: 20 7b 69 31 3d 31 2c 20 69 32 3d 32 7d 20 7b 69   {i1=1, i2=2} {i
09c0: 31 3d 32 20 4f 52 20 69 32 3d 31 7d 20 7b 30 7d  1=2 OR i2=1} {0}
09d0: 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d  .test_expr expr-
09e0: 31 2e 33 33 20 7b 69 31 3d 31 2c 20 69 32 3d 32  1.33 {i1=1, i2=2
09f0: 7d 20 7b 69 31 3d 31 20 4f 52 20 69 32 3d 31 7d  } {i1=1 OR i2=1}
0a00: 20 7b 31 7d 0a 74 65 73 74 5f 65 78 70 72 20 65   {1}.test_expr e
0a10: 78 70 72 2d 31 2e 33 34 20 7b 69 31 3d 31 2c 20  xpr-1.34 {i1=1, 
0a20: 69 32 3d 32 7d 20 7b 69 31 3d 32 20 4f 52 20 69  i2=2} {i1=2 OR i
0a30: 32 3d 32 7d 20 7b 31 7d 0a 74 65 73 74 5f 65 78  2=2} {1}.test_ex
0a40: 70 72 20 65 78 70 72 2d 31 2e 33 35 20 7b 69 31  pr expr-1.35 {i1
0a50: 3d 31 2c 20 69 32 3d 32 7d 20 7b 69 31 2d 69 32  =1, i2=2} {i1-i2
0a60: 3d 2d 31 7d 20 7b 31 7d 0a 74 65 73 74 5f 65 78  =-1} {1}.test_ex
0a70: 70 72 20 65 78 70 72 2d 31 2e 33 36 20 7b 69 31  pr expr-1.36 {i1
0a80: 3d 31 2c 20 69 32 3d 30 7d 20 7b 6e 6f 74 20 69  =1, i2=0} {not i
0a90: 31 7d 20 7b 30 7d 0a 74 65 73 74 5f 65 78 70 72  1} {0}.test_expr
0aa0: 20 65 78 70 72 2d 31 2e 33 37 20 7b 69 31 3d 31   expr-1.37 {i1=1
0ab0: 2c 20 69 32 3d 4e 55 4c 4c 7d 20 7b 6e 6f 74 20  , i2=NULL} {not 
0ac0: 69 32 7d 20 7b 31 7d 0a 74 65 73 74 5f 65 78 70  i2} {1}.test_exp
0ad0: 72 20 65 78 70 72 2d 31 2e 33 38 20 7b 69 31 3d  r expr-1.38 {i1=
0ae0: 31 7d 20 7b 2d 69 31 7d 20 7b 2d 31 7d 0a 74 65  1} {-i1} {-1}.te
0af0: 73 74 5f 65 78 70 72 20 65 78 70 72 2d 31 2e 33  st_expr expr-1.3
0b00: 39 20 7b 69 31 3d 31 7d 20 7b 2b 69 31 7d 20 7b  9 {i1=1} {+i1} {
0b10: 31 7d 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70  1}.test_expr exp
0b20: 72 2d 31 2e 34 30 20 7b 69 31 3d 31 2c 20 69 32  r-1.40 {i1=1, i2
0b30: 3d 32 7d 20 7b 2b 28 69 32 2b 69 31 29 7d 20 7b  =2} {+(i2+i1)} {
0b40: 33 7d 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70  3}.test_expr exp
0b50: 72 2d 31 2e 34 31 20 7b 69 31 3d 31 2c 20 69 32  r-1.41 {i1=1, i2
0b60: 3d 32 7d 20 7b 2d 28 69 32 2b 69 31 29 7d 20 7b  =2} {-(i2+i1)} {
0b70: 2d 33 7d 0a 0a 74 65 73 74 5f 65 78 70 72 20 65  -3}..test_expr e
0b80: 78 70 72 2d 32 2e 31 20 7b 72 31 3d 31 2e 32 33  xpr-2.1 {r1=1.23
0b90: 2c 20 72 32 3d 32 2e 33 34 7d 20 7b 72 31 2b 72  , r2=2.34} {r1+r
0ba0: 32 7d 20 33 2e 35 37 0a 74 65 73 74 5f 65 78 70  2} 3.57.test_exp
0bb0: 72 20 65 78 70 72 2d 32 2e 32 20 7b 72 31 3d 31  r expr-2.2 {r1=1
0bc0: 2e 32 33 2c 20 72 32 3d 32 2e 33 34 7d 20 7b 72  .23, r2=2.34} {r
0bd0: 31 2d 72 32 7d 20 2d 31 2e 31 31 0a 74 65 73 74  1-r2} -1.11.test
0be0: 5f 65 78 70 72 20 65 78 70 72 2d 32 2e 33 20 7b  _expr expr-2.3 {
0bf0: 72 31 3d 31 2e 32 33 2c 20 72 32 3d 32 2e 33 34  r1=1.23, r2=2.34
0c00: 7d 20 7b 72 31 2a 72 32 7d 20 32 2e 38 37 38 32  } {r1*r2} 2.8782
0c10: 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d  .test_expr expr-
0c20: 32 2e 34 20 7b 72 31 3d 31 2e 32 33 2c 20 72 32  2.4 {r1=1.23, r2
0c30: 3d 32 2e 33 34 7d 20 7b 72 31 2f 72 32 7d 20 30  =2.34} {r1/r2} 0
0c40: 2e 35 32 35 36 34 31 30 32 35 36 34 31 30 32 36  .525641025641026
0c50: 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d  .test_expr expr-
0c60: 32 2e 35 20 7b 72 31 3d 31 2e 32 33 2c 20 72 32  2.5 {r1=1.23, r2
0c70: 3d 32 2e 33 34 7d 20 7b 72 32 2f 72 31 7d 20 31  =2.34} {r2/r1} 1
0c80: 2e 39 30 32 34 33 39 30 32 34 33 39 30 32 34 0a  .90243902439024.
0c90: 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 32  test_expr expr-2
0ca0: 2e 36 20 7b 72 31 3d 31 2e 32 33 2c 20 72 32 3d  .6 {r1=1.23, r2=
0cb0: 32 2e 33 34 7d 20 7b 72 32 3c 72 31 7d 20 30 0a  2.34} {r2<r1} 0.
0cc0: 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 32  test_expr expr-2
0cd0: 2e 37 20 7b 72 31 3d 31 2e 32 33 2c 20 72 32 3d  .7 {r1=1.23, r2=
0ce0: 32 2e 33 34 7d 20 7b 72 32 3c 3d 72 31 7d 20 30  2.34} {r2<=r1} 0
0cf0: 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d  .test_expr expr-
0d00: 32 2e 38 20 7b 72 31 3d 31 2e 32 33 2c 20 72 32  2.8 {r1=1.23, r2
0d10: 3d 32 2e 33 34 7d 20 7b 72 32 3e 72 31 7d 20 31  =2.34} {r2>r1} 1
0d20: 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d  .test_expr expr-
0d30: 32 2e 39 20 7b 72 31 3d 31 2e 32 33 2c 20 72 32  2.9 {r1=1.23, r2
0d40: 3d 32 2e 33 34 7d 20 7b 72 32 3e 3d 72 31 7d 20  =2.34} {r2>=r1} 
0d50: 31 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72  1.test_expr expr
0d60: 2d 32 2e 31 30 20 7b 72 31 3d 31 2e 32 33 2c 20  -2.10 {r1=1.23, 
0d70: 72 32 3d 32 2e 33 34 7d 20 7b 72 32 21 3d 72 31  r2=2.34} {r2!=r1
0d80: 7d 20 31 0a 74 65 73 74 5f 65 78 70 72 20 65 78  } 1.test_expr ex
0d90: 70 72 2d 32 2e 31 31 20 7b 72 31 3d 31 2e 32 33  pr-2.11 {r1=1.23
0da0: 2c 20 72 32 3d 32 2e 33 34 7d 20 7b 72 32 3d 72  , r2=2.34} {r2=r
0db0: 31 7d 20 30 0a 74 65 73 74 5f 65 78 70 72 20 65  1} 0.test_expr e
0dc0: 78 70 72 2d 32 2e 31 32 20 7b 72 31 3d 31 2e 32  xpr-2.12 {r1=1.2
0dd0: 33 2c 20 72 32 3d 32 2e 33 34 7d 20 7b 72 32 3c  3, r2=2.34} {r2<
0de0: 3e 72 31 7d 20 31 0a 74 65 73 74 5f 65 78 70 72  >r1} 1.test_expr
0df0: 20 65 78 70 72 2d 32 2e 31 33 20 7b 72 31 3d 31   expr-2.13 {r1=1
0e00: 2e 32 33 2c 20 72 32 3d 32 2e 33 34 7d 20 7b 72  .23, r2=2.34} {r
0e10: 32 3d 3d 72 31 7d 20 30 0a 74 65 73 74 5f 65 78  2==r1} 0.test_ex
0e20: 70 72 20 65 78 70 72 2d 32 2e 31 34 20 7b 72 31  pr expr-2.14 {r1
0e30: 3d 32 2e 33 34 2c 20 72 32 3d 32 2e 33 34 7d 20  =2.34, r2=2.34} 
0e40: 7b 72 32 3c 72 31 7d 20 30 0a 74 65 73 74 5f 65  {r2<r1} 0.test_e
0e50: 78 70 72 20 65 78 70 72 2d 32 2e 31 35 20 7b 72  xpr expr-2.15 {r
0e60: 31 3d 32 2e 33 34 2c 20 72 32 3d 32 2e 33 34 7d  1=2.34, r2=2.34}
0e70: 20 7b 72 32 3c 3d 72 31 7d 20 31 0a 74 65 73 74   {r2<=r1} 1.test
0e80: 5f 65 78 70 72 20 65 78 70 72 2d 32 2e 31 36 20  _expr expr-2.16 
0e90: 7b 72 31 3d 32 2e 33 34 2c 20 72 32 3d 32 2e 33  {r1=2.34, r2=2.3
0ea0: 34 7d 20 7b 72 32 3e 72 31 7d 20 30 0a 74 65 73  4} {r2>r1} 0.tes
0eb0: 74 5f 65 78 70 72 20 65 78 70 72 2d 32 2e 31 37  t_expr expr-2.17
0ec0: 20 7b 72 31 3d 32 2e 33 34 2c 20 72 32 3d 32 2e   {r1=2.34, r2=2.
0ed0: 33 34 7d 20 7b 72 32 3e 3d 72 31 7d 20 31 0a 74  34} {r2>=r1} 1.t
0ee0: 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 32 2e  est_expr expr-2.
0ef0: 31 38 20 7b 72 31 3d 32 2e 33 34 2c 20 72 32 3d  18 {r1=2.34, r2=
0f00: 32 2e 33 34 7d 20 7b 72 32 21 3d 72 31 7d 20 30  2.34} {r2!=r1} 0
0f10: 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d  .test_expr expr-
0f20: 32 2e 31 39 20 7b 72 31 3d 32 2e 33 34 2c 20 72  2.19 {r1=2.34, r
0f30: 32 3d 32 2e 33 34 7d 20 7b 72 32 3d 72 31 7d 20  2=2.34} {r2=r1} 
0f40: 31 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72  1.test_expr expr
0f50: 2d 32 2e 32 30 20 7b 72 31 3d 32 2e 33 34 2c 20  -2.20 {r1=2.34, 
0f60: 72 32 3d 32 2e 33 34 7d 20 7b 72 32 3c 3e 72 31  r2=2.34} {r2<>r1
0f70: 7d 20 30 0a 74 65 73 74 5f 65 78 70 72 20 65 78  } 0.test_expr ex
0f80: 70 72 2d 32 2e 32 31 20 7b 72 31 3d 32 2e 33 34  pr-2.21 {r1=2.34
0f90: 2c 20 72 32 3d 32 2e 33 34 7d 20 7b 72 32 3d 3d  , r2=2.34} {r2==
0fa0: 72 31 7d 20 31 0a 74 65 73 74 5f 65 78 70 72 20  r1} 1.test_expr 
0fb0: 65 78 70 72 2d 32 2e 32 32 20 7b 72 31 3d 31 2e  expr-2.22 {r1=1.
0fc0: 32 33 2c 20 72 32 3d 32 2e 33 34 7d 20 7b 6d 69  23, r2=2.34} {mi
0fd0: 6e 28 72 31 2c 72 32 2c 72 31 2b 72 32 2c 72 31  n(r1,r2,r1+r2,r1
0fe0: 2d 72 32 29 7d 20 7b 2d 31 2e 31 31 7d 0a 74 65  -r2)} {-1.11}.te
0ff0: 73 74 5f 65 78 70 72 20 65 78 70 72 2d 32 2e 32  st_expr expr-2.2
1000: 33 20 7b 72 31 3d 31 2e 32 33 2c 20 72 32 3d 32  3 {r1=1.23, r2=2
1010: 2e 33 34 7d 20 7b 6d 61 78 28 72 31 2c 72 32 2c  .34} {max(r1,r2,
1020: 72 31 2b 72 32 2c 72 31 2d 72 32 29 7d 20 7b 33  r1+r2,r1-r2)} {3
1030: 2e 35 37 7d 0a 0a 74 65 73 74 5f 65 78 70 72 20  .57}..test_expr 
1040: 65 78 70 72 2d 33 2e 31 20 7b 74 31 3d 27 61 62  expr-3.1 {t1='ab
1050: 63 27 2c 20 74 32 3d 27 78 79 7a 27 7d 20 7b 74  c', t2='xyz'} {t
1060: 31 3c 74 32 7d 20 31 0a 74 65 73 74 5f 65 78 70  1<t2} 1.test_exp
1070: 72 20 65 78 70 72 2d 33 2e 32 20 7b 74 31 3d 27  r expr-3.2 {t1='
1080: 78 79 7a 27 2c 20 74 32 3d 27 61 62 63 27 7d 20  xyz', t2='abc'} 
1090: 7b 74 31 3c 74 32 7d 20 30 0a 74 65 73 74 5f 65  {t1<t2} 0.test_e
10a0: 78 70 72 20 65 78 70 72 2d 33 2e 33 20 7b 74 31  xpr expr-3.3 {t1
10b0: 3d 27 61 62 63 27 2c 20 74 32 3d 27 61 62 63 27  ='abc', t2='abc'
10c0: 7d 20 7b 74 31 3c 74 32 7d 20 30 0a 74 65 73 74  } {t1<t2} 0.test
10d0: 5f 65 78 70 72 20 65 78 70 72 2d 33 2e 34 20 7b  _expr expr-3.4 {
10e0: 74 31 3d 27 61 62 63 27 2c 20 74 32 3d 27 78 79  t1='abc', t2='xy
10f0: 7a 27 7d 20 7b 74 31 3c 3d 74 32 7d 20 31 0a 74  z'} {t1<=t2} 1.t
1100: 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 33 2e  est_expr expr-3.
1110: 35 20 7b 74 31 3d 27 78 79 7a 27 2c 20 74 32 3d  5 {t1='xyz', t2=
1120: 27 61 62 63 27 7d 20 7b 74 31 3c 3d 74 32 7d 20  'abc'} {t1<=t2} 
1130: 30 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72  0.test_expr expr
1140: 2d 33 2e 36 20 7b 74 31 3d 27 61 62 63 27 2c 20  -3.6 {t1='abc', 
1150: 74 32 3d 27 61 62 63 27 7d 20 7b 74 31 3c 3d 74  t2='abc'} {t1<=t
1160: 32 7d 20 31 0a 74 65 73 74 5f 65 78 70 72 20 65  2} 1.test_expr e
1170: 78 70 72 2d 33 2e 37 20 7b 74 31 3d 27 61 62 63  xpr-3.7 {t1='abc
1180: 27 2c 20 74 32 3d 27 78 79 7a 27 7d 20 7b 74 31  ', t2='xyz'} {t1
1190: 3e 74 32 7d 20 30 0a 74 65 73 74 5f 65 78 70 72  >t2} 0.test_expr
11a0: 20 65 78 70 72 2d 33 2e 38 20 7b 74 31 3d 27 78   expr-3.8 {t1='x
11b0: 79 7a 27 2c 20 74 32 3d 27 61 62 63 27 7d 20 7b  yz', t2='abc'} {
11c0: 74 31 3e 74 32 7d 20 31 0a 74 65 73 74 5f 65 78  t1>t2} 1.test_ex
11d0: 70 72 20 65 78 70 72 2d 33 2e 39 20 7b 74 31 3d  pr expr-3.9 {t1=
11e0: 27 61 62 63 27 2c 20 74 32 3d 27 61 62 63 27 7d  'abc', t2='abc'}
11f0: 20 7b 74 31 3e 74 32 7d 20 30 0a 74 65 73 74 5f   {t1>t2} 0.test_
1200: 65 78 70 72 20 65 78 70 72 2d 33 2e 31 30 20 7b  expr expr-3.10 {
1210: 74 31 3d 27 61 62 63 27 2c 20 74 32 3d 27 78 79  t1='abc', t2='xy
1220: 7a 27 7d 20 7b 74 31 3e 3d 74 32 7d 20 30 0a 74  z'} {t1>=t2} 0.t
1230: 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 33 2e  est_expr expr-3.
1240: 31 31 20 7b 74 31 3d 27 78 79 7a 27 2c 20 74 32  11 {t1='xyz', t2
1250: 3d 27 61 62 63 27 7d 20 7b 74 31 3e 3d 74 32 7d  ='abc'} {t1>=t2}
1260: 20 31 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70   1.test_expr exp
1270: 72 2d 33 2e 31 32 20 7b 74 31 3d 27 61 62 63 27  r-3.12 {t1='abc'
1280: 2c 20 74 32 3d 27 61 62 63 27 7d 20 7b 74 31 3e  , t2='abc'} {t1>
1290: 3d 74 32 7d 20 31 0a 74 65 73 74 5f 65 78 70 72  =t2} 1.test_expr
12a0: 20 65 78 70 72 2d 33 2e 31 33 20 7b 74 31 3d 27   expr-3.13 {t1='
12b0: 61 62 63 27 2c 20 74 32 3d 27 78 79 7a 27 7d 20  abc', t2='xyz'} 
12c0: 7b 74 31 3d 74 32 7d 20 30 0a 74 65 73 74 5f 65  {t1=t2} 0.test_e
12d0: 78 70 72 20 65 78 70 72 2d 33 2e 31 34 20 7b 74  xpr expr-3.14 {t
12e0: 31 3d 27 78 79 7a 27 2c 20 74 32 3d 27 61 62 63  1='xyz', t2='abc
12f0: 27 7d 20 7b 74 31 3d 74 32 7d 20 30 0a 74 65 73  '} {t1=t2} 0.tes
1300: 74 5f 65 78 70 72 20 65 78 70 72 2d 33 2e 31 35  t_expr expr-3.15
1310: 20 7b 74 31 3d 27 61 62 63 27 2c 20 74 32 3d 27   {t1='abc', t2='
1320: 61 62 63 27 7d 20 7b 74 31 3d 74 32 7d 20 31 0a  abc'} {t1=t2} 1.
1330: 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 33  test_expr expr-3
1340: 2e 31 36 20 7b 74 31 3d 27 61 62 63 27 2c 20 74  .16 {t1='abc', t
1350: 32 3d 27 78 79 7a 27 7d 20 7b 74 31 3d 3d 74 32  2='xyz'} {t1==t2
1360: 7d 20 30 0a 74 65 73 74 5f 65 78 70 72 20 65 78  } 0.test_expr ex
1370: 70 72 2d 33 2e 31 37 20 7b 74 31 3d 27 78 79 7a  pr-3.17 {t1='xyz
1380: 27 2c 20 74 32 3d 27 61 62 63 27 7d 20 7b 74 31  ', t2='abc'} {t1
1390: 3d 3d 74 32 7d 20 30 0a 74 65 73 74 5f 65 78 70  ==t2} 0.test_exp
13a0: 72 20 65 78 70 72 2d 33 2e 31 38 20 7b 74 31 3d  r expr-3.18 {t1=
13b0: 27 61 62 63 27 2c 20 74 32 3d 27 61 62 63 27 7d  'abc', t2='abc'}
13c0: 20 7b 74 31 3d 3d 74 32 7d 20 31 0a 74 65 73 74   {t1==t2} 1.test
13d0: 5f 65 78 70 72 20 65 78 70 72 2d 33 2e 31 39 20  _expr expr-3.19 
13e0: 7b 74 31 3d 27 61 62 63 27 2c 20 74 32 3d 27 78  {t1='abc', t2='x
13f0: 79 7a 27 7d 20 7b 74 31 3c 3e 74 32 7d 20 31 0a  yz'} {t1<>t2} 1.
1400: 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 33  test_expr expr-3
1410: 2e 32 30 20 7b 74 31 3d 27 78 79 7a 27 2c 20 74  .20 {t1='xyz', t
1420: 32 3d 27 61 62 63 27 7d 20 7b 74 31 3c 3e 74 32  2='abc'} {t1<>t2
1430: 7d 20 31 0a 74 65 73 74 5f 65 78 70 72 20 65 78  } 1.test_expr ex
1440: 70 72 2d 33 2e 32 31 20 7b 74 31 3d 27 61 62 63  pr-3.21 {t1='abc
1450: 27 2c 20 74 32 3d 27 61 62 63 27 7d 20 7b 74 31  ', t2='abc'} {t1
1460: 3c 3e 74 32 7d 20 30 0a 74 65 73 74 5f 65 78 70  <>t2} 0.test_exp
1470: 72 20 65 78 70 72 2d 33 2e 32 32 20 7b 74 31 3d  r expr-3.22 {t1=
1480: 27 61 62 63 27 2c 20 74 32 3d 27 78 79 7a 27 7d  'abc', t2='xyz'}
1490: 20 7b 74 31 21 3d 74 32 7d 20 31 0a 74 65 73 74   {t1!=t2} 1.test
14a0: 5f 65 78 70 72 20 65 78 70 72 2d 33 2e 32 33 20  _expr expr-3.23 
14b0: 7b 74 31 3d 27 78 79 7a 27 2c 20 74 32 3d 27 61  {t1='xyz', t2='a
14c0: 62 63 27 7d 20 7b 74 31 21 3d 74 32 7d 20 31 0a  bc'} {t1!=t2} 1.
14d0: 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 33  test_expr expr-3
14e0: 2e 32 34 20 7b 74 31 3d 27 61 62 63 27 2c 20 74  .24 {t1='abc', t
14f0: 32 3d 27 61 62 63 27 7d 20 7b 74 31 21 3d 74 32  2='abc'} {t1!=t2
1500: 7d 20 30 0a 74 65 73 74 5f 65 78 70 72 20 65 78  } 0.test_expr ex
1510: 70 72 2d 33 2e 32 35 20 7b 74 31 3d 4e 55 4c 4c  pr-3.25 {t1=NULL
1520: 2c 20 74 32 3d 27 68 69 27 7d 20 7b 74 31 20 69  , t2='hi'} {t1 i
1530: 73 6e 75 6c 6c 7d 20 31 0a 74 65 73 74 5f 65 78  snull} 1.test_ex
1540: 70 72 20 65 78 70 72 2d 33 2e 32 36 20 7b 74 31  pr expr-3.26 {t1
1550: 3d 4e 55 4c 4c 2c 20 74 32 3d 27 68 69 27 7d 20  =NULL, t2='hi'} 
1560: 7b 74 32 20 69 73 6e 75 6c 6c 7d 20 30 0a 74 65  {t2 isnull} 0.te
1570: 73 74 5f 65 78 70 72 20 65 78 70 72 2d 33 2e 32  st_expr expr-3.2
1580: 37 20 7b 74 31 3d 4e 55 4c 4c 2c 20 74 32 3d 27  7 {t1=NULL, t2='
1590: 68 69 27 7d 20 7b 74 31 20 6e 6f 74 6e 75 6c 6c  hi'} {t1 notnull
15a0: 7d 20 30 0a 74 65 73 74 5f 65 78 70 72 20 65 78  } 0.test_expr ex
15b0: 70 72 2d 33 2e 32 38 20 7b 74 31 3d 4e 55 4c 4c  pr-3.28 {t1=NULL
15c0: 2c 20 74 32 3d 27 68 69 27 7d 20 7b 74 32 20 6e  , t2='hi'} {t2 n
15d0: 6f 74 6e 75 6c 6c 7d 20 31 0a 74 65 73 74 5f 65  otnull} 1.test_e
15e0: 78 70 72 20 65 78 70 72 2d 33 2e 32 39 20 7b 74  xpr expr-3.29 {t
15f0: 31 3d 27 78 79 7a 27 2c 20 74 32 3d 27 61 62 63  1='xyz', t2='abc
1600: 27 7d 20 7b 74 31 7c 7c 74 32 7d 20 7b 78 79 7a  '} {t1||t2} {xyz
1610: 61 62 63 7d 0a 74 65 73 74 5f 65 78 70 72 20 65  abc}.test_expr e
1620: 78 70 72 2d 33 2e 33 30 20 7b 74 31 3d 4e 55 4c  xpr-3.30 {t1=NUL
1630: 4c 2c 20 74 32 3d 27 61 62 63 27 7d 20 7b 74 31  L, t2='abc'} {t1
1640: 7c 7c 74 32 7d 20 7b 61 62 63 7d 0a 74 65 73 74  ||t2} {abc}.test
1650: 5f 65 78 70 72 20 65 78 70 72 2d 33 2e 33 31 20  _expr expr-3.31 
1660: 7b 74 31 3d 27 78 79 7a 27 2c 20 74 32 3d 4e 55  {t1='xyz', t2=NU
1670: 4c 4c 7d 20 7b 74 31 7c 7c 74 32 7d 20 7b 78 79  LL} {t1||t2} {xy
1680: 7a 7d 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70  z}.test_expr exp
1690: 72 2d 33 2e 33 32 20 7b 74 31 3d 27 78 79 7a 27  r-3.32 {t1='xyz'
16a0: 2c 20 74 32 3d 27 61 62 63 27 7d 20 7b 74 31 7c  , t2='abc'} {t1|
16b0: 7c 27 20 68 69 20 27 7c 7c 74 32 7d 20 7b 7b 78  |' hi '||t2} {{x
16c0: 79 7a 20 68 69 20 61 62 63 7d 7d 0a 0a 74 65 73  yz hi abc}}..tes
16d0: 74 5f 65 78 70 72 20 65 78 70 72 2d 34 2e 31 20  t_expr expr-4.1 
16e0: 7b 74 31 3d 27 61 62 63 27 2c 20 74 32 3d 27 41  {t1='abc', t2='A
16f0: 62 63 27 7d 20 7b 74 31 3c 74 32 7d 20 30 0a 74  bc'} {t1<t2} 0.t
1700: 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 34 2e  est_expr expr-4.
1710: 32 20 7b 74 31 3d 27 61 62 63 27 2c 20 74 32 3d  2 {t1='abc', t2=
1720: 27 41 62 63 27 7d 20 7b 74 31 3e 74 32 7d 20 31  'Abc'} {t1>t2} 1
1730: 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d  .test_expr expr-
1740: 34 2e 33 20 7b 74 31 3d 27 61 62 63 27 2c 20 74  4.3 {t1='abc', t
1750: 32 3d 27 42 62 63 27 7d 20 7b 74 31 3c 74 32 7d  2='Bbc'} {t1<t2}
1760: 20 31 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70   1.test_expr exp
1770: 72 2d 34 2e 34 20 7b 74 31 3d 27 61 62 63 27 2c  r-4.4 {t1='abc',
1780: 20 74 32 3d 27 42 62 63 27 7d 20 7b 74 31 3e 74   t2='Bbc'} {t1>t
1790: 32 7d 20 30 0a 0a 74 65 73 74 5f 65 78 70 72 20  2} 0..test_expr 
17a0: 65 78 70 72 2d 35 2e 31 20 7b 74 31 3d 27 61 62  expr-5.1 {t1='ab
17b0: 63 27 2c 20 74 32 3d 27 78 79 7a 27 7d 20 7b 74  c', t2='xyz'} {t
17c0: 31 20 4c 49 4b 45 20 74 32 7d 20 30 0a 74 65 73  1 LIKE t2} 0.tes
17d0: 74 5f 65 78 70 72 20 65 78 70 72 2d 35 2e 32 20  t_expr expr-5.2 
17e0: 7b 74 31 3d 27 61 62 63 27 2c 20 74 32 3d 27 41  {t1='abc', t2='A
17f0: 42 43 27 7d 20 7b 74 31 20 4c 49 4b 45 20 74 32  BC'} {t1 LIKE t2
1800: 7d 20 31 0a 74 65 73 74 5f 65 78 70 72 20 65 78  } 1.test_expr ex
1810: 70 72 2d 35 2e 33 20 7b 74 31 3d 27 61 62 63 27  pr-5.3 {t1='abc'
1820: 2c 20 74 32 3d 27 41 5f 43 27 7d 20 7b 74 31 20  , t2='A_C'} {t1 
1830: 4c 49 4b 45 20 74 32 7d 20 31 0a 74 65 73 74 5f  LIKE t2} 1.test_
1840: 65 78 70 72 20 65 78 70 72 2d 35 2e 34 20 7b 74  expr expr-5.4 {t
1850: 31 3d 27 61 62 63 27 2c 20 74 32 3d 27 61 62 63  1='abc', t2='abc
1860: 5f 27 7d 20 7b 74 31 20 4c 49 4b 45 20 74 32 7d  _'} {t1 LIKE t2}
1870: 20 30 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70   0.test_expr exp
1880: 72 2d 35 2e 35 20 7b 74 31 3d 27 61 62 63 27 2c  r-5.5 {t1='abc',
1890: 20 74 32 3d 27 41 25 43 27 7d 20 7b 74 31 20 4c   t2='A%C'} {t1 L
18a0: 49 4b 45 20 74 32 7d 20 31 0a 74 65 73 74 5f 65  IKE t2} 1.test_e
18b0: 78 70 72 20 65 78 70 72 2d 35 2e 35 62 20 7b 74  xpr expr-5.5b {t
18c0: 31 3d 27 61 63 27 2c 20 74 32 3d 27 41 25 43 27  1='ac', t2='A%C'
18d0: 7d 20 7b 74 31 20 4c 49 4b 45 20 74 32 7d 20 31  } {t1 LIKE t2} 1
18e0: 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d  .test_expr expr-
18f0: 35 2e 36 20 7b 74 31 3d 27 61 62 78 79 7a 7a 79  5.6 {t1='abxyzzy
1900: 63 27 2c 20 74 32 3d 27 41 25 43 27 7d 20 7b 74  c', t2='A%C'} {t
1910: 31 20 4c 49 4b 45 20 74 32 7d 20 31 0a 74 65 73  1 LIKE t2} 1.tes
1920: 74 5f 65 78 70 72 20 65 78 70 72 2d 35 2e 37 20  t_expr expr-5.7 
1930: 7b 74 31 3d 27 61 62 78 79 7a 7a 79 27 2c 20 74  {t1='abxyzzy', t
1940: 32 3d 27 41 25 43 27 7d 20 7b 74 31 20 4c 49 4b  2='A%C'} {t1 LIK
1950: 45 20 74 32 7d 20 30 0a 74 65 73 74 5f 65 78 70  E t2} 0.test_exp
1960: 72 20 65 78 70 72 2d 35 2e 38 20 7b 74 31 3d 27  r expr-5.8 {t1='
1970: 61 62 78 79 7a 7a 79 63 78 27 2c 20 74 32 3d 27  abxyzzycx', t2='
1980: 41 25 43 27 7d 20 7b 74 31 20 4c 49 4b 45 20 74  A%C'} {t1 LIKE t
1990: 32 7d 20 30 0a 74 65 73 74 5f 65 78 70 72 20 65  2} 0.test_expr e
19a0: 78 70 72 2d 35 2e 38 62 20 7b 74 31 3d 27 61 62  xpr-5.8b {t1='ab
19b0: 78 79 7a 7a 79 63 79 27 2c 20 74 32 3d 27 41 25  xyzzycy', t2='A%
19c0: 43 58 27 7d 20 7b 74 31 20 4c 49 4b 45 20 74 32  CX'} {t1 LIKE t2
19d0: 7d 20 30 0a 74 65 73 74 5f 65 78 70 72 20 65 78  } 0.test_expr ex
19e0: 70 72 2d 35 2e 39 20 7b 74 31 3d 27 61 62 63 27  pr-5.9 {t1='abc'
19f0: 2c 20 74 32 3d 27 41 25 5f 43 27 7d 20 7b 74 31  , t2='A%_C'} {t1
1a00: 20 4c 49 4b 45 20 74 32 7d 20 31 0a 74 65 73 74   LIKE t2} 1.test
1a10: 5f 65 78 70 72 20 65 78 70 72 2d 35 2e 39 62 20  _expr expr-5.9b 
1a20: 7b 74 31 3d 27 61 63 27 2c 20 74 32 3d 27 41 25  {t1='ac', t2='A%
1a30: 5f 43 27 7d 20 7b 74 31 20 4c 49 4b 45 20 74 32  _C'} {t1 LIKE t2
1a40: 7d 20 30 0a 74 65 73 74 5f 65 78 70 72 20 65 78  } 0.test_expr ex
1a50: 70 72 2d 35 2e 31 30 20 7b 74 31 3d 27 61 62 78  pr-5.10 {t1='abx
1a60: 79 7a 7a 79 63 27 2c 20 74 32 3d 27 41 25 5f 43  yzzyc', t2='A%_C
1a70: 27 7d 20 7b 74 31 20 4c 49 4b 45 20 74 32 7d 20  '} {t1 LIKE t2} 
1a80: 31 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72  1.test_expr expr
1a90: 2d 35 2e 31 31 20 7b 74 31 3d 27 61 62 63 27 2c  -5.11 {t1='abc',
1aa0: 20 74 32 3d 27 78 79 7a 27 7d 20 7b 74 31 20 4e   t2='xyz'} {t1 N
1ab0: 4f 54 20 4c 49 4b 45 20 74 32 7d 20 31 0a 74 65  OT LIKE t2} 1.te
1ac0: 73 74 5f 65 78 70 72 20 65 78 70 72 2d 35 2e 31  st_expr expr-5.1
1ad0: 32 20 7b 74 31 3d 27 61 62 63 27 2c 20 74 32 3d  2 {t1='abc', t2=
1ae0: 27 41 42 43 27 7d 20 7b 74 31 20 4e 4f 54 20 4c  'ABC'} {t1 NOT L
1af0: 49 4b 45 20 74 32 7d 20 30 0a 0a 23 20 54 68 65  IKE t2} 0..# The
1b00: 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 65 73 74 73   following tests
1b10: 20 6f 6e 6c 79 20 77 6f 72 6b 20 6f 6e 20 76 65   only work on ve
1b20: 72 73 69 6f 6e 73 20 6f 66 20 54 43 4c 20 74 68  rsions of TCL th
1b30: 61 74 20 73 75 70 70 6f 72 74 0a 23 20 55 6e 69  at support.# Uni
1b40: 63 6f 64 65 20 61 6e 64 20 53 51 4c 69 74 65 20  code and SQLite 
1b50: 63 6f 6e 66 69 67 75 72 65 64 20 66 6f 72 20 55  configured for U
1b60: 54 46 2d 38 20 73 75 70 70 6f 72 74 2e 0a 23 0a  TF-8 support..#.
1b70: 69 66 20 7b 22 5c 75 31 32 33 34 22 21 3d 22 75  if {"\u1234"!="u
1b80: 31 32 33 34 22 20 26 26 20 5b 73 71 6c 69 74 65  1234" && [sqlite
1b90: 20 2d 65 6e 63 6f 64 69 6e 67 5d 3d 3d 22 55 54   -encoding]=="UT
1ba0: 46 2d 38 22 7d 20 7b 0a 20 20 74 65 73 74 5f 65  F-8"} {.  test_e
1bb0: 78 70 72 20 65 78 70 72 2d 35 2e 31 33 20 22 74  xpr expr-5.13 "t
1bc0: 31 3d 27 61 5c 75 30 30 38 30 63 27 2c 20 74 32  1='a\u0080c', t2
1bd0: 3d 27 41 5f 43 27 22 20 7b 74 31 20 4c 49 4b 45  ='A_C'" {t1 LIKE
1be0: 20 74 32 7d 20 31 0a 20 20 74 65 73 74 5f 65 78   t2} 1.  test_ex
1bf0: 70 72 20 65 78 70 72 2d 35 2e 31 34 20 22 74 31  pr expr-5.14 "t1
1c00: 3d 27 61 5c 75 30 37 46 46 63 27 2c 20 74 32 3d  ='a\u07FFc', t2=
1c10: 27 41 5f 43 27 22 20 7b 74 31 20 4c 49 4b 45 20  'A_C'" {t1 LIKE 
1c20: 74 32 7d 20 31 0a 20 20 74 65 73 74 5f 65 78 70  t2} 1.  test_exp
1c30: 72 20 65 78 70 72 2d 35 2e 31 35 20 22 74 31 3d  r expr-5.15 "t1=
1c40: 27 61 5c 75 30 38 30 30 63 27 2c 20 74 32 3d 27  'a\u0800c', t2='
1c50: 41 5f 43 27 22 20 7b 74 31 20 4c 49 4b 45 20 74  A_C'" {t1 LIKE t
1c60: 32 7d 20 31 0a 20 20 74 65 73 74 5f 65 78 70 72  2} 1.  test_expr
1c70: 20 65 78 70 72 2d 35 2e 31 36 20 22 74 31 3d 27   expr-5.16 "t1='
1c80: 61 5c 75 46 46 46 46 63 27 2c 20 74 32 3d 27 41  a\uFFFFc', t2='A
1c90: 5f 43 27 22 20 7b 74 31 20 4c 49 4b 45 20 74 32  _C'" {t1 LIKE t2
1ca0: 7d 20 31 0a 20 20 74 65 73 74 5f 65 78 70 72 20  } 1.  test_expr 
1cb0: 65 78 70 72 2d 35 2e 31 37 20 22 74 31 3d 27 61  expr-5.17 "t1='a
1cc0: 5c 75 30 30 38 30 27 2c 20 74 32 3d 27 41 5f 5f  \u0080', t2='A__
1cd0: 27 22 20 7b 74 31 20 4c 49 4b 45 20 74 32 7d 20  '" {t1 LIKE t2} 
1ce0: 30 0a 20 20 74 65 73 74 5f 65 78 70 72 20 65 78  0.  test_expr ex
1cf0: 70 72 2d 35 2e 31 38 20 22 74 31 3d 27 61 5c 75  pr-5.18 "t1='a\u
1d00: 30 37 46 46 27 2c 20 74 32 3d 27 41 5f 5f 27 22  07FF', t2='A__'"
1d10: 20 7b 74 31 20 4c 49 4b 45 20 74 32 7d 20 30 0a   {t1 LIKE t2} 0.
1d20: 20 20 74 65 73 74 5f 65 78 70 72 20 65 78 70 72    test_expr expr
1d30: 2d 35 2e 31 39 20 22 74 31 3d 27 61 5c 75 30 38  -5.19 "t1='a\u08
1d40: 30 30 27 2c 20 74 32 3d 27 41 5f 5f 27 22 20 7b  00', t2='A__'" {
1d50: 74 31 20 4c 49 4b 45 20 74 32 7d 20 30 0a 20 20  t1 LIKE t2} 0.  
1d60: 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 35  test_expr expr-5
1d70: 2e 32 30 20 22 74 31 3d 27 61 5c 75 46 46 46 46  .20 "t1='a\uFFFF
1d80: 27 2c 20 74 32 3d 27 41 5f 5f 27 22 20 7b 74 31  ', t2='A__'" {t1
1d90: 20 4c 49 4b 45 20 74 32 7d 20 30 0a 20 20 74 65   LIKE t2} 0.  te
1da0: 73 74 5f 65 78 70 72 20 65 78 70 72 2d 35 2e 32  st_expr expr-5.2
1db0: 31 20 22 74 31 3d 27 61 78 5c 75 41 42 43 44 27  1 "t1='ax\uABCD'
1dc0: 2c 20 74 32 3d 27 41 5f 5c 75 41 42 43 44 27 22  , t2='A_\uABCD'"
1dd0: 20 7b 74 31 20 4c 49 4b 45 20 74 32 7d 20 31 0a   {t1 LIKE t2} 1.
1de0: 20 20 74 65 73 74 5f 65 78 70 72 20 65 78 70 72    test_expr expr
1df0: 2d 35 2e 32 32 20 22 74 31 3d 27 61 78 5c 75 31  -5.22 "t1='ax\u1
1e00: 32 33 34 27 2c 20 74 32 3d 27 41 25 5c 75 31 32  234', t2='A%\u12
1e10: 33 34 27 22 20 7b 74 31 20 4c 49 4b 45 20 74 32  34'" {t1 LIKE t2
1e20: 7d 20 31 0a 20 20 74 65 73 74 5f 65 78 70 72 20  } 1.  test_expr 
1e30: 65 78 70 72 2d 35 2e 32 33 20 22 74 31 3d 27 61  expr-5.23 "t1='a
1e40: 78 5c 75 46 45 44 43 27 2c 20 74 32 3d 27 41 5f  x\uFEDC', t2='A_
1e50: 25 27 22 20 7b 74 31 20 4c 49 4b 45 20 74 32 7d  %'" {t1 LIKE t2}
1e60: 20 31 0a 20 20 74 65 73 74 5f 65 78 70 72 20 65   1.  test_expr e
1e70: 78 70 72 2d 35 2e 32 34 20 22 74 31 3d 27 61 78  xpr-5.24 "t1='ax
1e80: 5c 75 46 45 44 43 79 5c 75 46 45 44 43 27 2c 20  \uFEDCy\uFEDC', 
1e90: 74 32 3d 27 41 25 5c 75 46 45 44 43 27 22 20 7b  t2='A%\uFEDC'" {
1ea0: 74 31 20 4c 49 4b 45 20 74 32 7d 20 31 0a 7d 0a  t1 LIKE t2} 1.}.
1eb0: 0a 23 20 54 68 65 73 65 73 20 74 65 73 74 73 20  .# Theses tests 
1ec0: 61 72 65 20 66 6f 72 20 77 68 65 6e 20 53 51 4c  are for when SQL
1ed0: 69 74 65 20 61 73 73 75 6d 65 73 20 69 73 6f 38  ite assumes iso8
1ee0: 38 35 39 20 63 68 61 72 61 63 74 65 72 73 2e 0a  859 characters..
1ef0: 23 0a 69 66 20 7b 5b 73 71 6c 69 74 65 20 2d 65  #.if {[sqlite -e
1f00: 6e 63 6f 64 69 6e 67 5d 3d 3d 22 69 73 6f 38 38  ncoding]=="iso88
1f10: 35 39 22 7d 20 7b 0a 20 20 73 65 74 20 67 6f 20  59"} {.  set go 
1f20: 31 0a 20 20 69 66 20 7b 5b 69 6e 66 6f 20 63 6f  1.  if {[info co
1f30: 6d 6d 61 6e 64 20 65 6e 63 6f 64 69 6e 67 5d 21  mmand encoding]!
1f40: 3d 22 22 7d 20 7b 0a 20 20 20 20 69 66 20 7b 5b  =""} {.    if {[
1f50: 63 61 74 63 68 20 7b 65 6e 63 6f 64 69 6e 67 20  catch {encoding 
1f60: 73 79 73 74 65 6d 20 69 73 6f 38 38 35 39 2d 31  system iso8859-1
1f70: 7d 20 6d 73 67 5d 7d 20 7b 0a 20 20 20 20 20 20  } msg]} {.      
1f80: 70 75 74 73 20 22 73 6b 69 70 70 69 6e 67 20 74  puts "skipping t
1f90: 65 73 74 73 20 6f 66 20 4c 49 4b 45 20 6f 70 65  ests of LIKE ope
1fa0: 72 61 74 6f 72 3a 20 24 6d 73 67 22 0a 20 20 20  rator: $msg".   
1fb0: 20 20 20 73 65 74 20 67 6f 20 30 0a 20 20 20 20     set go 0.    
1fc0: 7d 0a 20 20 7d 0a 20 20 69 66 20 7b 24 67 6f 7d  }.  }.  if {$go}
1fd0: 20 7b 0a 20 20 20 20 74 65 73 74 5f 65 78 70 72   {.    test_expr
1fe0: 20 65 78 70 72 2d 35 2e 35 30 20 22 74 31 3d 27   expr-5.50 "t1='
1ff0: 61 5c 32 36 36 63 27 2c 20 74 32 3d 27 41 5f 43  a\266c', t2='A_C
2000: 27 22 20 20 7b 74 31 20 4c 49 4b 45 20 74 32 7d  '"  {t1 LIKE t2}
2010: 20 31 0a 20 20 20 20 74 65 73 74 5f 65 78 70 72   1.    test_expr
2020: 20 65 78 70 72 2d 35 2e 35 31 20 22 74 31 3d 27   expr-5.51 "t1='
2030: 61 5c 33 34 37 27 2c 20 74 32 3d 27 41 5f 27 22  a\347', t2='A_'"
2040: 20 20 7b 74 31 20 4c 49 4b 45 20 74 32 7d 20 31    {t1 LIKE t2} 1
2050: 0a 20 20 20 20 74 65 73 74 5f 65 78 70 72 20 65  .    test_expr e
2060: 78 70 72 2d 35 2e 35 32 20 22 74 31 3d 27 61 78  xpr-5.52 "t1='ax
2070: 5c 33 35 31 27 2c 20 74 32 3d 27 41 5f 5c 33 35  \351', t2='A_\35
2080: 31 27 22 20 20 7b 74 31 20 4c 49 4b 45 20 74 32  1'"  {t1 LIKE t2
2090: 7d 20 31 0a 20 20 20 20 74 65 73 74 5f 65 78 70  } 1.    test_exp
20a0: 72 20 65 78 70 72 2d 35 2e 35 33 20 22 74 31 3d  r expr-5.53 "t1=
20b0: 27 61 78 5c 32 34 31 27 2c 20 74 32 3d 27 41 5f  'ax\241', t2='A_
20c0: 25 27 22 20 20 7b 74 31 20 4c 49 4b 45 20 74 32  %'"  {t1 LIKE t2
20d0: 7d 20 31 0a 20 20 7d 0a 7d 0a 0a 74 65 73 74 5f  } 1.  }.}..test_
20e0: 65 78 70 72 20 65 78 70 72 2d 36 2e 31 20 7b 74  expr expr-6.1 {t
20f0: 31 3d 27 61 62 63 27 2c 20 74 32 3d 27 78 79 7a  1='abc', t2='xyz
2100: 27 7d 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20  '} {t1 GLOB t2} 
2110: 30 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72  0.test_expr expr
2120: 2d 36 2e 32 20 7b 74 31 3d 27 61 62 63 27 2c 20  -6.2 {t1='abc', 
2130: 74 32 3d 27 41 42 43 27 7d 20 7b 74 31 20 47 4c  t2='ABC'} {t1 GL
2140: 4f 42 20 74 32 7d 20 30 0a 74 65 73 74 5f 65 78  OB t2} 0.test_ex
2150: 70 72 20 65 78 70 72 2d 36 2e 33 20 7b 74 31 3d  pr expr-6.3 {t1=
2160: 27 61 62 63 27 2c 20 74 32 3d 27 41 3f 43 27 7d  'abc', t2='A?C'}
2170: 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20 30 0a   {t1 GLOB t2} 0.
2180: 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 36  test_expr expr-6
2190: 2e 34 20 7b 74 31 3d 27 61 62 63 27 2c 20 74 32  .4 {t1='abc', t2
21a0: 3d 27 61 3f 63 27 7d 20 7b 74 31 20 47 4c 4f 42  ='a?c'} {t1 GLOB
21b0: 20 74 32 7d 20 31 0a 74 65 73 74 5f 65 78 70 72   t2} 1.test_expr
21c0: 20 65 78 70 72 2d 36 2e 35 20 7b 74 31 3d 27 61   expr-6.5 {t1='a
21d0: 62 63 27 2c 20 74 32 3d 27 61 62 63 3f 27 7d 20  bc', t2='abc?'} 
21e0: 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20 30 0a 74  {t1 GLOB t2} 0.t
21f0: 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 36 2e  est_expr expr-6.
2200: 36 20 7b 74 31 3d 27 61 62 63 27 2c 20 74 32 3d  6 {t1='abc', t2=
2210: 27 41 2a 43 27 7d 20 7b 74 31 20 47 4c 4f 42 20  'A*C'} {t1 GLOB 
2220: 74 32 7d 20 30 0a 74 65 73 74 5f 65 78 70 72 20  t2} 0.test_expr 
2230: 65 78 70 72 2d 36 2e 37 20 7b 74 31 3d 27 61 62  expr-6.7 {t1='ab
2240: 63 27 2c 20 74 32 3d 27 61 2a 63 27 7d 20 7b 74  c', t2='a*c'} {t
2250: 31 20 47 4c 4f 42 20 74 32 7d 20 31 0a 74 65 73  1 GLOB t2} 1.tes
2260: 74 5f 65 78 70 72 20 65 78 70 72 2d 36 2e 38 20  t_expr expr-6.8 
2270: 7b 74 31 3d 27 61 62 78 79 7a 7a 79 63 27 2c 20  {t1='abxyzzyc', 
2280: 74 32 3d 27 61 2a 63 27 7d 20 7b 74 31 20 47 4c  t2='a*c'} {t1 GL
2290: 4f 42 20 74 32 7d 20 31 0a 74 65 73 74 5f 65 78  OB t2} 1.test_ex
22a0: 70 72 20 65 78 70 72 2d 36 2e 39 20 7b 74 31 3d  pr expr-6.9 {t1=
22b0: 27 61 62 78 79 7a 7a 79 27 2c 20 74 32 3d 27 61  'abxyzzy', t2='a
22c0: 2a 63 27 7d 20 7b 74 31 20 47 4c 4f 42 20 74 32  *c'} {t1 GLOB t2
22d0: 7d 20 30 0a 74 65 73 74 5f 65 78 70 72 20 65 78  } 0.test_expr ex
22e0: 70 72 2d 36 2e 31 30 20 7b 74 31 3d 27 61 62 78  pr-6.10 {t1='abx
22f0: 79 7a 7a 79 63 78 27 2c 20 74 32 3d 27 61 2a 63  yzzycx', t2='a*c
2300: 27 7d 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20  '} {t1 GLOB t2} 
2310: 30 0a 74 65 73 74 5f 65 78 70 72 20 65 78 70 72  0.test_expr expr
2320: 2d 36 2e 31 31 20 7b 74 31 3d 27 61 62 63 27 2c  -6.11 {t1='abc',
2330: 20 74 32 3d 27 78 79 7a 27 7d 20 7b 74 31 20 4e   t2='xyz'} {t1 N
2340: 4f 54 20 47 4c 4f 42 20 74 32 7d 20 31 0a 74 65  OT GLOB t2} 1.te
2350: 73 74 5f 65 78 70 72 20 65 78 70 72 2d 36 2e 31  st_expr expr-6.1
2360: 32 20 7b 74 31 3d 27 61 62 63 27 2c 20 74 32 3d  2 {t1='abc', t2=
2370: 27 61 62 63 27 7d 20 7b 74 31 20 4e 4f 54 20 47  'abc'} {t1 NOT G
2380: 4c 4f 42 20 74 32 7d 20 30 0a 74 65 73 74 5f 65  LOB t2} 0.test_e
2390: 78 70 72 20 65 78 70 72 2d 36 2e 31 33 20 7b 74  xpr expr-6.13 {t
23a0: 31 3d 27 61 62 63 27 2c 20 74 32 3d 27 61 5b 62  1='abc', t2='a[b
23b0: 78 5d 63 27 7d 20 7b 74 31 20 47 4c 4f 42 20 74  x]c'} {t1 GLOB t
23c0: 32 7d 20 31 0a 74 65 73 74 5f 65 78 70 72 20 65  2} 1.test_expr e
23d0: 78 70 72 2d 36 2e 31 34 20 7b 74 31 3d 27 61 62  xpr-6.14 {t1='ab
23e0: 63 27 2c 20 74 32 3d 27 61 5b 63 78 5d 63 27 7d  c', t2='a[cx]c'}
23f0: 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20 30 0a   {t1 GLOB t2} 0.
2400: 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 36  test_expr expr-6
2410: 2e 31 35 20 7b 74 31 3d 27 61 62 63 27 2c 20 74  .15 {t1='abc', t
2420: 32 3d 27 61 5b 61 2d 64 5d 63 27 7d 20 7b 74 31  2='a[a-d]c'} {t1
2430: 20 47 4c 4f 42 20 74 32 7d 20 31 0a 74 65 73 74   GLOB t2} 1.test
2440: 5f 65 78 70 72 20 65 78 70 72 2d 36 2e 31 36 20  _expr expr-6.16 
2450: 7b 74 31 3d 27 61 62 63 27 2c 20 74 32 3d 27 61  {t1='abc', t2='a
2460: 5b 5e 61 2d 64 5d 63 27 7d 20 7b 74 31 20 47 4c  [^a-d]c'} {t1 GL
2470: 4f 42 20 74 32 7d 20 30 0a 74 65 73 74 5f 65 78  OB t2} 0.test_ex
2480: 70 72 20 65 78 70 72 2d 36 2e 31 37 20 7b 74 31  pr expr-6.17 {t1
2490: 3d 27 61 62 63 27 2c 20 74 32 3d 27 61 5b 41 2d  ='abc', t2='a[A-
24a0: 44 63 5d 63 27 7d 20 7b 74 31 20 47 4c 4f 42 20  Dc]c'} {t1 GLOB 
24b0: 74 32 7d 20 30 0a 74 65 73 74 5f 65 78 70 72 20  t2} 0.test_expr 
24c0: 65 78 70 72 2d 36 2e 31 38 20 7b 74 31 3d 27 61  expr-6.18 {t1='a
24d0: 62 63 27 2c 20 74 32 3d 27 61 5b 5e 41 2d 44 63  bc', t2='a[^A-Dc
24e0: 5d 63 27 7d 20 7b 74 31 20 47 4c 4f 42 20 74 32  ]c'} {t1 GLOB t2
24f0: 7d 20 31 0a 74 65 73 74 5f 65 78 70 72 20 65 78  } 1.test_expr ex
2500: 70 72 2d 36 2e 31 39 20 7b 74 31 3d 27 61 62 63  pr-6.19 {t1='abc
2510: 27 2c 20 74 32 3d 27 61 5b 5d 62 5d 63 27 7d 20  ', t2='a[]b]c'} 
2520: 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20 31 0a 74  {t1 GLOB t2} 1.t
2530: 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 36 2e  est_expr expr-6.
2540: 32 30 20 7b 74 31 3d 27 61 62 63 27 2c 20 74 32  20 {t1='abc', t2
2550: 3d 27 61 5b 5e 5d 62 5d 63 27 7d 20 7b 74 31 20  ='a[^]b]c'} {t1 
2560: 47 4c 4f 42 20 74 32 7d 20 30 0a 74 65 73 74 5f  GLOB t2} 0.test_
2570: 65 78 70 72 20 65 78 70 72 2d 36 2e 32 31 20 7b  expr expr-6.21 {
2580: 74 31 3d 27 61 62 63 64 65 66 67 27 2c 20 74 32  t1='abcdefg', t2
2590: 3d 27 61 2a 5b 64 65 5d 67 27 7d 20 7b 74 31 20  ='a*[de]g'} {t1 
25a0: 47 4c 4f 42 20 74 32 7d 20 30 0a 74 65 73 74 5f  GLOB t2} 0.test_
25b0: 65 78 70 72 20 65 78 70 72 2d 36 2e 32 32 20 7b  expr expr-6.22 {
25c0: 74 31 3d 27 61 62 63 64 65 66 67 27 2c 20 74 32  t1='abcdefg', t2
25d0: 3d 27 61 2a 5b 5e 64 65 5d 67 27 7d 20 7b 74 31  ='a*[^de]g'} {t1
25e0: 20 47 4c 4f 42 20 74 32 7d 20 31 0a 74 65 73 74   GLOB t2} 1.test
25f0: 5f 65 78 70 72 20 65 78 70 72 2d 36 2e 32 33 20  _expr expr-6.23 
2600: 7b 74 31 3d 27 61 62 63 64 65 66 67 27 2c 20 74  {t1='abcdefg', t
2610: 32 3d 27 61 2a 3f 67 27 7d 20 7b 74 31 20 47 4c  2='a*?g'} {t1 GL
2620: 4f 42 20 74 32 7d 20 31 0a 74 65 73 74 5f 65 78  OB t2} 1.test_ex
2630: 70 72 20 65 78 70 72 2d 36 2e 32 34 20 7b 74 31  pr expr-6.24 {t1
2640: 3d 27 61 63 27 2c 20 74 32 3d 27 61 2a 63 27 7d  ='ac', t2='a*c'}
2650: 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20 31 0a   {t1 GLOB t2} 1.
2660: 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 36  test_expr expr-6
2670: 2e 32 35 20 7b 74 31 3d 27 61 63 27 2c 20 74 32  .25 {t1='ac', t2
2680: 3d 27 61 2a 3f 63 27 7d 20 7b 74 31 20 47 4c 4f  ='a*?c'} {t1 GLO
2690: 42 20 74 32 7d 20 30 0a 0a 23 20 54 68 65 73 65  B t2} 0..# These
26a0: 20 74 65 73 74 73 20 6f 6e 6c 79 20 77 6f 72 6b   tests only work
26b0: 20 6f 6e 20 76 65 72 73 69 6f 6e 73 20 6f 66 20   on versions of 
26c0: 54 43 4c 20 74 68 61 74 20 73 75 70 70 6f 72 74  TCL that support
26d0: 20 55 6e 69 63 6f 64 65 0a 23 0a 69 66 20 7b 22   Unicode.#.if {"
26e0: 5c 75 31 32 33 34 22 21 3d 22 75 31 32 33 34 22  \u1234"!="u1234"
26f0: 20 26 26 20 5b 73 71 6c 69 74 65 20 2d 65 6e 63   && [sqlite -enc
2700: 6f 64 69 6e 67 5d 3d 3d 22 55 54 46 2d 38 22 7d  oding]=="UTF-8"}
2710: 20 7b 0a 20 20 74 65 73 74 5f 65 78 70 72 20 65   {.  test_expr e
2720: 78 70 72 2d 36 2e 32 36 20 22 74 31 3d 27 61 5c  xpr-6.26 "t1='a\
2730: 75 30 30 38 30 63 27 2c 20 74 32 3d 27 61 3f 63  u0080c', t2='a?c
2740: 27 22 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20  '" {t1 GLOB t2} 
2750: 31 0a 20 20 74 65 73 74 5f 65 78 70 72 20 65 78  1.  test_expr ex
2760: 70 72 2d 36 2e 32 37 20 22 74 31 3d 27 61 5c 75  pr-6.27 "t1='a\u
2770: 30 37 66 66 63 27 2c 20 74 32 3d 27 61 3f 63 27  07ffc', t2='a?c'
2780: 22 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20 31  " {t1 GLOB t2} 1
2790: 0a 20 20 74 65 73 74 5f 65 78 70 72 20 65 78 70  .  test_expr exp
27a0: 72 2d 36 2e 32 38 20 22 74 31 3d 27 61 5c 75 30  r-6.28 "t1='a\u0
27b0: 38 30 30 63 27 2c 20 74 32 3d 27 61 3f 63 27 22  800c', t2='a?c'"
27c0: 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20 31 0a   {t1 GLOB t2} 1.
27d0: 20 20 74 65 73 74 5f 65 78 70 72 20 65 78 70 72    test_expr expr
27e0: 2d 36 2e 32 39 20 22 74 31 3d 27 61 5c 75 66 66  -6.29 "t1='a\uff
27f0: 66 66 63 27 2c 20 74 32 3d 27 61 3f 63 27 22 20  ffc', t2='a?c'" 
2800: 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20 31 0a 20  {t1 GLOB t2} 1. 
2810: 20 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d   test_expr expr-
2820: 36 2e 33 30 20 22 74 31 3d 27 61 5c 75 31 32 33  6.30 "t1='a\u123
2830: 34 27 2c 20 74 32 3d 27 61 3f 27 22 20 7b 74 31  4', t2='a?'" {t1
2840: 20 47 4c 4f 42 20 74 32 7d 20 31 0a 20 20 74 65   GLOB t2} 1.  te
2850: 73 74 5f 65 78 70 72 20 65 78 70 72 2d 36 2e 33  st_expr expr-6.3
2860: 31 20 22 74 31 3d 27 61 5c 75 31 32 33 34 27 2c  1 "t1='a\u1234',
2870: 20 74 32 3d 27 61 3f 3f 27 22 20 7b 74 31 20 47   t2='a??'" {t1 G
2880: 4c 4f 42 20 74 32 7d 20 30 0a 20 20 74 65 73 74  LOB t2} 0.  test
2890: 5f 65 78 70 72 20 65 78 70 72 2d 36 2e 33 32 20  _expr expr-6.32 
28a0: 22 74 31 3d 27 61 78 5c 75 31 32 33 34 27 2c 20  "t1='ax\u1234', 
28b0: 74 32 3d 27 61 3f 5c 75 31 32 33 34 27 22 20 7b  t2='a?\u1234'" {
28c0: 74 31 20 47 4c 4f 42 20 74 32 7d 20 31 0a 20 20  t1 GLOB t2} 1.  
28d0: 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 36  test_expr expr-6
28e0: 2e 33 33 20 22 74 31 3d 27 61 78 5c 75 31 32 33  .33 "t1='ax\u123
28f0: 34 27 2c 20 74 32 3d 27 61 2a 5c 75 31 32 33 34  4', t2='a*\u1234
2900: 27 22 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20  '" {t1 GLOB t2} 
2910: 31 0a 20 20 74 65 73 74 5f 65 78 70 72 20 65 78  1.  test_expr ex
2920: 70 72 2d 36 2e 33 34 20 22 74 31 3d 27 61 78 5c  pr-6.34 "t1='ax\
2930: 75 31 32 33 34 79 5c 75 31 32 33 34 27 2c 20 74  u1234y\u1234', t
2940: 32 3d 27 61 2a 5c 75 31 32 33 34 27 22 20 7b 74  2='a*\u1234'" {t
2950: 31 20 47 4c 4f 42 20 74 32 7d 20 31 0a 20 20 74  1 GLOB t2} 1.  t
2960: 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 36 2e  est_expr expr-6.
2970: 33 35 20 22 74 31 3d 27 61 5c 75 31 32 33 34 62  35 "t1='a\u1234b
2980: 27 2c 20 74 32 3d 27 61 5c 5b 78 5c 75 31 32 33  ', t2='a\[x\u123
2990: 34 79 5c 5d 62 27 22 20 7b 74 31 20 47 4c 4f 42  4y\]b'" {t1 GLOB
29a0: 20 74 32 7d 20 31 0a 20 20 74 65 73 74 5f 65 78   t2} 1.  test_ex
29b0: 70 72 20 65 78 70 72 2d 36 2e 33 36 20 22 74 31  pr expr-6.36 "t1
29c0: 3d 27 61 5c 75 31 32 33 34 62 27 2c 20 74 32 3d  ='a\u1234b', t2=
29d0: 27 61 5c 5b 5c 75 31 32 33 33 2d 5c 75 31 32 33  'a\[\u1233-\u123
29e0: 35 5c 5d 62 27 22 20 7b 74 31 20 47 4c 4f 42 20  5\]b'" {t1 GLOB 
29f0: 74 32 7d 20 31 0a 20 20 74 65 73 74 5f 65 78 70  t2} 1.  test_exp
2a00: 72 20 65 78 70 72 2d 36 2e 33 37 20 22 74 31 3d  r expr-6.37 "t1=
2a10: 27 61 5c 75 31 32 33 34 62 27 2c 20 74 32 3d 27  'a\u1234b', t2='
2a20: 61 5c 5b 5c 75 31 32 33 34 2d 5c 75 31 32 34 66  a\[\u1234-\u124f
2a30: 5c 5d 62 27 22 20 7b 74 31 20 47 4c 4f 42 20 74  \]b'" {t1 GLOB t
2a40: 32 7d 20 31 0a 20 20 74 65 73 74 5f 65 78 70 72  2} 1.  test_expr
2a50: 20 65 78 70 72 2d 36 2e 33 38 20 22 74 31 3d 27   expr-6.38 "t1='
2a60: 61 5c 75 31 32 33 34 62 27 2c 20 74 32 3d 27 61  a\u1234b', t2='a
2a70: 5c 5b 5c 75 31 32 33 35 2d 5c 75 31 32 34 66 5c  \[\u1235-\u124f\
2a80: 5d 62 27 22 20 7b 74 31 20 47 4c 4f 42 20 74 32  ]b'" {t1 GLOB t2
2a90: 7d 20 30 0a 20 20 74 65 73 74 5f 65 78 70 72 20  } 0.  test_expr 
2aa0: 65 78 70 72 2d 36 2e 33 39 20 22 74 31 3d 27 61  expr-6.39 "t1='a
2ab0: 5c 75 31 32 33 34 62 27 2c 20 74 32 3d 27 61 5c  \u1234b', t2='a\
2ac0: 5b 61 2d 5c 75 31 32 33 35 5c 5d 62 27 22 20 7b  [a-\u1235\]b'" {
2ad0: 74 31 20 47 4c 4f 42 20 74 32 7d 20 31 0a 20 20  t1 GLOB t2} 1.  
2ae0: 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 36  test_expr expr-6
2af0: 2e 34 30 20 22 74 31 3d 27 61 5c 75 31 32 33 34  .40 "t1='a\u1234
2b00: 62 27 2c 20 74 32 3d 27 61 5c 5b 61 2d 5c 75 31  b', t2='a\[a-\u1
2b10: 32 33 34 5c 5d 62 27 22 20 7b 74 31 20 47 4c 4f  234\]b'" {t1 GLO
2b20: 42 20 74 32 7d 20 31 0a 20 20 74 65 73 74 5f 65  B t2} 1.  test_e
2b30: 78 70 72 20 65 78 70 72 2d 36 2e 34 31 20 22 74  xpr expr-6.41 "t
2b40: 31 3d 27 61 5c 75 31 32 33 34 62 27 2c 20 74 32  1='a\u1234b', t2
2b50: 3d 27 61 5c 5b 61 2d 5c 75 31 32 33 33 5c 5d 62  ='a\[a-\u1233\]b
2b60: 27 22 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20  '" {t1 GLOB t2} 
2b70: 30 0a 7d 0a 0a 23 20 54 68 65 73 65 73 20 74 65  0.}..# Theses te
2b80: 73 74 73 20 61 72 65 20 66 6f 72 20 77 68 65 6e  sts are for when
2b90: 20 53 51 4c 69 74 65 20 61 73 73 75 6d 65 73 20   SQLite assumes 
2ba0: 69 73 6f 38 38 35 39 20 63 68 61 72 61 63 74 65  iso8859 characte
2bb0: 72 73 2e 0a 23 0a 69 66 20 7b 5b 73 71 6c 69 74  rs..#.if {[sqlit
2bc0: 65 20 2d 65 6e 63 6f 64 69 6e 67 5d 3d 3d 22 69  e -encoding]=="i
2bd0: 73 6f 38 38 35 39 22 7d 20 7b 0a 20 20 73 65 74  so8859"} {.  set
2be0: 20 67 6f 20 31 0a 20 20 69 66 20 7b 5b 69 6e 66   go 1.  if {[inf
2bf0: 6f 20 63 6f 6d 6d 61 6e 64 20 65 6e 63 6f 64 69  o command encodi
2c00: 6e 67 5d 21 3d 22 22 7d 20 7b 0a 20 20 20 20 69  ng]!=""} {.    i
2c10: 66 20 7b 5b 63 61 74 63 68 20 7b 65 6e 63 6f 64  f {[catch {encod
2c20: 69 6e 67 20 73 79 73 74 65 6d 20 69 73 6f 38 38  ing system iso88
2c30: 35 39 2d 31 7d 20 6d 73 67 5d 7d 20 7b 0a 20 20  59-1} msg]} {.  
2c40: 20 20 20 20 70 75 74 73 20 22 73 6b 69 70 70 69      puts "skippi
2c50: 6e 67 20 74 65 73 74 73 20 6f 66 20 47 4c 4f 42  ng tests of GLOB
2c60: 20 6f 70 65 72 61 74 6f 72 3a 20 24 6d 73 67 22   operator: $msg"
2c70: 0a 20 20 20 20 20 20 73 65 74 20 67 6f 20 30 0a  .      set go 0.
2c80: 20 20 20 20 7d 0a 20 20 7d 0a 20 20 69 66 20 7b      }.  }.  if {
2c90: 24 67 6f 7d 20 7b 0a 20 20 20 20 74 65 73 74 5f  $go} {.    test_
2ca0: 65 78 70 72 20 65 78 70 72 2d 36 2e 35 30 20 22  expr expr-6.50 "
2cb0: 74 31 3d 27 61 5c 32 36 36 63 27 2c 20 74 32 3d  t1='a\266c', t2=
2cc0: 27 61 3f 63 27 22 20 7b 74 31 20 47 4c 4f 42 20  'a?c'" {t1 GLOB 
2cd0: 74 32 7d 20 31 0a 20 20 20 20 74 65 73 74 5f 65  t2} 1.    test_e
2ce0: 78 70 72 20 65 78 70 72 2d 36 2e 35 31 20 22 74  xpr expr-6.51 "t
2cf0: 31 3d 27 61 5c 32 36 36 27 2c 20 74 32 3d 27 61  1='a\266', t2='a
2d00: 3f 27 22 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d  ?'" {t1 GLOB t2}
2d10: 20 31 0a 20 20 20 20 74 65 73 74 5f 65 78 70 72   1.    test_expr
2d20: 20 65 78 70 72 2d 36 2e 35 32 20 22 74 31 3d 27   expr-6.52 "t1='
2d30: 61 5c 32 36 36 27 2c 20 74 32 3d 27 61 3f 3f 27  a\266', t2='a??'
2d40: 22 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20 30  " {t1 GLOB t2} 0
2d50: 0a 20 20 20 20 74 65 73 74 5f 65 78 70 72 20 65  .    test_expr e
2d60: 78 70 72 2d 36 2e 35 33 20 22 74 31 3d 27 61 78  xpr-6.53 "t1='ax
2d70: 5c 32 36 36 27 2c 20 74 32 3d 27 61 3f 3f 27 22  \266', t2='a??'"
2d80: 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20 31 0a   {t1 GLOB t2} 1.
2d90: 20 20 20 20 74 65 73 74 5f 65 78 70 72 20 65 78      test_expr ex
2da0: 70 72 2d 36 2e 35 34 20 22 74 31 3d 27 61 78 5c  pr-6.54 "t1='ax\
2db0: 32 36 36 27 2c 20 74 32 3d 27 61 3f 5c 32 36 36  266', t2='a?\266
2dc0: 27 22 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20  '" {t1 GLOB t2} 
2dd0: 31 0a 20 20 20 20 74 65 73 74 5f 65 78 70 72 20  1.    test_expr 
2de0: 65 78 70 72 2d 36 2e 35 35 20 22 74 31 3d 27 61  expr-6.55 "t1='a
2df0: 78 5c 32 36 36 79 5c 32 36 36 27 2c 20 74 32 3d  x\266y\266', t2=
2e00: 27 61 2a 5c 32 36 36 27 22 20 7b 74 31 20 47 4c  'a*\266'" {t1 GL
2e10: 4f 42 20 74 32 7d 20 31 0a 20 20 20 20 74 65 73  OB t2} 1.    tes
2e20: 74 5f 65 78 70 72 20 65 78 70 72 2d 36 2e 35 36  t_expr expr-6.56
2e30: 20 22 74 31 3d 27 61 5c 32 36 36 62 27 2c 20 74   "t1='a\266b', t
2e40: 32 3d 27 61 5c 5b 78 5c 32 36 36 79 5c 5d 62 27  2='a\[x\266y\]b'
2e50: 22 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20 31  " {t1 GLOB t2} 1
2e60: 0a 20 20 20 20 74 65 73 74 5f 65 78 70 72 20 65  .    test_expr e
2e70: 78 70 72 2d 36 2e 35 37 20 22 74 31 3d 27 61 5c  xpr-6.57 "t1='a\
2e80: 32 36 36 62 27 2c 20 74 32 3d 27 61 5c 5b 5c 32  266b', t2='a\[\2
2e90: 36 30 2d 5c 32 37 30 5c 5d 62 27 22 20 7b 74 31  60-\270\]b'" {t1
2ea0: 20 47 4c 4f 42 20 74 32 7d 20 31 0a 20 20 20 20   GLOB t2} 1.    
2eb0: 74 65 73 74 5f 65 78 70 72 20 65 78 70 72 2d 36  test_expr expr-6
2ec0: 2e 35 38 20 22 74 31 3d 27 61 5c 32 36 36 62 27  .58 "t1='a\266b'
2ed0: 2c 20 74 32 3d 27 61 5c 5b 5c 32 36 36 2d 5c 32  , t2='a\[\266-\2
2ee0: 37 30 5c 5d 62 27 22 20 7b 74 31 20 47 4c 4f 42  70\]b'" {t1 GLOB
2ef0: 20 74 32 7d 20 31 0a 20 20 20 20 74 65 73 74 5f   t2} 1.    test_
2f00: 65 78 70 72 20 65 78 70 72 2d 36 2e 35 39 20 22  expr expr-6.59 "
2f10: 74 31 3d 27 61 5c 32 36 36 62 27 2c 20 74 32 3d  t1='a\266b', t2=
2f20: 27 61 5c 5b 5c 32 36 37 2d 5c 32 37 30 5c 5d 62  'a\[\267-\270\]b
2f30: 27 22 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20  '" {t1 GLOB t2} 
2f40: 30 0a 20 20 20 20 74 65 73 74 5f 65 78 70 72 20  0.    test_expr 
2f50: 65 78 70 72 2d 36 2e 36 30 20 22 74 31 3d 27 61  expr-6.60 "t1='a
2f60: 5c 32 36 36 62 27 2c 20 74 32 3d 27 61 5c 5b 78  \266b', t2='a\[x
2f70: 2d 5c 32 36 37 5c 5d 62 27 22 20 7b 74 31 20 47  -\267\]b'" {t1 G
2f80: 4c 4f 42 20 74 32 7d 20 31 0a 20 20 20 20 74 65  LOB t2} 1.    te
2f90: 73 74 5f 65 78 70 72 20 65 78 70 72 2d 36 2e 36  st_expr expr-6.6
2fa0: 31 20 22 74 31 3d 27 61 5c 32 36 36 62 27 2c 20  1 "t1='a\266b', 
2fb0: 74 32 3d 27 61 5c 5b 78 2d 5c 32 36 36 5c 5d 62  t2='a\[x-\266\]b
2fc0: 27 22 20 7b 74 31 20 47 4c 4f 42 20 74 32 7d 20  '" {t1 GLOB t2} 
2fd0: 31 0a 20 20 20 20 74 65 73 74 5f 65 78 70 72 20  1.    test_expr 
2fe0: 65 78 70 72 2d 36 2e 36 32 20 22 74 31 3d 27 61  expr-6.62 "t1='a
2ff0: 5c 32 36 36 62 27 2c 20 74 32 3d 27 61 5c 5b 78  \266b', t2='a\[x
3000: 2d 5c 32 36 35 5c 5d 62 27 22 20 7b 74 31 20 47  -\265\]b'" {t1 G
3010: 4c 4f 42 20 74 32 7d 20 30 0a 20 20 7d 0a 7d 0a  LOB t2} 0.  }.}.
3020: 0a 23 20 54 68 65 20 73 71 6c 69 74 65 45 78 70  .# The sqliteExp
3030: 72 49 66 46 61 6c 73 65 20 61 6e 64 20 73 71 6c  rIfFalse and sql
3040: 69 74 65 45 78 70 72 49 66 54 72 75 65 20 72 6f  iteExprIfTrue ro
3050: 75 74 69 6e 65 73 20 61 72 65 20 6f 6e 6c 79 0a  utines are only.
3060: 23 20 65 78 65 63 75 74 65 64 20 61 73 20 70 61  # executed as pa
3070: 72 74 20 6f 66 20 61 20 57 48 45 52 45 20 63 6c  rt of a WHERE cl
3080: 61 75 73 65 2e 20 20 43 72 65 61 74 65 20 61 20  ause.  Create a 
3090: 74 61 62 6c 65 20 73 75 69 74 61 62 6c 65 0a 23  table suitable.#
30a0: 20 66 6f 72 20 74 65 73 74 69 6e 67 20 74 68 65   for testing the
30b0: 73 65 20 66 75 6e 63 74 69 6f 6e 73 2e 0a 23 0a  se functions..#.
30c0: 65 78 65 63 73 71 6c 20 7b 44 52 4f 50 20 54 41  execsql {DROP TA
30d0: 42 4c 45 20 74 65 73 74 31 7d 0a 65 78 65 63 73  BLE test1}.execs
30e0: 71 6c 20 7b 43 52 45 41 54 45 20 54 41 42 4c 45  ql {CREATE TABLE
30f0: 20 74 65 73 74 31 28 61 20 69 6e 74 2c 20 62 20   test1(a int, b 
3100: 69 6e 74 29 3b 7d 0a 66 6f 72 20 7b 73 65 74 20  int);}.for {set 
3110: 69 20 31 7d 20 7b 24 69 3c 3d 32 30 7d 20 7b 69  i 1} {$i<=20} {i
3120: 6e 63 72 20 69 7d 20 7b 0a 20 20 65 78 65 63 73  ncr i} {.  execs
3130: 71 6c 20 22 49 4e 53 45 52 54 20 49 4e 54 4f 20  ql "INSERT INTO 
3140: 74 65 73 74 31 20 56 41 4c 55 45 53 28 24 69 2c  test1 VALUES($i,
3150: 5b 65 78 70 72 20 7b 69 6e 74 28 70 6f 77 28 32  [expr {int(pow(2
3160: 2c 24 69 29 29 7d 5d 29 22 0a 7d 0a 65 78 65 63  ,$i))}])".}.exec
3170: 73 71 6c 20 22 49 4e 53 45 52 54 20 49 4e 54 4f  sql "INSERT INTO
3180: 20 74 65 73 74 31 20 56 41 4c 55 45 53 28 4e 55   test1 VALUES(NU
3190: 4c 4c 2c 30 29 22 0a 64 6f 5f 74 65 73 74 20 65  LL,0)".do_test e
31a0: 78 70 72 2d 37 2e 31 20 7b 0a 20 20 65 78 65 63  xpr-7.1 {.  exec
31b0: 73 71 6c 20 7b 53 45 4c 45 43 54 20 2a 20 46 52  sql {SELECT * FR
31c0: 4f 4d 20 74 65 73 74 31 20 4f 52 44 45 52 20 42  OM test1 ORDER B
31d0: 59 20 61 7d 0a 7d 20 7b 7b 7d 20 30 20 31 20 32  Y a}.} {{} 0 1 2
31e0: 20 32 20 34 20 33 20 38 20 34 20 31 36 20 35 20   2 4 3 8 4 16 5 
31f0: 33 32 20 36 20 36 34 20 37 20 31 32 38 20 38 20  32 6 64 7 128 8 
3200: 32 35 36 20 39 20 35 31 32 20 31 30 20 31 30 32  256 9 512 10 102
3210: 34 20 31 31 20 32 30 34 38 20 31 32 20 34 30 39  4 11 2048 12 409
3220: 36 20 31 33 20 38 31 39 32 20 31 34 20 31 36 33  6 13 8192 14 163
3230: 38 34 20 31 35 20 33 32 37 36 38 20 31 36 20 36  84 15 32768 16 6
3240: 35 35 33 36 20 31 37 20 31 33 31 30 37 32 20 31  5536 17 131072 1
3250: 38 20 32 36 32 31 34 34 20 31 39 20 35 32 34 32  8 262144 19 5242
3260: 38 38 20 32 30 20 31 30 34 38 35 37 36 7d 0a 0a  88 20 1048576}..
3270: 70 72 6f 63 20 74 65 73 74 5f 65 78 70 72 32 20  proc test_expr2 
3280: 7b 6e 61 6d 65 20 65 78 70 72 20 72 65 73 75 6c  {name expr resul
3290: 74 7d 20 7b 0a 20 20 64 6f 5f 74 65 73 74 20 24  t} {.  do_test $
32a0: 6e 61 6d 65 20 5b 66 6f 72 6d 61 74 20 7b 0a 20  name [format {. 
32b0: 20 20 20 65 78 65 63 73 71 6c 20 7b 53 45 4c 45     execsql {SELE
32c0: 43 54 20 61 20 46 52 4f 4d 20 74 65 73 74 31 20  CT a FROM test1 
32d0: 57 48 45 52 45 20 25 73 20 4f 52 44 45 52 20 42  WHERE %s ORDER B
32e0: 59 20 61 7d 0a 20 20 7d 20 24 65 78 70 72 5d 20  Y a}.  } $expr] 
32f0: 24 72 65 73 75 6c 74 0a 7d 0a 0a 74 65 73 74 5f  $result.}..test_
3300: 65 78 70 72 32 20 65 78 70 72 2d 37 2e 32 20 20  expr2 expr-7.2  
3310: 7b 61 3c 31 30 20 41 4e 44 20 61 3e 38 7d 20 20  {a<10 AND a>8}  
3320: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
3330: 7b 39 7d 0a 74 65 73 74 5f 65 78 70 72 32 20 65  {9}.test_expr2 e
3340: 78 70 72 2d 37 2e 33 20 20 7b 61 3c 3d 31 30 20  xpr-7.3  {a<=10 
3350: 41 4e 44 20 61 3e 3d 38 7d 20 20 20 20 20 20 20  AND a>=8}       
3360: 20 20 20 20 20 20 20 20 20 7b 38 20 39 20 31 30           {8 9 10
3370: 7d 0a 74 65 73 74 5f 65 78 70 72 32 20 65 78 70  }.test_expr2 exp
3380: 72 2d 37 2e 34 20 20 7b 61 3e 3d 38 20 41 4e 44  r-7.4  {a>=8 AND
3390: 20 61 3c 3d 31 30 7d 20 20 20 20 20 20 20 20 20   a<=10}         
33a0: 20 20 20 20 20 20 20 7b 38 20 39 20 31 30 7d 0a         {8 9 10}.
33b0: 74 65 73 74 5f 65 78 70 72 32 20 65 78 70 72 2d  test_expr2 expr-
33c0: 37 2e 35 20 20 7b 61 3e 3d 32 30 20 4f 52 20 61  7.5  {a>=20 OR a
33d0: 3c 3d 31 7d 20 20 20 20 20 20 20 20 20 20 20 20  <=1}            
33e0: 20 20 20 20 20 7b 7b 7d 20 31 20 32 30 7d 0a 74       {{} 1 20}.t
33f0: 65 73 74 5f 65 78 70 72 32 20 65 78 70 72 2d 37  est_expr2 expr-7
3400: 2e 36 20 20 7b 62 21 3d 34 20 41 4e 44 20 61 3c  .6  {b!=4 AND a<
3410: 3d 33 7d 20 20 20 20 20 20 20 20 20 20 20 20 20  =3}             
3420: 20 20 20 20 7b 7b 7d 20 31 20 33 7d 0a 74 65 73      {{} 1 3}.tes
3430: 74 5f 65 78 70 72 32 20 65 78 70 72 2d 37 2e 37  t_expr2 expr-7.7
3440: 20 20 7b 62 3d 3d 38 20 4f 52 20 62 3d 3d 31 36    {b==8 OR b==16
3450: 20 4f 52 20 62 3d 3d 33 32 7d 20 20 20 20 20 20   OR b==32}      
3460: 20 20 7b 33 20 34 20 35 7d 0a 74 65 73 74 5f 65    {3 4 5}.test_e
3470: 78 70 72 32 20 65 78 70 72 2d 37 2e 38 20 20 7b  xpr2 expr-7.8  {
3480: 4e 4f 54 20 62 3c 3e 38 20 4f 52 20 62 3d 3d 31  NOT b<>8 OR b==1
3490: 30 32 34 7d 20 20 20 20 20 20 20 20 20 20 20 7b  024}           {
34a0: 33 20 31 30 7d 0a 74 65 73 74 5f 65 78 70 72 32  3 10}.test_expr2
34b0: 20 65 78 70 72 2d 37 2e 39 20 20 7b 62 20 4c 49   expr-7.9  {b LI
34c0: 4b 45 20 27 31 30 25 27 7d 20 20 20 20 20 20 20  KE '10%'}       
34d0: 20 20 20 20 20 20 20 20 20 20 20 7b 31 30 20 32             {10 2
34e0: 30 7d 0a 74 65 73 74 5f 65 78 70 72 32 20 65 78  0}.test_expr2 ex
34f0: 70 72 2d 37 2e 31 30 20 7b 62 20 4c 49 4b 45 20  pr-7.10 {b LIKE 
3500: 27 5f 34 27 7d 20 20 20 20 20 20 20 20 20 20 20  '_4'}           
3510: 20 20 20 20 20 20 20 20 7b 36 7d 0a 74 65 73 74          {6}.test
3520: 5f 65 78 70 72 32 20 65 78 70 72 2d 37 2e 31 31  _expr2 expr-7.11
3530: 20 7b 61 20 47 4c 4f 42 20 27 31 3f 27 7d 20 20   {a GLOB '1?'}  
3540: 20 20 20 20 20 20 20 20 20 20 7b 31 30 20 31 31            {10 11
3550: 20 31 32 20 31 33 20 31 34 20 31 35 20 31 36 20   12 13 14 15 16 
3560: 31 37 20 31 38 20 31 39 7d 0a 74 65 73 74 5f 65  17 18 19}.test_e
3570: 78 70 72 32 20 65 78 70 72 2d 37 2e 31 32 20 7b  xpr2 expr-7.12 {
3580: 62 20 47 4c 4f 42 20 27 31 2a 34 27 7d 20 20 20  b GLOB '1*4'}   
3590: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7b                 {
35a0: 31 30 20 31 34 7d 0a 74 65 73 74 5f 65 78 70 72  10 14}.test_expr
35b0: 32 20 65 78 70 72 2d 37 2e 31 33 20 7b 62 20 47  2 expr-7.13 {b G
35c0: 4c 4f 42 20 27 2a 31 5b 34 35 36 5d 27 7d 20 20  LOB '*1[456]'}  
35d0: 20 20 20 20 20 20 20 20 20 20 20 20 7b 34 7d 0a              {4}.
35e0: 74 65 73 74 5f 65 78 70 72 32 20 65 78 70 72 2d  test_expr2 expr-
35f0: 37 2e 31 34 20 7b 61 20 49 53 4e 55 4c 4c 7d 20  7.14 {a ISNULL} 
3600: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
3610: 20 20 20 20 20 7b 7b 7d 7d 0a 74 65 73 74 5f 65       {{}}.test_e
3620: 78 70 72 32 20 65 78 70 72 2d 37 2e 31 35 20 7b  xpr2 expr-7.15 {
3630: 61 20 4e 4f 54 4e 55 4c 4c 20 41 4e 44 20 61 3c  a NOTNULL AND a<
3640: 33 7d 20 20 20 20 20 20 20 20 20 20 20 20 20 7b  3}             {
3650: 31 20 32 7d 0a 74 65 73 74 5f 65 78 70 72 32 20  1 2}.test_expr2 
3660: 65 78 70 72 2d 37 2e 31 36 20 7b 61 20 41 4e 44  expr-7.16 {a AND
3670: 20 61 3c 33 7d 20 20 20 20 20 20 20 20 20 20 20   a<3}           
3680: 20 20 20 20 20 20 20 20 20 20 7b 31 20 32 7d 0a            {1 2}.
3690: 74 65 73 74 5f 65 78 70 72 32 20 65 78 70 72 2d  test_expr2 expr-
36a0: 37 2e 31 37 20 7b 4e 4f 54 20 61 7d 20 20 20 20  7.17 {NOT a}    
36b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
36c0: 20 20 20 20 20 7b 7b 7d 7d 0a 74 65 73 74 5f 65       {{}}.test_e
36d0: 78 70 72 32 20 65 78 70 72 2d 37 2e 31 38 20 7b  xpr2 expr-7.18 {
36e0: 61 3d 3d 31 31 20 4f 52 20 28 62 3e 31 30 30 30  a==11 OR (b>1000
36f0: 20 41 4e 44 20 62 3c 32 30 30 30 29 7d 20 20 7b   AND b<2000)}  {
3700: 31 30 20 31 31 7d 0a 74 65 73 74 5f 65 78 70 72  10 11}.test_expr
3710: 32 20 65 78 70 72 2d 37 2e 31 39 20 7b 61 3c 3d  2 expr-7.19 {a<=
3720: 31 20 4f 52 20 61 3e 3d 32 30 7d 20 20 20 20 20  1 OR a>=20}     
3730: 20 20 20 20 20 20 20 20 20 20 20 20 7b 7b 7d 20              {{} 
3740: 31 20 32 30 7d 0a 74 65 73 74 5f 65 78 70 72 32  1 20}.test_expr2
3750: 20 65 78 70 72 2d 37 2e 32 30 20 7b 61 3c 31 20   expr-7.20 {a<1 
3760: 4f 52 20 61 3e 32 30 7d 20 20 20 20 20 20 20 20  OR a>20}        
3770: 20 20 20 20 20 20 20 20 20 20 20 7b 7b 7d 7d 0a             {{}}.
3780: 74 65 73 74 5f 65 78 70 72 32 20 65 78 70 72 2d  test_expr2 expr-
3790: 37 2e 32 31 20 7b 61 3e 31 39 20 4f 52 20 61 3c  7.21 {a>19 OR a<
37a0: 31 7d 20 20 20 20 20 20 20 20 20 20 20 20 20 20  1}              
37b0: 20 20 20 20 20 7b 7b 7d 20 32 30 7d 0a 74 65 73       {{} 20}.tes
37c0: 74 5f 65 78 70 72 32 20 65 78 70 72 2d 37 2e 32  t_expr2 expr-7.2
37d0: 32 20 7b 61 21 3d 31 20 4f 52 20 61 3d 31 30 30  2 {a!=1 OR a=100
37e0: 7d 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20  } \.            
37f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 7b 7b 7d               {{}
3800: 20 32 20 33 20 34 20 35 20 36 20 37 20 38 20 39   2 3 4 5 6 7 8 9
3810: 20 31 30 20 31 31 20 31 32 20 31 33 20 31 34 20   10 11 12 13 14 
3820: 31 35 20 31 36 20 31 37 20 31 38 20 31 39 20 32  15 16 17 18 19 2
3830: 30 7d 0a 74 65 73 74 5f 65 78 70 72 32 20 65 78  0}.test_expr2 ex
3840: 70 72 2d 37 2e 32 33 20 7b 28 61 20 6e 6f 74 6e  pr-7.23 {(a notn
3850: 75 6c 6c 20 41 4e 44 20 61 3c 34 29 20 4f 52 20  ull AND a<4) OR 
3860: 61 3d 3d 38 7d 20 20 20 7b 31 20 32 20 33 20 38  a==8}   {1 2 3 8
3870: 7d 0a 74 65 73 74 5f 65 78 70 72 32 20 65 78 70  }.test_expr2 exp
3880: 72 2d 37 2e 32 34 20 7b 61 20 4c 49 4b 45 20 27  r-7.24 {a LIKE '
3890: 32 5f 27 20 4f 52 20 61 3d 3d 38 7d 20 20 20 20  2_' OR a==8}    
38a0: 20 20 20 20 20 20 20 7b 38 20 32 30 7d 0a 74 65         {8 20}.te
38b0: 73 74 5f 65 78 70 72 32 20 65 78 70 72 2d 37 2e  st_expr2 expr-7.
38c0: 32 35 20 7b 61 20 47 4c 4f 42 20 27 32 3f 27 20  25 {a GLOB '2?' 
38d0: 4f 52 20 61 3d 3d 38 7d 20 20 20 20 20 20 20 20  OR a==8}        
38e0: 20 20 20 7b 38 20 32 30 7d 0a 74 65 73 74 5f 65     {8 20}.test_e
38f0: 78 70 72 32 20 65 78 70 72 2d 37 2e 32 36 20 7b  xpr2 expr-7.26 {
3900: 61 20 69 73 6e 75 6c 6c 20 4f 52 20 61 3d 38 7d  a isnull OR a=8}
3910: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7b                 {
3920: 7b 7d 20 38 7d 0a 74 65 73 74 5f 65 78 70 72 32  {} 8}.test_expr2
3930: 20 65 78 70 72 2d 37 2e 32 37 20 7b 61 20 6e 6f   expr-7.27 {a no
3940: 74 6e 75 6c 6c 20 4f 52 20 61 3d 38 7d 20 5c 0a  tnull OR a=8} \.
3950: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
3960: 20 20 20 20 20 20 20 20 20 20 7b 31 20 32 20 33            {1 2 3
3970: 20 34 20 35 20 36 20 37 20 38 20 39 20 31 30 20   4 5 6 7 8 9 10 
3980: 31 31 20 31 32 20 31 33 20 31 34 20 31 35 20 31  11 12 13 14 15 1
3990: 36 20 31 37 20 31 38 20 31 39 20 32 30 7d 0a 0a  6 17 18 19 20}..
39a0: 66 69 6e 69 73 68 5f 74 65 73 74 0a              finish_test.