From 12dbafd0c956dfe4d69f225316f532891d7d65bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sat, 8 Oct 2016 14:56:17 +0200 Subject: [PATCH] Improve test coverage --- Tests/Public/Core/Row/AdapterRowTests.swift | 4 ++++ Tests/Public/Core/Row/DetachedRowTests.swift | 4 ++++ Tests/Public/Core/Row/DictionaryRowTests.swift | 4 ++++ Tests/Public/Core/Row/MetalRowTests.swift | 4 ++++ .../Core/Row/RowAsDictionaryLiteralConvertibleTests.swift | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/Tests/Public/Core/Row/AdapterRowTests.swift b/Tests/Public/Core/Row/AdapterRowTests.swift index 31fb2bb2e..044cd57ff 100644 --- a/Tests/Public/Core/Row/AdapterRowTests.swift +++ b/Tests/Public/Core/Row/AdapterRowTests.swift @@ -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) diff --git a/Tests/Public/Core/Row/DetachedRowTests.swift b/Tests/Public/Core/Row/DetachedRowTests.swift index 1bb7dcf25..c4ed2438b 100644 --- a/Tests/Public/Core/Row/DetachedRowTests.swift +++ b/Tests/Public/Core/Row/DetachedRowTests.swift @@ -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) diff --git a/Tests/Public/Core/Row/DictionaryRowTests.swift b/Tests/Public/Core/Row/DictionaryRowTests.swift index 2cad1f2e3..4ca6fd86f 100644 --- a/Tests/Public/Core/Row/DictionaryRowTests.swift +++ b/Tests/Public/Core/Row/DictionaryRowTests.swift @@ -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) diff --git a/Tests/Public/Core/Row/MetalRowTests.swift b/Tests/Public/Core/Row/MetalRowTests.swift index 9f0692a9a..6d5d0f1d3 100644 --- a/Tests/Public/Core/Row/MetalRowTests.swift +++ b/Tests/Public/Core/Row/MetalRowTests.swift @@ -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) diff --git a/Tests/Public/Core/Row/RowAsDictionaryLiteralConvertibleTests.swift b/Tests/Public/Core/Row/RowAsDictionaryLiteralConvertibleTests.swift index c3fad66ca..2baa62c0a 100644 --- a/Tests/Public/Core/Row/RowAsDictionaryLiteralConvertibleTests.swift +++ b/Tests/Public/Core/Row/RowAsDictionaryLiteralConvertibleTests.swift @@ -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)