xref: /sqlite-3.40.0/test/sort2.test (revision d30ab3d9)
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
14set testdir [file dirname $argv0]
15source $testdir/tester.tcl
16set testprefix sort2
17
18db close
19sqlite3_shutdown
20sqlite3_config_worker_threads 7
21reset_db
22
23do_execsql_test 1 {
24  PRAGMA cache_size = 5;
25  WITH r(x,y) AS (
26    SELECT 1, randomblob(100)
27    UNION ALL
28    SELECT x+1, randomblob(100) FROM r
29    LIMIT 100000
30  )
31  SELECT count(x), length(y) FROM r GROUP BY (x%5)
32} {
33  20000 100 20000 100 20000 100 20000 100 20000 100
34}
35
36do_execsql_test 2.1 {
37  CREATE TABLE t1(a, b);
38  WITH r(x,y) AS (
39    SELECT 1, randomblob(100)
40    UNION ALL
41    SELECT x+1, randomblob(100) FROM r
42    LIMIT 10000
43  ) INSERT INTO t1 SELECT * FROM r;
44}
45
46do_execsql_test 2.2 {
47  CREATE UNIQUE INDEX i1 ON t1(b, a);
48}
49
50do_execsql_test 2.3 {
51  CREATE UNIQUE INDEX i2 ON t1(a);
52}
53
54do_execsql_test 2.4 { PRAGMA integrity_check } {ok}
55
56db close
57sqlite3_shutdown
58sqlite3_config_worker_threads 0
59sqlite3_initialize
60finish_test
61
62