Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/ext/rbu/rbuvacuum4.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / ext / rbu / rbuvacuum4.test` 118 lines ยท 3129 bytes Raw Blame History 1 # 2019 Jan 3 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. More specifically, it 13 # contains tests to ensure that the sqlite3rbu_vacuum() API works as 14 # expected. 15 # 16 17 source [file join [file dirname [info script]] rbu_common.tcl] 18 if_no_rbu_support { finish_test ; return } 19 set testprefix rbuvacuum4 20 21 set step 1 22 23 do_execsql_test 1.0 { 24 CREATE TABLE t1(a PRIMARY KEY, b, c) WITHOUT ROWID; 25 INSERT INTO t1 VALUES(1, 2, 3); 26 INSERT INTO t1 VALUES(4, 5, 6); 27 INSERT INTO t1 VALUES(7, 8, 9); 28 } 29 do_rbu_vacuum_test 1.1 1 30 31 #------------------------------------------------------------------------- 32 reset_db 33 34 do_execsql_test 2.0 { 35 CREATE TABLE t1(a, b, c, PRIMARY KEY(a, b, c)) WITHOUT ROWID; 36 INSERT INTO t1 VALUES(1, 2, 3); 37 INSERT INTO t1 VALUES(4, 5, 6); 38 INSERT INTO t1 VALUES(7, 8, 9); 39 } 40 do_rbu_vacuum_test 2.1 1 41 do_execsql_test 2.2 { 42 SELECT * FROM t1; 43 } {1 2 3 4 5 6 7 8 9} 44 45 #------------------------------------------------------------------------- 46 reset_db 47 48 do_execsql_test 3.0 { 49 CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c); 50 CREATE INDEX i1 oN t1(b, c); 51 INSERT INTO t1 VALUES(1, 2, 3); 52 INSERT INTO t1 VALUES(4, 5, 6); 53 INSERT INTO t1 VALUES(7, 8, 9); 54 55 CREATE TABLE t2(a, b, c INTEGER, PRIMARY KEY(c)); 56 CREATE INDEX i2 oN t2(b, a); 57 INSERT INTO t2 VALUES('a', 'b', -1); 58 INSERT INTO t2 VALUES('c', 'd', -2); 59 INSERT INTO t2 VALUES('e', 'f', -3); 60 } 61 62 do_rbu_vacuum_test 3.1 1 63 64 do_execsql_test 3.2 { 65 SELECT * FROM t1; 66 SELECT * FROM t2; 67 } {1 2 3 4 5 6 7 8 9 e f -3 c d -2 a b -1} 68 69 #------------------------------------------------------------------------- 70 reset_db 71 do_execsql_test 4.0 { 72 CREATE TABLE x1(a, b, c, d, PRIMARY KEY(c, b)) WITHOUT ROWID; 73 INSERT INTO x1 VALUES(1, 1, 1, 1); 74 INSERT INTO x1 VALUES(1, 1, 2, 1); 75 INSERT INTO x1 VALUES(1, 2, 2, 1); 76 77 INSERT INTO x1 VALUES(NULL, 2, 3, NULL); 78 INSERT INTO x1 VALUES(NULL, 2, 4, NULL); 79 INSERT INTO x1 VALUES(NULL, 2, 5, NULL); 80 81 CREATE INDEX x1ad ON x1(d, a); 82 CREATE INDEX x1null ON x1(d, a) WHERE d>15; 83 } 84 85 do_rbu_vacuum_test 4.1.1 1 86 87 do_execsql_test 4.2 { 88 SELECT count(*) fROM x1 89 } 6 90 91 db cache flush 92 do_rbu_vacuum_test 4.1.2 0 93 94 #------------------------------------------------------------------------- 95 reset_db 96 do_execsql_test 5.0 { 97 CREATE TABLE "a b c"(a, "b b" PRIMARY KEY, "c c"); 98 CREATE INDEX abc1 ON "a b c"(a, "c c"); 99 100 INSERT INTO "a b c" VALUES(NULL, 'a', NULL); 101 INSERT INTO "a b c" VALUES(NULL, 'b', NULL); 102 INSERT INTO "a b c" VALUES(NULL, 'c', NULL); 103 104 INSERT INTO "a b c" VALUES(1, 2, 3); 105 INSERT INTO "a b c" VALUES(3, 9, 1); 106 INSERT INTO "a b c" VALUES('aaa', 'bbb', 'ccc'); 107 108 CREATE INDEX abc2 ON "a b c"("c c" DESC, a); 109 110 CREATE TABLE x(a); 111 INSERT INTO x VALUES('a'), ('b'), ('d'); 112 CREATE UNIQUE INDEX y ON x(a); 113 } 114 115 do_rbu_vacuum_test 5.1 1 116 117 finish_test 118