sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
| 1 | # 2021 May 27 |
| 2 | # |
| 3 | # The author disclaims copyright to this source code. In place of |
| 4 | # a legal notice, here is a blessing: |
| 5 | # |
| 6 | # May you do good and not evil. |
| 7 | # May you find forgiveness for yourself and forgive others. |
| 8 | # May you share freely, never taking more than you give. |
| 9 | # |
| 10 | #*********************************************************************** |
| 11 | # Tests focused on the "constant propagation" that occurs within the |
| 12 | # WHERE clause of a SELECT statemente. |
| 13 | # |
| 14 | |
| 15 | set testdir [file dirname $argv0] |
| 16 | source $testdir/tester.tcl |
| 17 | source $testdir/malloc_common.tcl |
| 18 | set testprefix whereM |
| 19 | |
| 20 | |
| 21 | do_execsql_test 1.0 { |
| 22 | CREATE TABLE t1(a, b INTEGER, c TEXT, d REAL, e BLOB); |
| 23 | INSERT INTO t1 VALUES(10.0, 10.0, 10.0, 10.0, 10.0); |
| 24 | SELECT * FROM t1; |
| 25 | } { |
| 26 | 10.0 10 10.0 10.0 10.0 |
| 27 | } |
| 28 | |
| 29 | do_execsql_test 1.1.1 { |
| 30 | SELECT a=10, a = '10.0', a LIKE '10.0' FROM t1; |
| 31 | } {1 0 1} |
| 32 | do_execsql_test 1.1.2 { |
| 33 | SELECT count(*) FROM t1 WHERE a=10 AND a = '10.0' |
| 34 | } {0} |
| 35 | do_execsql_test 1.1.3 { |
| 36 | SELECT count(*) FROM t1 WHERE a=10 AND a LIKE '10.0' |
| 37 | } {1} |
| 38 | do_execsql_test 1.1.4 { |
| 39 | SELECT count(*) FROM t1 WHERE a='10.0' AND a LIKE '10.0' |
| 40 | } {0} |
| 41 | |
| 42 | do_execsql_test 1.2.1 { |
| 43 | SELECT b=10, b = '10.0', b LIKE '10.0', b LIKE '10' FROM t1; |
| 44 | } {1 1 0 1} |
| 45 | do_execsql_test 1.2.2 { |
| 46 | SELECT count(*) FROM t1 WHERE b=10 AND b = '10.0' |
| 47 | } {1} |
| 48 | do_execsql_test 1.2.3 { |
| 49 | SELECT count(*) FROM t1 WHERE b=10 AND b LIKE '10.0' |
| 50 | } {0} |
| 51 | do_execsql_test 1.2.4 { |
| 52 | SELECT count(*) FROM t1 WHERE b='10.0' AND b LIKE '10.0' |
| 53 | } {0} |
| 54 | do_execsql_test 1.2.3 { |
| 55 | SELECT count(*) FROM t1 WHERE b=10 AND b LIKE '10' |
| 56 | } {1} |
| 57 | do_execsql_test 1.2.4 { |
| 58 | SELECT count(*) FROM t1 WHERE b='10.0' AND b LIKE '10' |
| 59 | } {1} |
| 60 | |
| 61 | do_execsql_test 1.3.1 { |
| 62 | SELECT c=10, c = 10.0, c = '10.0', c LIKE '10.0' FROM t1; |
| 63 | } {0 1 1 1} |
| 64 | do_execsql_test 1.3.2 { |
| 65 | SELECT count(*) FROM t1 WHERE c=10 AND c = '10.0' |
| 66 | } {0} |
| 67 | do_execsql_test 1.3.3 { |
| 68 | SELECT count(*) FROM t1 WHERE c=10 AND c LIKE '10.0' |
| 69 | } {0} |
| 70 | do_execsql_test 1.3.4 { |
| 71 | SELECT count(*) FROM t1 WHERE c='10.0' AND c LIKE '10.0' |
| 72 | } {1} |
| 73 | do_execsql_test 1.3.5 { |
| 74 | SELECT count(*) FROM t1 WHERE c=10.0 AND c = '10.0' |
| 75 | } {1} |
| 76 | do_execsql_test 1.3.6 { |
| 77 | SELECT count(*) FROM t1 WHERE c=10.0 AND c LIKE '10.0' |
| 78 | } {1} |
| 79 | |
| 80 | do_execsql_test 1.4.1 { |
| 81 | SELECT d=10, d = 10.0, d = '10.0', d LIKE '10.0', d LIKE '10' FROM t1; |
| 82 | } {1 1 1 1 0} |
| 83 | do_execsql_test 1.4.2 { |
| 84 | SELECT count(*) FROM t1 WHERE d=10 AND d = '10.0' |
| 85 | } {1} |
| 86 | do_execsql_test 1.4.3 { |
| 87 | SELECT count(*) FROM t1 WHERE d=10 AND d LIKE '10.0' |
| 88 | } {1} |
| 89 | do_execsql_test 1.4.4 { |
| 90 | SELECT count(*) FROM t1 WHERE d='10.0' AND d LIKE '10.0' |
| 91 | } {1} |
| 92 | do_execsql_test 1.4.5 { |
| 93 | SELECT count(*) FROM t1 WHERE d='10' AND d LIKE '10.0' |
| 94 | } {1} |
| 95 | |
| 96 | do_execsql_test 1.5.1 { |
| 97 | SELECT e=10, e = '10.0', e LIKE '10.0', e LIKE '10' FROM t1; |
| 98 | } {1 0 1 0} |
| 99 | do_execsql_test 1.5.2 { |
| 100 | SELECT count(*) FROM t1 WHERE e=10 AND e = '10.0' |
| 101 | } {0} |
| 102 | do_execsql_test 1.5.3 { |
| 103 | SELECT count(*) FROM t1 WHERE e=10 AND e LIKE '10.0' |
| 104 | } {1} |
| 105 | do_execsql_test 1.5.4 { |
| 106 | SELECT count(*) FROM t1 WHERE e='10.0' AND e LIKE '10.0' |
| 107 | } {0} |
| 108 | do_execsql_test 1.5.5 { |
| 109 | SELECT count(*) FROM t1 WHERE e=10.0 AND e LIKE '10.0' |
| 110 | } {1} |
| 111 | |
| 112 | finish_test |