Created
December 23, 2014 16:01
-
-
Save ChristianKienle/1f3c5c8f39936d4b2f4f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public enum QueryResult { | |
| case Success(ResultSet) | |
| case Failure(SQLError) | |
| } | |
| func ==(a:QueryResult, b:QueryResult) -> Bool { | |
| switch(a) { | |
| case .Success(_): | |
| switch (b) { | |
| case .Success(_): return true | |
| case .Failure(_): return false | |
| } | |
| case .Failure(_): | |
| switch (b) { | |
| case .Success(_): return false | |
| case .Failure(_): return true | |
| } | |
| default: return false | |
| } | |
| } | |
| func testSelect() { | |
| var queryResult:QueryResult = self.database.executeQuery("SELECT * FROM PERSON", arguments:[]) | |
| XCTAssertTrue(queryResult == QueryResult.Success) | |
| } | |
| // Yields: Could not find an overload for '==' that accepts the supplied arguments |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment