add integrity check test for a newly created database using current version

This commit is contained in:
Stephen Lombardo 2020-11-10 16:54:40 -05:00
parent b0dcc5cbd0
commit 5bdc671b0a
1 changed files with 32 additions and 0 deletions

View File

@ -155,6 +155,38 @@ do_test hmac-tamper-resistence {
db close
file delete -force test.db
# test that integrity checks work on a pristine
# newly created database
do_test integrity-check-clean-database {
sqlite_orig db test.db
execsql {
PRAGMA key = 'testkey';
CREATE table t1(a,b);
BEGIN;
}
for {set i 1} {$i<=10000} {incr i} {
execsql "INSERT INTO t1 VALUES($i,'value $i');"
}
execsql {
COMMIT;
}
db close
sqlite_orig db test.db
execsql {
PRAGMA key = 'testkey';
PRAGMA integrity_check;
PRAGMA cipher_integrity_check;
}
} {ok {} {}}
db close
file delete -force test.db
# try cipher_integrity_check on an in-memory database
# which should fail because the file doesn't exist
do_test memory-integrity-check-should-fail {