interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / test / whereM.test

112 lines · 3073 bytes Raw Blame History
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
15set testdir [file dirname $argv0]
16source $testdir/tester.tcl
17source $testdir/malloc_common.tcl
18set testprefix whereM
19
20
21do_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
29do_execsql_test 1.1.1 {
30 SELECT a=10, a = '10.0', a LIKE '10.0' FROM t1;
31} {1 0 1}
32do_execsql_test 1.1.2 {
33 SELECT count(*) FROM t1 WHERE a=10 AND a = '10.0'
34} {0}
35do_execsql_test 1.1.3 {
36 SELECT count(*) FROM t1 WHERE a=10 AND a LIKE '10.0'
37} {1}
38do_execsql_test 1.1.4 {
39 SELECT count(*) FROM t1 WHERE a='10.0' AND a LIKE '10.0'
40} {0}
41
42do_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}
45do_execsql_test 1.2.2 {
46 SELECT count(*) FROM t1 WHERE b=10 AND b = '10.0'
47} {1}
48do_execsql_test 1.2.3 {
49 SELECT count(*) FROM t1 WHERE b=10 AND b LIKE '10.0'
50} {0}
51do_execsql_test 1.2.4 {
52 SELECT count(*) FROM t1 WHERE b='10.0' AND b LIKE '10.0'
53} {0}
54do_execsql_test 1.2.3 {
55 SELECT count(*) FROM t1 WHERE b=10 AND b LIKE '10'
56} {1}
57do_execsql_test 1.2.4 {
58 SELECT count(*) FROM t1 WHERE b='10.0' AND b LIKE '10'
59} {1}
60
61do_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}
64do_execsql_test 1.3.2 {
65 SELECT count(*) FROM t1 WHERE c=10 AND c = '10.0'
66} {0}
67do_execsql_test 1.3.3 {
68 SELECT count(*) FROM t1 WHERE c=10 AND c LIKE '10.0'
69} {0}
70do_execsql_test 1.3.4 {
71 SELECT count(*) FROM t1 WHERE c='10.0' AND c LIKE '10.0'
72} {1}
73do_execsql_test 1.3.5 {
74 SELECT count(*) FROM t1 WHERE c=10.0 AND c = '10.0'
75} {1}
76do_execsql_test 1.3.6 {
77 SELECT count(*) FROM t1 WHERE c=10.0 AND c LIKE '10.0'
78} {1}
79
80do_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}
83do_execsql_test 1.4.2 {
84 SELECT count(*) FROM t1 WHERE d=10 AND d = '10.0'
85} {1}
86do_execsql_test 1.4.3 {
87 SELECT count(*) FROM t1 WHERE d=10 AND d LIKE '10.0'
88} {1}
89do_execsql_test 1.4.4 {
90 SELECT count(*) FROM t1 WHERE d='10.0' AND d LIKE '10.0'
91} {1}
92do_execsql_test 1.4.5 {
93 SELECT count(*) FROM t1 WHERE d='10' AND d LIKE '10.0'
94} {1}
95
96do_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}
99do_execsql_test 1.5.2 {
100 SELECT count(*) FROM t1 WHERE e=10 AND e = '10.0'
101} {0}
102do_execsql_test 1.5.3 {
103 SELECT count(*) FROM t1 WHERE e=10 AND e LIKE '10.0'
104} {1}
105do_execsql_test 1.5.4 {
106 SELECT count(*) FROM t1 WHERE e='10.0' AND e LIKE '10.0'
107} {0}
108do_execsql_test 1.5.5 {
109 SELECT count(*) FROM t1 WHERE e=10.0 AND e LIKE '10.0'
110} {1}
111
112finish_test