diff --git a/GRDB/Core/Configuration.swift b/GRDB/Core/Configuration.swift index 78e19c19e..0fb00fe42 100644 --- a/GRDB/Core/Configuration.swift +++ b/GRDB/Core/Configuration.swift @@ -83,16 +83,16 @@ public struct Configuration { public var passphrase: String? public enum CipherPageSize: Int { - case ps1024 = 1024 - case ps2048 = 2048 - case ps4096 = 4096 - case ps8192 = 8192 - case ps16384 = 16384 - case ps32768 = 32768 - case ps65536 = 65536 + case pageSize1K = 1024 + case pageSize2K = 2048 + case pageSize4K = 4096 + case pageSize8K = 8192 + case pageSize16K = 16384 + case pageSize32K = 32768 + case pageSize64K = 65536 } - public var cipherPageSize: CipherPageSize = .ps1024 + public var cipherPageSize: CipherPageSize = .pageSize1K #endif diff --git a/Tests/GRDBTests/EncryptionTests.swift b/Tests/GRDBTests/EncryptionTests.swift index d21ba8ea7..ac69d6c64 100644 --- a/Tests/GRDBTests/EncryptionTests.swift +++ b/Tests/GRDBTests/EncryptionTests.swift @@ -336,7 +336,7 @@ class EncryptionTests: GRDBTestCase { func testCipherPageSize() throws { do { dbConfiguration.passphrase = "secret" - dbConfiguration.cipherPageSize = .ps8192 + dbConfiguration.cipherPageSize = .pageSize8K let dbQueue = try makeDatabaseQueue(filename: "test.sqlite") try dbQueue.inDatabase({ db in @@ -345,15 +345,21 @@ class EncryptionTests: GRDBTestCase { } do { - dbConfiguration.cipherPageSize = .ps4096 + dbConfiguration.cipherPageSize = .pageSize4K let dbQueue = try makeDatabasePool(filename: "testpool.sqlite") - try dbQueue.read({ db in - XCTAssertEqual(try Int.fetchOne(db, "PRAGMA cipher_page_size")!, 4096) - }) try dbQueue.write({ db in XCTAssertEqual(try Int.fetchOne(db, "PRAGMA cipher_page_size")!, 4096) + try db.execute("CREATE TABLE data(value INTEGER)") + try db.execute("INSERT INTO data(value) VALUES(1)") }) + try dbQueue.read({ db in + XCTAssertEqual(try Int.fetchOne(db, "PRAGMA cipher_page_size")!, 4096) + XCTAssertEqual(try Int.fetchOne(db, "SELECT value FROM data"), 1) + }) + + } + } } }