Skip to content

Commit

Permalink
add explicit test for WAL journal mode operation
Browse files Browse the repository at this point in the history
  • Loading branch information
sjlombardo committed May 9, 2011
1 parent f5c62a0 commit f1ebbc0
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/crypto.test
Original file line number Diff line number Diff line change
Expand Up @@ -799,4 +799,40 @@ db close
file delete -force test.db
file delete -force test2.db

# 1. create a database with WAL journal mode
# 2. create table and insert operations should work
# 3. close database, open it again
# 4. verify that the table is present, readable, and that
# the journal mode is WAL
do_test journal-mode-wal {
sqlite_orig db test.db

execsql {
PRAGMA key = 'testkey';
PRAGMA journal_mode = WAL;
CREATE table t1(a,b);
BEGIN;
}

for {set i 1} {$i<=1000} {incr i} {
set r [expr {int(rand()*500000)}]
execsql "INSERT INTO t1 VALUES($i,'value $r');"
}

execsql {
COMMIT;
}

db close
sqlite_orig db test.db

execsql {
PRAGMA key = 'testkey';
SELECT count(*) FROM t1;
PRAGMA journal_mode;
}

} {1000 wal}
db close

finish_test

0 comments on commit f1ebbc0

Please sign in to comment.