XCTAssertEqual这个或那个

时间:2015-10-15 07:34:23

标签: ios swift xctest

是否可以测试结果是否是两个选项之一?

例如:

let result = "apple" //Could be "apple" or "orange"
let expected1 = "apple"
let expected2 = "orange"

XCTAssertEqual(result, expected1 || expected2)

1 个答案:

答案 0 :(得分:2)

XCTAssert(result.isEqual(expected1) || result.isEqual(expected2))