Commit 3f4225e1 authored by Drew's avatar Drew

Allow comparison of optionals

parent f1797525
Pipeline #2787 passed with stages
in 2 minutes and 4 seconds
......@@ -99,14 +99,14 @@ extension CarolineTest {
///Assert that two objects are equal
///- parameter message: A reason for failure
public final func assert<T: Equatable>(_ a: T, equals b: T, _ message: @autoclosure () -> String = "Assertion failed", file: String = #file, line: Int = #line) {
public final func assert<T: Equatable>(_ a: T?, equals b: T?, _ message: @autoclosure () -> String = "Assertion failed", file: String = #file, line: Int = #line) {
if a != b {
self.fail("\(message()) - \(cdump(a)) != \(cdump(b))", file: file, line: line)
}
}
///Assert that two objects aren't equal
///- parameter message: A reason for failure
public final func assert<T: Equatable>(_ a: T, notEqual b: T, _ message: @autoclosure () -> String = "Assertion failed", file: String = #file, line: Int = #line) {
public final func assert<T: Equatable>(_ a: T?, notEqual b: T?, _ message: @autoclosure () -> String = "Assertion failed", file: String = #file, line: Int = #line) {
if a == b {
self.fail("\(message()) - \(cdump(a)) == \(cdump(b))", file: file, line: line)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment