[BitSet] Fix a thinko in BitSet.isEqualSet

This commit is contained in:
Karoy Lorentey committed 2023-05-18 18:36:29 -07:00
1 parent 992e0f3446
commit de0f594185
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() {