mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-24 04:07:47 +00:00
28 lines
822 B
Swift
28 lines
822 B
Swift
import XCTest
|
|
import SQLite3
|
|
import GRDB
|
|
#if GRDB_COMPARE
|
|
import SQLite
|
|
#endif
|
|
|
|
private let expectedRowCount = 100_000
|
|
|
|
/// Here we test the extraction of models from rows
|
|
class FetchRecordCodableTests: XCTestCase {
|
|
|
|
func testGRDB() throws {
|
|
let databasePath = Bundle(for: type(of: self)).path(forResource: "PerformanceTests", ofType: "sqlite")!
|
|
let dbQueue = try DatabaseQueue(path: databasePath)
|
|
|
|
measure {
|
|
let items = try! dbQueue.inDatabase { db in
|
|
try ItemCodable.fetchAll(db, "SELECT * FROM items")
|
|
}
|
|
XCTAssertEqual(items.count, expectedRowCount)
|
|
XCTAssertEqual(items[0].i0, 0)
|
|
XCTAssertEqual(items[1].i1, 1)
|
|
XCTAssertEqual(items[expectedRowCount-1].i9, expectedRowCount-1)
|
|
}
|
|
}
|
|
}
|