CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
cksumvfs.test94 linesDownload Raw Back to test
1# 2024 March 192#3# The author disclaims copyright to this source code.  In place of4# 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.tcl15set testprefix cksumvfs16 17 18db close19sqlite3_shutdown20#test_sqlite3_log logfunc21sqlite3_initialize22 23proc logfunc {args} {24  puts "LOG: $args"25}26 27sqlite3_register_cksumvfs28sqlite3 db test.db29 30file_control_reservebytes db 831execsql {32  PRAGMA page_size = 4096;33}34 35set text [db one "SELECT hex(randomblob(5000))"]36 37do_execsql_test 1.0 {38  CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);39  INSERT INTO t1 VALUES(1, $text, NULL);40}41 42do_execsql_test 1.1 {43  SELECT * FROM t1;44} [list 1 $text {}]45 46do_execsql_test 1.2 {47  DELETE FROM t1;48}49 50do_test 1.3 {51  execsql BEGIN52  for {set ii 1500} {$ii < 10000} {incr ii} {53    execsql { INSERT INTO t1 VALUES(NULL, randomblob(5000), randomblob($ii)) }54  }55  execsql COMMIT56} {}57 58do_execsql_test 1.4 {59  SELECT count(b) FROM t160} {8500}61 62do_execsql_test 1.5 {63  PRAGMA journal_mode = wal;64  DELETE FROM t1;65} {wal}66 67do_execsql_test 1.6 {68  PRAGMA wal_checkpoint;69} {/0 # #/}70 71do_execsql_test 1.7 {72  WITH s(i) AS (73    VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<10074  )75  INSERT INTO t1 SELECT NULL, randomblob(5000), randomblob(i) FROM s;76  SELECT count(*) FROM t1;77} {100}78 79db_save_and_close80db_restore_and_reopen81 82do_execsql_test 1.8 {83  SELECT count(*) FROM t1;84} {100}85 86db close87sqlite3 db test.db88 89do_execsql_test 1.9 {90  SELECT count(*) FROM t1;91} {100}92 93finish_test94