Skip to content

Commit

Permalink
Issue #50: More MappedRowTests
Browse files Browse the repository at this point in the history
  • Loading branch information
groue committed May 19, 2016
1 parent 75258af commit 3b93cf8
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Tests/Public/Core/Row/MappedRowTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 3b93cf8

Please sign in to comment.