OLD | NEW |
| (Empty) |
1 # 2014 March 25. | |
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 # This file implements regression tests for SQLite library. | |
12 # | |
13 # Specifically, the tests in this file attempt to verify that | |
14 # multi-threaded sorting works. | |
15 # | |
16 | |
17 set testdir [file dirname $argv0] | |
18 source $testdir/tester.tcl | |
19 set testprefix sort2 | |
20 db close | |
21 sqlite3_shutdown | |
22 sqlite3_config_pmasz 10 | |
23 sqlite3_initialize | |
24 sqlite3 db test.db | |
25 | |
26 foreach {tn script} { | |
27 1 { } | |
28 2 { | |
29 catch { db close } | |
30 reset_db | |
31 catch { db eval {PRAGMA threads=7} } | |
32 } | |
33 } { | |
34 | |
35 eval $script | |
36 | |
37 do_execsql_test $tn.1 { | |
38 PRAGMA cache_size = 5; | |
39 WITH r(x,y) AS ( | |
40 SELECT 1, randomblob(100) | |
41 UNION ALL | |
42 SELECT x+1, randomblob(100) FROM r | |
43 LIMIT 100000 | |
44 ) | |
45 SELECT count(x), length(y) FROM r GROUP BY (x%5) | |
46 } { | |
47 20000 100 20000 100 20000 100 20000 100 20000 100 | |
48 } | |
49 | |
50 do_execsql_test $tn.2.1 { | |
51 CREATE TABLE t1(a, b); | |
52 WITH r(x,y) AS ( | |
53 SELECT 1, randomblob(100) | |
54 UNION ALL | |
55 SELECT x+1, randomblob(100) FROM r | |
56 LIMIT 10000 | |
57 ) INSERT INTO t1 SELECT * FROM r; | |
58 } | |
59 | |
60 do_execsql_test $tn.2.2 { | |
61 CREATE UNIQUE INDEX i1 ON t1(b, a); | |
62 } | |
63 | |
64 do_execsql_test $tn.2.3 { | |
65 CREATE UNIQUE INDEX i2 ON t1(a); | |
66 } | |
67 | |
68 do_execsql_test $tn.2.4 { PRAGMA integrity_check } {ok} | |
69 | |
70 do_execsql_test $tn.3 { | |
71 PRAGMA cache_size = 5; | |
72 WITH r(x,y) AS ( | |
73 SELECT 1, randomblob(100) | |
74 UNION ALL | |
75 SELECT x+1, randomblob(100) FROM r | |
76 LIMIT 1000000 | |
77 ) | |
78 SELECT count(x), length(y) FROM r GROUP BY (x%5) | |
79 } { | |
80 200000 100 200000 100 200000 100 200000 100 200000 100 | |
81 } | |
82 } | |
83 | |
84 finish_test | |
OLD | NEW |