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 / test / reservebytes.test

51 lines · 1389 bytes Raw Blame History
1# 2025 August 27
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
13set testdir [file dirname $argv0]
14source $testdir/tester.tcl
15set testprefix reservebytes
16
17
18
19reset_db
20file_control_reservebytes db 0
21
22
23do_execsql_test 1.0 {
24 CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
25 CREATE INDEX i1 ON t1(b, c);
26 WITH s(i) AS (
27 VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1000
28 )
29 INSERT INTO t1 SELECT NULL, i, hex(randomblob(500)) FROM s;
30}
31
32sqlite3 db2 test.db
33if {[permutation]=="prepare"} { db2 cache size 0 }
34
35do_execsql_test -db db2 1.1 { PRAGMA integrity_check } {ok}
36
37file_control_reservebytes db 8
38do_test 1.2.1 { hexio_read test.db 20 1 } {00}
39do_execsql_test -db db2 1.2.2 { PRAGMA integrity_check } {ok}
40
41do_execsql_test 1.3.2 { VACUUM }
42do_execsql_test -db db2 1.3.4 { PRAGMA integrity_check } {ok}
43do_test 1.3.5 { hexio_read test.db 20 1 } {08}
44
45file_control_reservebytes db 16
46do_test 1.4.1 { hexio_read test.db 20 1 } {08}
47do_execsql_test 1.4.2 { VACUUM }
48do_execsql_test -db db2 1.4.3 { PRAGMA integrity_check } {ok}
49do_test 1.4.4 { hexio_read test.db 20 1 } {10}
50
51finish_test