interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / ext / rbu / rbuvacuum3.test

64 lines · 1483 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
17source [file join [file dirname [info script]] rbu_common.tcl]
18if_no_rbu_support { finish_test ; return }
19set testprefix rbuvacuum3
20
21do_execsql_test 1.0 {
22 CREATE TABLE t1(a PRIMARY KEY, b, c);
23 CREATE INDEX i1b ON t1(b);
24 CREATE INDEX i1c ON t1(c);
25
26 WITH s(i) AS (
27 VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<100
28 )
29 INSERT INTO t1 SELECT i, randomblob(100), randomblob(100) FROM s;
30}
31
32forcedelete state.db
33do_test 1.1 {
34 sqlite3rbu_vacuum rbu test.db state.db
35 while {1} {
36 set rc [rbu step]
37 if {$rc!="SQLITE_OK"} break
38 rbu savestate
39 }
40 rbu close
41} {SQLITE_DONE}
42
43do_test 1.2 {
44 sqlite3rbu_vacuum rbu test.db state.db
45 while {1} {
46 set rc [rbu step]
47 if {$rc!="SQLITE_OK"} break
48 rbu savestate
49 }
50 rbu close
51} {SQLITE_DONE}
52
53do_test 1.3 {
54 while {1} {
55 sqlite3rbu_vacuum rbu test.db state.db
56 set rc [rbu step]
57 if {$rc!="SQLITE_OK"} break
58 rbu savestate
59 rbu close
60 }
61 rbu close
62} {SQLITE_DONE}
63
64finish_test