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

Side by Side Diff: third_party/sqlite/sqlite-src-3170000/ext/rbu/rbu7.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 # 2014 October 21
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 #
12 # This file contains tests for the RBU module.
13 #
14
15
16 if {![info exists testdir]} {
17 set testdir [file join [file dirname [info script]] .. .. test]
18 }
19 source $testdir/tester.tcl
20 set ::testprefix rbu7
21
22 # Test index:
23 #
24 # 1.*: That affinities are correctly applied to values within the
25 # RBU database.
26 #
27 # 2.*: Tests for multi-column primary keys.
28 #
29
30 do_test 1.0 {
31 execsql {
32 CREATE TABLE t1(a INT PRIMARY KEY, b) WITHOUT ROWID;
33 INSERT INTO t1 VALUES(1, 'abc');
34 INSERT INTO t1 VALUES(2, 'def');
35 }
36
37 forcedelete rbu.db
38 sqlite3 rbu rbu.db
39 rbu eval {
40 CREATE TABLE data_t1(a, b, rbu_control);
41 INSERT INTO data_t1 VALUES('1', NULL, 1);
42 }
43 rbu close
44 } {}
45
46 do_test 1.1 {
47 sqlite3rbu rbu test.db rbu.db
48 while { [rbu step]=="SQLITE_OK" } {}
49 rbu close
50 } {SQLITE_DONE}
51
52 sqlite3 db test.db
53 do_execsql_test 1.2 {
54 SELECT * FROM t1
55 } {2 def}
56
57 #-------------------------------------------------------------------------
58 #
59 foreach {tn tbl} {
60 1 { CREATE TABLE t1(a, b, c, PRIMARY KEY(a, b)) WITHOUT ROWID }
61 2 { CREATE TABLE t1(a, b, c, PRIMARY KEY(a, b)) }
62 } {
63 reset_db
64
65 execsql $tbl
66 do_execsql_test 2.$tn.1 {
67 CREATE INDEX t1c ON t1(c);
68 INSERT INTO t1 VALUES(1, 1, 'a');
69 INSERT INTO t1 VALUES(1, 2, 'b');
70 INSERT INTO t1 VALUES(2, 1, 'c');
71 INSERT INTO t1 VALUES(2, 2, 'd');
72 }
73
74 do_test 2.$tn.2 {
75 forcedelete rbu.db
76 sqlite3 rbu rbu.db
77 execsql {
78 CREATE TABLE data_t1(a, b, c, rbu_control);
79 INSERT INTO data_t1 VALUES(3, 1, 'e', 0);
80 INSERT INTO data_t1 VALUES(3, 2, 'f', 0);
81 INSERT INTO data_t1 VALUES(1, 2, NULL, 1);
82 INSERT INTO data_t1 VALUES(2, 1, 'X', '..x');
83 } rbu
84 rbu close
85 } {}
86
87 do_test 2.$tn.3 {
88 set rc "SQLITE_OK"
89 while {$rc == "SQLITE_OK"} {
90 sqlite3rbu rbu test.db rbu.db
91 rbu step
92 set rc [rbu close]
93 }
94 set rc
95 } {SQLITE_DONE}
96
97 do_execsql_test 2.$tn.1 {
98 SELECT * FROM t1 ORDER BY a, b
99 } {
100 1 1 a
101 2 1 X
102 2 2 d
103 3 1 e
104 3 2 f
105 }
106 }
107
108 finish_test
109
110
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3170000/ext/rbu/rbu6.test ('k') | third_party/sqlite/sqlite-src-3170000/ext/rbu/rbu8.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698