Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(587)

Side by Side Diff: third_party/sqlite/src/test/minmax3.test

Issue 6990047: Import SQLite 3.7.6.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/sqlite/src/test/memsubsys1.test ('k') | third_party/sqlite/src/test/misc1.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 2008 January 5 1 # 2008 January 5
2 # 2 #
3 # The author disclaims copyright to this source code. In place of 3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing: 4 # a legal notice, here is a blessing:
5 # 5 #
6 # May you do good and not evil. 6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others. 7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give. 8 # May you share freely, never taking more than you give.
9 # 9 #
10 #*********************************************************************** 10 #***********************************************************************
11 # $Id: minmax3.test,v 1.5 2008/07/12 14:52:20 drh Exp $ 11 # $Id: minmax3.test,v 1.5 2008/07/12 14:52:20 drh Exp $
12 12
13 set testdir [file dirname $argv0] 13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl 14 source $testdir/tester.tcl
15 15
16 # Do not use a codec for tests in this file, as the database file is
17 # manipulated directly using tcl scripts (using the [hexio_write] command).
18 #
19 do_not_use_codec
20
16 # Do an SQL statement. Append the search count to the end of the result. 21 # Do an SQL statement. Append the search count to the end of the result.
17 # 22 #
18 proc count sql { 23 proc count sql {
19 set ::sqlite_search_count 0 24 set ::sqlite_search_count 0
20 return [concat [execsql $sql] $::sqlite_search_count] 25 return [concat [execsql $sql] $::sqlite_search_count]
21 } 26 }
22 27
23 # This procedure sets the value of the file-format in file 'test.db' 28 # This procedure sets the value of the file-format in file 'test.db'
24 # to $newval. Also, the schema cookie is incremented. 29 # to $newval. Also, the schema cookie is incremented.
25 # 30 #
(...skipping 14 matching lines...) Expand all
40 sqlite3 db test.db 45 sqlite3 db test.db
41 execsql { 46 execsql {
42 BEGIN; 47 BEGIN;
43 INSERT INTO t1 VALUES('1', 'I', 'one'); 48 INSERT INTO t1 VALUES('1', 'I', 'one');
44 INSERT INTO t1 VALUES('2', 'IV', 'four'); 49 INSERT INTO t1 VALUES('2', 'IV', 'four');
45 INSERT INTO t1 VALUES('2', NULL, 'three'); 50 INSERT INTO t1 VALUES('2', NULL, 'three');
46 INSERT INTO t1 VALUES('2', 'II', 'two'); 51 INSERT INTO t1 VALUES('2', 'II', 'two');
47 INSERT INTO t1 VALUES('2', 'V', 'five'); 52 INSERT INTO t1 VALUES('2', 'V', 'five');
48 INSERT INTO t1 VALUES('3', 'VI', 'six'); 53 INSERT INTO t1 VALUES('3', 'VI', 'six');
49 COMMIT; 54 COMMIT;
55 PRAGMA automatic_index=OFF;
50 } 56 }
51 } {} 57 } {}
52 do_test minmax3-1.1.1 { 58 do_test minmax3-1.1.1 {
53 # Linear scan. 59 # Linear scan.
54 count { SELECT max(y) FROM t1 WHERE x = '2'; } 60 count { SELECT max(y) FROM t1 WHERE x = '2'; }
55 } {V 5} 61 } {V 5}
56 do_test minmax3-1.1.2 { 62 do_test minmax3-1.1.2 {
57 # Index optimizes the WHERE x='2' constraint. 63 # Index optimizes the WHERE x='2' constraint.
58 execsql { CREATE INDEX i1 ON t1(x) } 64 execsql { CREATE INDEX i1 ON t1(x) }
59 count { SELECT max(y) FROM t1 WHERE x = '2'; } 65 count { SELECT max(y) FROM t1 WHERE x = '2'; }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 do_test minmax3-2.6 { 173 do_test minmax3-2.6 {
168 execsql { SELECT min(b) FROM t2 WHERE a = 1 AND b<2; } 174 execsql { SELECT min(b) FROM t2 WHERE a = 1 AND b<2; }
169 } {1} 175 } {1}
170 do_test minmax3-2.7 { 176 do_test minmax3-2.7 {
171 execsql { SELECT min(b) FROM t2 WHERE a = 1 AND b<1; } 177 execsql { SELECT min(b) FROM t2 WHERE a = 1 AND b<1; }
172 } {{}} 178 } {{}}
173 do_test minmax3-2.8 { 179 do_test minmax3-2.8 {
174 execsql { SELECT min(b) FROM t2 WHERE a = 3 AND b<1; } 180 execsql { SELECT min(b) FROM t2 WHERE a = 3 AND b<1; }
175 } {{}} 181 } {{}}
176 182
177 do_test minmax3-2.1 { 183 do_test minmax3-3.1 {
178 execsql { 184 execsql {
179 DROP TABLE t2; 185 DROP TABLE t2;
180 CREATE TABLE t2(a, b); 186 CREATE TABLE t2(a, b);
181 CREATE INDEX i3 ON t2(a, b DESC); 187 CREATE INDEX i3 ON t2(a, b DESC);
182 INSERT INTO t2 VALUES(1, NULL); 188 INSERT INTO t2 VALUES(1, NULL);
183 INSERT INTO t2 VALUES(1, 1); 189 INSERT INTO t2 VALUES(1, 1);
184 INSERT INTO t2 VALUES(1, 2); 190 INSERT INTO t2 VALUES(1, 2);
185 INSERT INTO t2 VALUES(1, 3); 191 INSERT INTO t2 VALUES(1, 3);
186 INSERT INTO t2 VALUES(2, NULL); 192 INSERT INTO t2 VALUES(2, NULL);
187 INSERT INTO t2 VALUES(2, 1); 193 INSERT INTO t2 VALUES(2, 1);
188 INSERT INTO t2 VALUES(2, 2); 194 INSERT INTO t2 VALUES(2, 2);
189 INSERT INTO t2 VALUES(2, 3); 195 INSERT INTO t2 VALUES(2, 3);
190 INSERT INTO t2 VALUES(3, 1); 196 INSERT INTO t2 VALUES(3, 1);
191 INSERT INTO t2 VALUES(3, 2); 197 INSERT INTO t2 VALUES(3, 2);
192 INSERT INTO t2 VALUES(3, 3); 198 INSERT INTO t2 VALUES(3, 3);
193 } 199 }
194 } {} 200 } {}
195 do_test minmax3-2.2 { 201 do_test minmax3-3.2 {
196 execsql { SELECT min(b) FROM t2 WHERE a = 1; } 202 execsql { SELECT min(b) FROM t2 WHERE a = 1; }
197 } {1} 203 } {1}
198 do_test minmax3-2.3 { 204 do_test minmax3-3.3 {
199 execsql { SELECT min(b) FROM t2 WHERE a = 1 AND b>1; } 205 execsql { SELECT min(b) FROM t2 WHERE a = 1 AND b>1; }
200 } {2} 206 } {2}
201 do_test minmax3-2.4 { 207 do_test minmax3-3.4 {
202 execsql { SELECT min(b) FROM t2 WHERE a = 1 AND b>-1; } 208 execsql { SELECT min(b) FROM t2 WHERE a = 1 AND b>-1; }
203 } {1} 209 } {1}
204 do_test minmax3-2.5 { 210 do_test minmax3-3.5 {
205 execsql { SELECT min(b) FROM t2 WHERE a = 1; } 211 execsql { SELECT min(b) FROM t2 WHERE a = 1; }
206 } {1} 212 } {1}
207 do_test minmax3-2.6 { 213 do_test minmax3-3.6 {
208 execsql { SELECT min(b) FROM t2 WHERE a = 1 AND b<2; } 214 execsql { SELECT min(b) FROM t2 WHERE a = 1 AND b<2; }
209 } {1} 215 } {1}
210 do_test minmax3-2.7 { 216 do_test minmax3-3.7 {
211 execsql { SELECT min(b) FROM t2 WHERE a = 1 AND b<1; } 217 execsql { SELECT min(b) FROM t2 WHERE a = 1 AND b<1; }
212 } {{}} 218 } {{}}
213 do_test minmax3-2.8 { 219 do_test minmax3-3.8 {
214 execsql { SELECT min(b) FROM t2 WHERE a = 3 AND b<1; } 220 execsql { SELECT min(b) FROM t2 WHERE a = 3 AND b<1; }
215 } {{}} 221 } {{}}
216 222
223 do_test minmax3-4.1 {
224 execsql {
225 CREATE TABLE t4(x);
226 INSERT INTO t4 VALUES('abc');
227 INSERT INTO t4 VALUES('BCD');
228 SELECT max(x) FROM t4;
229 }
230 } {abc}
231 do_test minmax3-4.2 {
232 execsql {
233 SELECT max(x COLLATE nocase) FROM t4;
234 }
235 } {BCD}
236 do_test minmax3-4.3 {
237 execsql {
238 SELECT max(x), max(x COLLATE nocase) FROM t4;
239 }
240 } {abc BCD}
241 do_test minmax3-4.4 {
242 execsql {
243 SELECT max(x COLLATE binary), max(x COLLATE nocase) FROM t4;
244 }
245 } {abc BCD}
246 do_test minmax3-4.5 {
247 execsql {
248 SELECT max(x COLLATE nocase), max(x COLLATE rtrim) FROM t4;
249 }
250 } {BCD abc}
251 do_test minmax3-4.6 {
252 execsql {
253 SELECT max(x COLLATE nocase), max(x) FROM t4;
254 }
255 } {BCD abc}
256 do_test minmax3-4.10 {
257 execsql {
258 SELECT min(x) FROM t4;
259 }
260 } {BCD}
261 do_test minmax3-4.11 {
262 execsql {
263 SELECT min(x COLLATE nocase) FROM t4;
264 }
265 } {abc}
266 do_test minmax3-4.12 {
267 execsql {
268 SELECT min(x), min(x COLLATE nocase) FROM t4;
269 }
270 } {BCD abc}
271 do_test minmax3-4.13 {
272 execsql {
273 SELECT min(x COLLATE binary), min(x COLLATE nocase) FROM t4;
274 }
275 } {BCD abc}
276 do_test minmax3-4.14 {
277 execsql {
278 SELECT min(x COLLATE nocase), min(x COLLATE rtrim) FROM t4;
279 }
280 } {abc BCD}
281 do_test minmax3-4.15 {
282 execsql {
283 SELECT min(x COLLATE nocase), min(x) FROM t4;
284 }
285 } {abc BCD}
286
287
217 finish_test 288 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/memsubsys1.test ('k') | third_party/sqlite/src/test/misc1.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698