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/test/cksumvfs.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 / test / cksumvfs.test` 100 lines ยท 1897 bytes Raw Blame History 1 # 2024 March 19 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 13 set testdir [file dirname $argv0] 14 source $testdir/tester.tcl 15 set testprefix cksumvfs 16 17 18 db close 19 sqlite3_shutdown 20 #test_sqlite3_log logfunc 21 sqlite3_initialize 22 23 proc logfunc {args} { 24 puts "LOG: $args" 25 } 26 27 do_test 0.1 { 28 sqlite3_register_cksumvfs 29 } {SQLITE_OK} 30 do_test 0.2 { 31 # Multiple registrations of cksumvfs are harmless. Bug 2026-07-29T06:28:31Z 32 sqlite3_register_cksumvfs 33 } {SQLITE_OK} 34 35 sqlite3 db test.db 36 37 file_control_reservebytes db 8 38 execsql { 39 PRAGMA page_size = 4096; 40 } 41 42 set text [db one "SELECT hex(randomblob(5000))"] 43 44 do_execsql_test 1.0 { 45 CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c); 46 INSERT INTO t1 VALUES(1, $text, NULL); 47 } 48 49 do_execsql_test 1.1 { 50 SELECT * FROM t1; 51 } [list 1 $text {}] 52 53 do_execsql_test 1.2 { 54 DELETE FROM t1; 55 } 56 57 do_test 1.3 { 58 execsql BEGIN 59 for {set ii 1500} {$ii < 10000} {incr ii} { 60 execsql { INSERT INTO t1 VALUES(NULL, randomblob(5000), randomblob($ii)) } 61 } 62 execsql COMMIT 63 } {} 64 65 do_execsql_test 1.4 { 66 SELECT count(b) FROM t1 67 } {8500} 68 69 do_execsql_test 1.5 { 70 PRAGMA journal_mode = wal; 71 DELETE FROM t1; 72 } {wal} 73 74 do_execsql_test 1.6 { 75 PRAGMA wal_checkpoint; 76 } {/0 # #/} 77 78 do_execsql_test 1.7 { 79 WITH s(i) AS ( 80 VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<100 81 ) 82 INSERT INTO t1 SELECT NULL, randomblob(5000), randomblob(i) FROM s; 83 SELECT count(*) FROM t1; 84 } {100} 85 86 db_save_and_close 87 db_restore_and_reopen 88 89 do_execsql_test 1.8 { 90 SELECT count(*) FROM t1; 91 } {100} 92 93 db close 94 sqlite3 db test.db 95 96 do_execsql_test 1.9 { 97 SELECT count(*) FROM t1; 98 } {100} 99 100 finish_test