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

Side by Side Diff: third_party/sqlite/sqlite-src-3170000/test/numindex1.test

Issue 2747283002: [sql] Import reference version of SQLite 3.17.. (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
(Empty)
1 # 2015-11-05
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 tests for indexes on large numeric values.
12 #
13
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
16
17
18 # Test cases from Zsbán Ambrus:
19 #
20 do_execsql_test numindex1-1.1 {
21 CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
22 CREATE INDEX t1b ON t1(b);
23 INSERT INTO t1(a,b) VALUES(100, 356282677878746339);
24 INSERT INTO t1(a,b) VALUES(50, 356282677878746339.0);
25 INSERT INTO t1(a,b) VALUES(0, 356282677878746340);
26 DELETE FROM t1 WHERE a=50;
27 PRAGMA integrity_check;
28 } {ok}
29
30 do_execsql_test numindex1-1.2 {
31 CREATE TABLE t2(a,b);
32 INSERT INTO t2(a,b) VALUES('b', 1<<58),
33 ('c', (1<<58)+1e-7), ('d', (1<<58)+1);
34 SELECT a, b, typeof(b), '|' FROM t2 ORDER BY +a;
35 } {b 288230376151711744 integer | c 2.88230376151712e+17 real | d 28823037615171 1745 integer |}
36
37 do_execsql_test numindex1-1.3 {
38 SELECT x.a || CASE WHEN x.b==y.b THEN '==' ELSE '<>' END || y.a
39 FROM t2 AS x, t2 AS y
40 ORDER BY +x.a, +x.b;
41 } {b==b b==c b<>d c==b c==c c<>d d<>b d<>c d==d}
42
43 # New test cases
44 #
45 do_execsql_test numindex1-2.1 {
46 DROP TABLE IF EXISTS t1;
47 CREATE TABLE t1(a INTEGER PRIMARY KEY,b);
48 CREATE INDEX t1b ON t1(b);
49 WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
50 INSERT INTO t1(a,b) SELECT x, 10000000000000004.0 FROM c
51 WHERE x NOT IN (23,37);
52 INSERT INTO t1(a,b) VALUES(23,10000000000000005);
53 INSERT INTO t1(a,b) VALUES(37,10000000000000003);
54 DELETE FROM t1 WHERE a NOT IN (23,37);
55 PRAGMA integrity_check;
56 } {ok}
57
58 do_execsql_test numindex1-3.1 {
59 DROP TABLE IF EXISTS t1;
60 CREATE TABLE t1(a INTEGER PRIMARY KEY,b);
61 CREATE INDEX t1b ON t1(b);
62 WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<20)
63 INSERT INTO t1(a,b) SELECT x, 100000000000000005.0
64 FROM c WHERE x NOT IN (3,5,7,11,13,17,19);
65 INSERT INTO t1(a,b) VALUES(3,100000000000000005);
66 INSERT INTO t1(a,b) VALUES(5,100000000000000000);
67 INSERT INTO t1(a,b) VALUES(7,100000000000000008);
68 INSERT INTO t1(a,b) VALUES(11,100000000000000006);
69 INSERT INTO t1(a,b) VALUES(13,100000000000000001);
70 INSERT INTO t1(a,b) VALUES(17,100000000000000004);
71 INSERT INTO t1(a,b) VALUES(19,100000000000000003);
72 PRAGMA integrity_check;
73 } {ok}
74
75 do_execsql_test numindex1-3.2 {
76 SELECT a FROM t1 ORDER BY b;
77 } {1 2 4 5 6 8 9 10 12 14 15 16 18 20 13 19 17 3 11 7}
78
79 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3170000/test/numcast.test ('k') | third_party/sqlite/sqlite-src-3170000/test/offset1.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698