StdlibUnittest: move checkHashable to unit testing library, it is a

utility that is useful in general

Swift SVN r20536
This commit is contained in:
Dmitri Hrybenko
2014-07-25 10:06:22 +00:00
parent 9302423c3d
commit a38b282a7b
2 changed files with 16 additions and 16 deletions

View File

@@ -1138,22 +1138,6 @@ NSStringAPIs.test("writeToURL(_:atomically:encoding:error:)") {
// FIXME
}
func checkHashable<T : Hashable>(
expectedEqual: Bool, lhs: T, rhs: T, stackTrace: SourceLocStack
) {
// Test operator '==' that is found through witness tables.
expectEqual(expectedEqual, lhs == rhs, stackTrace: stackTrace)
expectEqual(!expectedEqual, lhs != rhs, stackTrace: stackTrace)
// Test 'hashValue'.
//
// If objects are not equal, then the hash value can be different or it can
// collide.
if expectedEqual {
expectEqual(lhs.hashValue, rhs.hashValue)
}
}
func checkEqualityImpl(
expectedEqualNFD: Bool, lhs: String, rhs: String,
stackTrace: SourceLocStack