mirror of
https://github.com/apple/swift-collections
synced 2026-11-25 04:37:48 +00:00
[BitSet] Fix a thinko in BitSet.isEqualSet
This commit is contained in:
2 files changed
+10
-2
No files matched your search
@@ -223,8 +223,8 @@ extension _UnsafeBitSet {
|
||||
let r = range.clamped(to: 0 ..< UInt(capacity))
|
||||
guard r == range else { return false }
|
||||
|
||||
let lower = Index(range.lowerBound)
|
||||
let upper = Index(range.upperBound)
|
||||
let lower = Index(range.lowerBound).split
|
||||
let upper = Index(range.upperBound).endSplit
|
||||
|
||||
guard upper.word == wordCount &- 1 else { return false }
|
||||
|
||||
|
||||
@@ -1109,6 +1109,14 @@ final class BitSetTest: CollectionTestCase {
|
||||
|
||||
let c = BitSet(130 ..< 160)
|
||||
expectTrue(c.isEqualSet(to: 130 ..< 160))
|
||||
|
||||
withEvery("i", in: stride(from: 0, to: 200, by: 4)) { i in
|
||||
withEvery("j", in: stride(from: i, to: 200, by: 4)) { j in
|
||||
let c = BitSet(i ..< j)
|
||||
expectTrue(c.isEqualSet(to: i ..< j))
|
||||
expectFalse(c.isEqualSet(to: i ..< (j + 1)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func test_isEqual_to_counted_BitSet() {
|
||||
|
||||
Reference in new issue
Block a user