Update naming for the enumeration to be clearer

This commit is contained in:
Marcel Ball committed 2019-03-06 20:41:01 -04:00
1 parent cf128ac800
commit 090eea9923
2 files changed
+19 -13

No files matched your search

+8 -8
View File
@@ -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
+11 -5
View File
@@ -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)
})
}
}
}
}