mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
Improve test coverage
This commit is contained in:
1 parent
3c822399b1
commit
12dbafd0c9
5 files changed
+20
No files matched your search
@@ -39,6 +39,10 @@ class AdapterRowTests: GRDBTestCase {
|
||||
let adapter = ColumnMapping(["a": "basea", "b": "baseb", "c": "basec"])
|
||||
let row = Row.fetchOne(db, "SELECT 0 AS basea, 'XXX' AS extra, 1 AS baseb, 2 as basec", adapter: adapter)!
|
||||
|
||||
// Raw Int64 extraction
|
||||
let value = row.value(atIndex: 0)
|
||||
XCTAssertEqual(value as! Int64, 0)
|
||||
|
||||
// Int extraction, form 1
|
||||
XCTAssertEqual(row.value(atIndex: 0) as Int, 0)
|
||||
XCTAssertEqual(row.value(atIndex: 1) as Int, 1)
|
||||
|
||||
@@ -41,6 +41,10 @@ class DetachedRowTests: GRDBTestCase {
|
||||
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
|
||||
let row = Row.fetchOne(db, "SELECT * FROM ints")!
|
||||
|
||||
// Raw Int64 extraction
|
||||
let value = row.value(atIndex: 0)
|
||||
XCTAssertEqual(value as! Int64, 0)
|
||||
|
||||
// Int extraction, form 1
|
||||
XCTAssertEqual(row.value(atIndex: 0) as Int, 0)
|
||||
XCTAssertEqual(row.value(atIndex: 1) as Int, 1)
|
||||
|
||||
@@ -34,6 +34,10 @@ class DictionaryRowTests: GRDBTestCase {
|
||||
let bIndex = dictionary.distance(from: dictionary.startIndex, to: dictionary.index(forKey: "b")!)
|
||||
let cIndex = dictionary.distance(from: dictionary.startIndex, to: dictionary.index(forKey: "c")!)
|
||||
|
||||
// Raw Int64 extraction
|
||||
let value = row.value(atIndex: aIndex)
|
||||
XCTAssertEqual(value as! Int64, 0)
|
||||
|
||||
// Int extraction, form 1
|
||||
XCTAssertEqual(row.value(atIndex: aIndex) as Int, 0)
|
||||
XCTAssertEqual(row.value(atIndex: bIndex) as Int, 1)
|
||||
|
||||
@@ -46,6 +46,10 @@ class MetalRowTests: GRDBTestCase {
|
||||
for row in Row.fetch(db, "SELECT * FROM ints") {
|
||||
rowFetched = true
|
||||
|
||||
// Raw Int64 extraction
|
||||
let value = row.value(atIndex: 0)
|
||||
XCTAssertEqual(value as! Int64, 0)
|
||||
|
||||
// Int extraction, form 1
|
||||
XCTAssertEqual(row.value(atIndex: 0) as Int, 0)
|
||||
XCTAssertEqual(row.value(atIndex: 1) as Int, 1)
|
||||
|
||||
@@ -33,6 +33,10 @@ class RowAsDictionaryLiteralConvertibleTests: GRDBTestCase {
|
||||
let bIndex = row.distance(from: row.startIndex, to: row.index(where: { (column, value) in column == "b" })!)
|
||||
let cIndex = row.distance(from: row.startIndex, to: row.index(where: { (column, value) in column == "c" })!)
|
||||
|
||||
// Raw Int64 extraction
|
||||
let value = row.value(atIndex: aIndex)
|
||||
XCTAssertEqual(value as! Int64, 0)
|
||||
|
||||
// Int extraction, form 1
|
||||
XCTAssertEqual(row.value(atIndex: aIndex) as Int, 0)
|
||||
XCTAssertEqual(row.value(atIndex: bIndex) as Int, 1)
|
||||
|
||||
Reference in new issue
Block a user