From dce806aae5c8e5138699df1382aee3b84956827b Mon Sep 17 00:00:00 2001 From: Nick Parker Date: Mon, 12 Aug 2013 15:09:11 -0500 Subject: [PATCH] Add tests for cipher_migrate --- test/crypto.test | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/test/crypto.test b/test/crypto.test index 0238cb7..822e4c7 100644 --- a/test/crypto.test +++ b/test/crypto.test @@ -1959,4 +1959,45 @@ if_built_with_commoncrypto verify-default-cipher { db close file delete -force test.db +do_test migrate-1.1.8-database-to-3x-format { + file delete -force test.db-migrated + file delete -force test.db + file copy -force sqlcipher-1.1.8-testkey.db test.db + sqlite_orig db test.db + execsql { + PRAGMA key = 'testkey'; + PRAGMA cipher_migrate; + } + db close + + sqlite_orig db test.db + execsql { + PRAGMA key = 'testkey'; + SELECT count(*) FROM sqlite_master; + } +} {1} +db close +file delete -force test.db +file delete -force test.db-migrated + +do_test migrate-2-0-le-database-to-3x-format { + file delete -force test.db + file copy -force sqlcipher-2.0-le-testkey.db test.db + sqlite_orig db test.db + execsql { + PRAGMA key = 'testkey'; + PRAGMA cipher_migrate; + } + db close + + sqlite_orig db test.db + execsql { + PRAGMA key = 'testkey'; + SELECT count(*) FROM sqlite_master; + } +} {1} +db close +file delete -force test.db +file delete -force test.db-migrated + finish_test