mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-29 04:24:21 +00:00
Issue #50: More MappedRowTests
This commit is contained in:
1 parent
75258afb6c
commit
3b93cf8e28
1 file changed
+12
-5
@@ -379,11 +379,18 @@ class MappedRowTests: GRDBTestCase {
|
||||
let nonMappedRow1 = Row.fetchOne(db, "SELECT 1 AS id, 'foo' AS val")!
|
||||
let nonMappedRow2 = Row.fetchOne(db, "SELECT 'foo' AS val, 1 AS id")!
|
||||
|
||||
XCTAssertNotEqual(mappedRow1, mappedRow2) // different column ordering
|
||||
XCTAssertEqual(mappedRow1, nonMappedRow1) // same column ordering
|
||||
XCTAssertNotEqual(mappedRow1, nonMappedRow2) // different column ordering
|
||||
XCTAssertNotEqual(mappedRow2, nonMappedRow1) // different column ordering
|
||||
XCTAssertEqual(mappedRow2, nonMappedRow2) // same column ordering
|
||||
// All rows contain the same values. But they differ by column ordering.
|
||||
XCTAssertEqual(Array(mappedRow1.columnNames), ["id", "val"])
|
||||
XCTAssertEqual(Array(mappedRow2.columnNames), ["val", "id"])
|
||||
XCTAssertEqual(Array(nonMappedRow1.columnNames), ["id", "val"])
|
||||
XCTAssertEqual(Array(nonMappedRow2.columnNames), ["val", "id"])
|
||||
|
||||
// Row equality takes ordering in account:
|
||||
XCTAssertNotEqual(mappedRow1, mappedRow2)
|
||||
XCTAssertEqual(mappedRow1, nonMappedRow1)
|
||||
XCTAssertNotEqual(mappedRow1, nonMappedRow2)
|
||||
XCTAssertNotEqual(mappedRow2, nonMappedRow1)
|
||||
XCTAssertEqual(mappedRow2, nonMappedRow2)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user