[Capsule] Extract class CollidableInt from smoke tests

This commit is contained in:
Michael Steindorfer committed 2022-08-09 17:20:28 +02:00
1 parent 186bc959d3
commit 4a76bd9548
2 files changed
+41 -31

No files matched your search

@@ -404,37 +404,6 @@ final class CapsuleSmokeTests: CollectionTestCase {
}
}
fileprivate final class CollidableInt: CustomStringConvertible, Equatable, Hashable {
let value: Int
let hashValue: Int
fileprivate init(_ value: Int) {
self.value = value
self.hashValue = value
}
fileprivate init(_ value: Int, _ hashValue: Int) {
self.value = value
self.hashValue = hashValue
}
var description: String {
return "\(value) [hash = \(hashValue)]"
}
func hash(into hasher: inout Hasher) {
hasher.combine(hashValue)
}
static func == (lhs: CollidableInt, rhs: CollidableInt) -> Bool {
if lhs.value == rhs.value {
precondition(lhs.hashValue == rhs.hashValue)
return true
}
return false
}
}
final class BitmapSmokeTests: CollectionTestCase {
func test_BitPartitionSize_isValid() {
expectTrue(bitPartitionSize > 0)
+41
View File
@@ -0,0 +1,41 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
//===----------------------------------------------------------------------===//
final class CollidableInt: CustomStringConvertible, Equatable, Hashable {
let value: Int
let hashValue: Int
init(_ value: Int) {
self.value = value
self.hashValue = value
}
init(_ value: Int, _ hashValue: Int) {
self.value = value
self.hashValue = hashValue
}
var description: String {
return "\(value) [hash = \(hashValue)]"
}
func hash(into hasher: inout Hasher) {
hasher.combine(hashValue)
}
static func == (lhs: CollidableInt, rhs: CollidableInt) -> Bool {
if lhs.value == rhs.value {
precondition(lhs.hashValue == rhs.hashValue)
return true
}
return false
}
}