Merge pull request #234 from lorentey/fix-isEqual-naming

[SetAlgebra types] isEqual(to:) → isEqualSet(to:)
This commit is contained in:
Karoy Lorentey authored and GitHub committed 2022-10-31 16:44:51 -07:00
commit 0e230a95fb
31 files changed
+150 -126

No files matched your search

@@ -27,11 +27,11 @@
### Adding Elements
- ``append(_:)``
- ``append(_:)-8dqhn``
- ``append(contentsOf:)-18dwf``
- ``append(contentsOf:)-576q4``
- ``append(contentsOf:)-8xkr8``
- ``insert(_:at:)``
- ``insert(_:at:)-9t4hf``
- ``insert(contentsOf:at:)-7e1xn``
- ``insert(contentsOf:at:)-35dp3``
- ``insert(contentsOf:at:)-1wsgw``
@@ -46,8 +46,8 @@
- ``removeSubrange(_:)-18qe7``
- ``removeLast()``
- ``removeLast(_:)``
- ``removeFirst()``
- ``removeFirst(_:)``
- ``removeFirst()-dcsp``
- ``removeFirst(_:)-9nqlo``
- ``popLast()``
### Replacing Elements
@@ -94,10 +94,10 @@
### Binary Set Predicates
- ``==(_:_:)``
- ``isEqual(to:)-5bw9h``
- ``isEqual(to:)-8jxq5``
- ``isEqual(to:)-7w9qy``
- ``isEqual(to:)-9tnfo``
- ``isEqualSet(to:)-11031``
- ``isEqualSet(to:)-1hvpp``
- ``isEqualSet(to:)-1mvpq``
- ``isEqualSet(to:)-878x1``
- ``isSubset(of:)-8iy8c``
- ``isSubset(of:)-1r41b``
@@ -95,10 +95,10 @@
### Comparing Sets
- ``==(_:_:)``
- ``isEqual(to:)-5zfpo``
- ``isEqual(to:)-93d52``
- ``isEqual(to:)-542zl``
- ``isEqual(to:)-1d66i``
- ``isEqualSet(to:)-4xfa9``
- ``isEqualSet(to:)-359ao``
- ``isEqualSet(to:)-5ap6y``
- ``isEqualSet(to:)-2dezf``
- ``isSubset(of:)-73apg``
- ``isSubset(of:)-14xt1``
@@ -13,13 +13,13 @@ extension BitSet: Equatable {
/// Returns a Boolean value indicating whether two values are equal. Two
/// bit sets are considered equal if they contain the same elements.
///
/// - Note: This simply forwards to the ``isEqual(to:)-5zfpo`` method.
/// - Note: This simply forwards to the ``isEqualSet(to:)-4xfa9`` method.
/// That method has additional overloads that can be used to compare
/// bit sets with additional types.
///
/// - Complexity: O(*max*), where *max* is value of the largest member of
/// either set.
public static func ==(left: Self, right: Self) -> Bool {
left.isEqual(to: right)
left.isEqualSet(to: right)
}
}
@@ -18,7 +18,7 @@ extension BitSet {
///
/// - Complexity: O(*max*), where *max* is value of the largest member of
/// either set.
public func isEqual(to other: Self) -> Bool {
public func isEqualSet(to other: Self) -> Bool {
self._storage == other._storage
}
@@ -27,8 +27,8 @@ extension BitSet {
///
/// - Complexity: O(*max*), where *max* is value of the largest member of
/// either set.
public func isEqual(to other: BitSet.Counted) -> Bool {
self.isEqual(to: other._bits)
public func isEqualSet(to other: BitSet.Counted) -> Bool {
self.isEqualSet(to: other._bits)
}
/// Returns a Boolean value indicating whether a bit set is equal to a range
@@ -36,9 +36,9 @@ extension BitSet {
///
/// - Complexity: O(min(*max*, `other.upperBound`), where *max* is the largest
/// member of `self`.
public func isEqual(to other: Range<Int>) -> Bool {
public func isEqualSet(to other: Range<Int>) -> Bool {
guard let other = other._toUInt() else { return false }
return _read { $0.isEqual(to: other) }
return _read { $0.isEqualSet(to: other) }
}
/// Returns a Boolean value indicating whether this bit set contains the same
@@ -50,18 +50,18 @@ extension BitSet {
/// let bits: BitSet = [0, 1, 5, 6]
/// let other = [5, 5, 0, 1, 1, 6, 5, 0, 1, 6, 6, 5]
///
/// bits.isEqual(to: other) // true
/// bits.isEqualSet(to: other) // true
///
/// - Complexity: O(*n*), where *n* is the number of items in `other`.
public func isEqual<S: Sequence>(to other: S) -> Bool where S.Element == Int {
public func isEqualSet<S: Sequence>(to other: S) -> Bool where S.Element == Int {
if S.self == Self.self {
return isEqual(to: other as! Self)
return isEqualSet(to: other as! Self)
}
if S.self == BitSet.Counted.self {
return isEqual(to: other as! BitSet.Counted)
return isEqualSet(to: other as! BitSet.Counted)
}
if S.self == Range<Int>.self {
return isEqual(to: other as! Range<Int>)
return isEqualSet(to: other as! Range<Int>)
}
if self.isEmpty {
@@ -902,9 +902,9 @@ extension BitSet.Counted {
///
/// - Complexity: O(*max*), where *max* is value of the largest member of
/// either set.
public func isEqual(to other: Self) -> Bool {
public func isEqualSet(to other: Self) -> Bool {
guard self.count == other.count else { return false }
return self._bits.isEqual(to: other._bits)
return self._bits.isEqualSet(to: other._bits)
}
/// Returns a Boolean value indicating whether a bit set is equal to a counted
@@ -912,8 +912,8 @@ extension BitSet.Counted {
///
/// - Complexity: O(*max*), where *max* is value of the largest member of
/// either set.
public func isEqual(to other: BitSet) -> Bool {
self._bits.isEqual(to: other)
public func isEqualSet(to other: BitSet) -> Bool {
self._bits.isEqualSet(to: other)
}
/// Returns a Boolean value indicating whether a bit set is equal to a range
@@ -921,9 +921,9 @@ extension BitSet.Counted {
///
/// - Complexity: O(min(*max*, `other.upperBound`), where *max* is the largest
/// member of `self`.
public func isEqual(to other: Range<Int>) -> Bool {
public func isEqualSet(to other: Range<Int>) -> Bool {
guard self.count == other.count else { return false }
return _bits.isEqual(to: other)
return _bits.isEqualSet(to: other)
}
/// Returns a Boolean value indicating whether this bit set contains the same
@@ -935,15 +935,15 @@ extension BitSet.Counted {
/// let bits: BitSet = [0, 1, 5, 6]
/// let other = [5, 5, 0, 1, 1, 6, 5, 0, 1, 6, 6, 5]
///
/// bits.isEqual(to: other) // true
/// bits.isEqualSet(to: other) // true
///
/// - Complexity: O(*n*), where *n* is the number of items in `other`.
@inlinable
public func isEqual<S: Sequence>(to other: S) -> Bool
public func isEqualSet<S: Sequence>(to other: S) -> Bool
where S.Element == Int
{
guard self.count >= other.underestimatedCount else { return false }
return _bits.isEqual(to: other)
return _bits.isEqualSet(to: other)
}
}
@@ -624,7 +624,7 @@ extension BitSet._UnsafeHandle {
return _words[upper.word].intersection(uw) == uw
}
internal func isEqual(to range: Range<UInt>) -> Bool {
internal func isEqualSet(to range: Range<UInt>) -> Bool {
if range.isEmpty { return self.isEmpty }
let r = range.clamped(to: 0 ..< UInt(capacity))
guard r == range else { return false }
+1 -1
View File
@@ -47,7 +47,7 @@ add_library(BitCollections
"BitSet/BitSet+SetAlgebra formUnion.swift"
"BitSet/BitSet+SetAlgebra intersection.swift"
"BitSet/BitSet+SetAlgebra isDisjoint.swift"
"BitSet/BitSet+SetAlgebra isEqual.swift"
"BitSet/BitSet+SetAlgebra isEqualSet.swift"
"BitSet/BitSet+SetAlgebra isStrictSubset.swift"
"BitSet/BitSet+SetAlgebra isStrictSuperset.swift"
"BitSet/BitSet+SetAlgebra isSubset.swift"
@@ -30,11 +30,11 @@
### Adding Elements
- ``append(_:)``
- ``append(_:)-8dqhn``
- ``append(contentsOf:)-18dwf``
- ``append(contentsOf:)-576q4``
- ``append(contentsOf:)-8xkr8``
- ``insert(_:at:)``
- ``insert(_:at:)-9t4hf``
- ``insert(contentsOf:at:)-7e1xn``
- ``insert(contentsOf:at:)-35dp3``
- ``insert(contentsOf:at:)-1wsgw``
@@ -49,8 +49,8 @@
- ``removeSubrange(_:)-18qe7``
- ``removeLast()``
- ``removeLast(_:)``
- ``removeFirst()``
- ``removeFirst(_:)``
- ``removeFirst()-dcsp``
- ``removeFirst(_:)-9nqlo``
- ``popLast()``
### Replacing Elements
@@ -97,10 +97,10 @@
### Binary Set Predicates
- ``==(_:_:)``
- ``isEqual(to:)-5bw9h``
- ``isEqual(to:)-8jxq5``
- ``isEqual(to:)-7w9qy``
- ``isEqual(to:)-9tnfo``
- ``isEqualSet(to:)-11031``
- ``isEqualSet(to:)-1hvpp``
- ``isEqualSet(to:)-1mvpq``
- ``isEqualSet(to:)-878x1``
- ``isSubset(of:)-8iy8c``
- ``isSubset(of:)-1r41b``
@@ -98,10 +98,10 @@
### Comparing Sets
- ``==(_:_:)``
- ``isEqual(to:)-5zfpo``
- ``isEqual(to:)-93d52``
- ``isEqual(to:)-542zl``
- ``isEqual(to:)-1d66i``
- ``isEqualSet(to:)-4xfa9``
- ``isEqualSet(to:)-359ao``
- ``isEqualSet(to:)-5ap6y``
- ``isEqualSet(to:)-2dezf``
- ``isSubset(of:)-73apg``
- ``isSubset(of:)-14xt1``
@@ -38,28 +38,25 @@
### Binary Set Predicates
- ``==(_:_:)``
- ``isEqualSet(to:)-1szq``
- ``isEqualSet(to:)-9djqq``
- ``isSubset(of:)-n4t7``
- ``isSubset(of:)-2dx31``
- ``isSubset(of:)-801lo``
- ``isSubset(of:)-952h5``
- ``isSuperset(of:)-4ea6h``
- ``isSuperset(of:)-9t33p``
- ``isSuperset(of:)-2vtig``
- ``isSuperset(of:)-9krpz``
- ``isStrictSubset(of:)-33z0l``
- ``isStrictSubset(of:)-9o6mg``
- ``isStrictSubset(of:)-91par``
- ``isStrictSubset(of:)-7n66e``
- ``isStrictSuperset(of:)-8pbce``
- ``isStrictSuperset(of:)-89ig3``
- ``isStrictSuperset(of:)-1e0xt``
- ``isStrictSuperset(of:)-5dsfd``
- ``isDisjoint(with:)-7sbsg``
- ``isDisjoint(with:)-3wuso``
- ``isDisjoint(with:)-25vmx``
- ``isDisjoint(with:)-8nfqs``
@@ -94,9 +94,9 @@
### Comparing Sets
- ``==(_:_:)``
- ``isEqual(to:)-69p52``
- ``isEqual(to:)-1xzfo``
- ``isEqual(to:)-3ab2q``
- ``isEqualSet(to:)-6zqj7``
- ``isEqualSet(to:)-34yz0``
- ``isEqualSet(to:)-2bhxr``
- ``isSubset(of:)-ptij``
- ``isSubset(of:)-3mw6r``
@@ -135,7 +135,7 @@
### Creating and Applying Differences
- ``difference(from:)``
- ``difference(from:)-30bkk``
- ``applying(_:)``
### Memory Management
@@ -141,9 +141,9 @@ average -- typically they will need to compare against just one member.
### Comparing Sets
- ``==(_:_:)``
- ``isEqual(to:)-3m3in``
- ``isEqual(to:)-7mkn1``
- ``isEqual(to:)-5px5r``
- ``isEqualSet(to:)-7egih``
- ``isEqualSet(to:)-4t0k5``
- ``isEqualSet(to:)-7s0cu``
- ``isSubset(of:)-9mp7l``
- ``isSubset(of:)-2jlh``
+1 -1
View File
@@ -50,7 +50,7 @@ add_library(OrderedCollections
"OrderedSet/OrderedSet+Partial SetAlgebra formUnion.swift"
"OrderedSet/OrderedSet+Partial SetAlgebra intersection.swift"
"OrderedSet/OrderedSet+Partial SetAlgebra isDisjoint.swift"
"OrderedSet/OrderedSet+Partial SetAlgebra isEqual.swift"
"OrderedSet/OrderedSet+Partial SetAlgebra isEqualSet.swift"
"OrderedSet/OrderedSet+Partial SetAlgebra isStrictSubset.swift"
"OrderedSet/OrderedSet+Partial SetAlgebra isStrictSuperset.swift"
"OrderedSet/OrderedSet+Partial SetAlgebra isSubset.swift"
@@ -35,28 +35,25 @@
### Binary Set Predicates
- ``==(_:_:)``
- ``isEqualSet(to:)-1szq``
- ``isEqualSet(to:)-9djqq``
- ``isSubset(of:)-n4t7``
- ``isSubset(of:)-2dx31``
- ``isSubset(of:)-801lo``
- ``isSubset(of:)-952h5``
- ``isSuperset(of:)-4ea6h``
- ``isSuperset(of:)-9t33p``
- ``isSuperset(of:)-2vtig``
- ``isSuperset(of:)-9krpz``
- ``isStrictSubset(of:)-33z0l``
- ``isStrictSubset(of:)-9o6mg``
- ``isStrictSubset(of:)-91par``
- ``isStrictSubset(of:)-7n66e``
- ``isStrictSuperset(of:)-8pbce``
- ``isStrictSuperset(of:)-89ig3``
- ``isStrictSuperset(of:)-1e0xt``
- ``isStrictSuperset(of:)-5dsfd``
- ``isDisjoint(with:)-7sbsg``
- ``isDisjoint(with:)-3wuso``
- ``isDisjoint(with:)-25vmx``
- ``isDisjoint(with:)-8nfqs``
@@ -91,9 +91,9 @@
### Comparing Sets
- ``==(_:_:)``
- ``isEqual(to:)-69p52``
- ``isEqual(to:)-1xzfo``
- ``isEqual(to:)-3ab2q``
- ``isEqualSet(to:)-6zqj7``
- ``isEqualSet(to:)-34yz0``
- ``isEqualSet(to:)-2bhxr``
- ``isSubset(of:)-ptij``
- ``isSubset(of:)-3mw6r``
@@ -132,7 +132,7 @@
### Creating and Applying Differences
- ``difference(from:)``
- ``difference(from:)-30bkk``
- ``applying(_:)``
### Memory Management
@@ -16,7 +16,7 @@ extension OrderedSet: Equatable {
/// elements in the same order.
///
/// - Note: This operator implements different behavior than the
/// `isEqual(to:)` method -- the latter implements an unordered
/// `isEqualSet(to:)` method -- the latter implements an unordered
/// comparison, to match the behavior of members like `isSubset(of:)`,
/// `isStrictSuperset(of:)` etc.
///
@@ -22,7 +22,7 @@ extension OrderedSet {
///
/// - Complexity: O(`min(left.count, right.count)`), as long as`Element`
/// properly implements hashing.
public func isEqual(to other: Self) -> Bool {
public func isEqualSet(to other: Self) -> Bool {
self.unordered == other.unordered
}
@@ -31,7 +31,7 @@ extension OrderedSet {
///
/// - Complexity: O(`min(left.count, right.count)`), as long as`Element`
/// properly implements hashing.
public func isEqual(to other: UnorderedView) -> Bool {
public func isEqualSet(to other: UnorderedView) -> Bool {
self.unordered == other
}
@@ -44,10 +44,10 @@ extension OrderedSet {
///
/// - Complexity: O(*n*), where *n* is the number of items in
/// `other`, as long as`Element` properly implements hashing.
public func isEqual<S: Sequence>(to other: S) -> Bool
public func isEqualSet<S: Sequence>(to other: S) -> Bool
where S.Element == Element {
if S.self == Self.self {
return isEqual(to: other as! Self)
return isEqualSet(to: other as! Self)
}
if self.isEmpty {
@@ -641,6 +641,36 @@ extension OrderedSet.UnorderedView {
}
}
extension OrderedSet.UnorderedView {
/// Returns a Boolean value indicating whether two set values contain the
/// same elements, but not necessarily in the same order.
///
/// - Note: This member implements different behavior than the `==(_:_:)`
/// operator -- the latter implements an ordered comparison, matching
/// the stricter concept of equality expected of an ordered collection
/// type.
///
/// - Complexity: O(`min(left.count, right.count)`), as long as`Element`
/// properly implements hashing.
public func isEqualSet(to other: Self) -> Bool {
self == other
}
/// Returns a Boolean value indicating whether an ordered set contains the
/// same values as a given sequence, but not necessarily in the same
/// order.
///
/// Duplicate items in `other` do not prevent it from comparing equal to
/// `self`.
///
/// - Complexity: O(*n*), where *n* is the number of items in
/// `other`, as long as`Element` properly implements hashing.
public func isEqualSet<S: Sequence>(to other: S) -> Bool
where S.Element == Element {
self._base.isEqualSet(to: other)
}
}
extension OrderedSet.UnorderedView {
/// Returns a Boolean value that indicates whether this set is a subset of
/// the given set.
+2 -2
View File
@@ -28,7 +28,7 @@ add_library(PersistentCollections
"Node/_Node+Structural filter.swift"
"Node/_Node+Structural intersection.swift"
"Node/_Node+Structural isDisjoint.swift"
"Node/_Node+Structural isEqual.swift"
"Node/_Node+Structural isEqualSet.swift"
"Node/_Node+Structural isSubset.swift"
"Node/_Node+Structural mapValues.swift"
"Node/_Node+Structural merge.swift"
@@ -85,7 +85,7 @@ add_library(PersistentCollections
"PersistentSet/PersistentSet+SetAlgebra formUnion.swift"
"PersistentSet/PersistentSet+SetAlgebra intersection.swift"
"PersistentSet/PersistentSet+SetAlgebra isDisjoint.swift"
"PersistentSet/PersistentSet+SetAlgebra isEqual.swift"
"PersistentSet/PersistentSet+SetAlgebra isEqualSet.swift"
"PersistentSet/PersistentSet+SetAlgebra isStrictSubset.swift"
"PersistentSet/PersistentSet+SetAlgebra isStrictSuperset.swift"
"PersistentSet/PersistentSet+SetAlgebra isSubset.swift"
@@ -12,7 +12,7 @@
// TODO: `Equatable` needs more test coverage, apart from hash-collision smoke test
extension _Node {
@inlinable
internal func isEqual<Value2>(
internal func isEqualSet<Value2>(
to other: _Node<Key, Value2>,
by areEquivalent: (Value, Value2) -> Bool
) -> Bool {
@@ -54,7 +54,7 @@ extension _Node {
let rc = r.children
return lc.elementsEqual(
rc,
by: { $0.isEqual(to: $1, by: areEquivalent) })
by: { $0.isEqualSet(to: $1, by: areEquivalent) })
}
}
}
@@ -138,9 +138,9 @@ average -- typically they will need to compare against just one member.
### Comparing Sets
- ``==(_:_:)``
- ``isEqual(to:)-3m3in``
- ``isEqual(to:)-7mkn1``
- ``isEqual(to:)-5px5r``
- ``isEqualSet(to:)-7egih``
- ``isEqualSet(to:)-4t0k5``
- ``isEqualSet(to:)-7s0cu``
- ``isSubset(of:)-9mp7l``
- ``isSubset(of:)-2jlh``
@@ -18,6 +18,6 @@ extension PersistentDictionary: Equatable where Value: Equatable {
/// - Complexity: O(`min(left.count, right.count)`)
@inlinable
public static func == (left: Self, right: Self) -> Bool {
left._root.isEqual(to: right._root, by: { $0 == $1 })
left._root.isEqualSet(to: right._root, by: { $0 == $1 })
}
}
@@ -17,13 +17,13 @@ extension PersistentSet: Equatable {
/// Two persistent sets are considered equal if they contain the same
/// elements, but not necessarily in the same order.
///
/// - Note: This simply forwards to the ``isEqual(to:)-3m3in`` method.
/// - Note: This simply forwards to the ``isEqualSet(to:)-7egih`` method.
/// That method has additional overloads that can be used to compare
/// persistent sets with additional types.
///
/// - Complexity: O(`min(left.count, right.count)`)
@inlinable @inline(__always)
public static func == (left: Self, right: Self) -> Bool {
left.isEqual(to: right)
left.isEqualSet(to: right)
}
}
@@ -26,8 +26,8 @@ extension PersistentSet {
/// every available shortcut to reduce complexity, e.g. by skipping
/// comparing elements in shared subtrees.
@inlinable
public func isEqual(to other: Self) -> Bool {
_root.isEqual(to: other._root, by: { _, _ in true })
public func isEqualSet(to other: Self) -> Bool {
_root.isEqualSet(to: other._root, by: { _, _ in true })
}
/// Returns a Boolean value indicating whether a persistent set compares equal
@@ -45,10 +45,10 @@ extension PersistentSet {
/// every available shortcut to reduce complexity, e.g. by skipping
/// comparing elements in shared subtrees.
@inlinable
public func isEqual<Value>(
public func isEqualSet<Value>(
to other: PersistentDictionary<Element, Value>.Keys
) -> Bool {
_root.isEqual(to: other._base._root, by: { _, _ in true })
_root.isEqualSet(to: other._base._root, by: { _, _ in true })
}
/// Returns a Boolean value indicating whether this persistent set contains
@@ -61,7 +61,7 @@ extension PersistentSet {
/// let this: PersistentSet = [0, 1, 5, 6]
/// let that = [5, 5, 0, 1, 1, 6, 5, 0, 1, 6, 6, 5]
///
/// this.isEqual(to: that) // true
/// this.isEqualSet(to: that) // true
///
/// - Parameter other: The keys view of a persistent dictionary.
///
@@ -75,11 +75,11 @@ extension PersistentSet {
/// every available shortcut to reduce complexity, e.g. by skipping
/// comparing elements in shared subtrees.
@inlinable
public func isEqual<S: Sequence>(to other: S) -> Bool
public func isEqualSet<S: Sequence>(to other: S) -> Bool
where S.Element == Element
{
if S.self == Self.self {
return isEqual(to: other as! Self)
return isEqualSet(to: other as! Self)
}
if self.isEmpty {
@@ -75,7 +75,7 @@ public protocol SetAPIExtras: SetAPIChecker {
mutating func update(_ member: Element, at index: Index) -> Element
func isEqual(to other: Self) -> Bool
func isEqual<S: Sequence>(to other: S) -> Bool
func isEqualSet(to other: Self) -> Bool
func isEqualSet<S: Sequence>(to other: S) -> Bool
where S.Element == Element
}
@@ -155,16 +155,16 @@ final class BitSetCountedTests: CollectionTestCase {
let a: BitSet.Counted = [1, 2, 3, 4]
let b = 1 ..< 5
expectTrue(a.isEqual(to: BitSet.Counted(b)))
expectTrue(a.isEqual(to: BitSet(b)))
expectTrue(a.isEqual(to: b))
expectTrue(a.isEqual(to: Set(b)))
expectTrue(a.isEqualSet(to: BitSet.Counted(b)))
expectTrue(a.isEqualSet(to: BitSet(b)))
expectTrue(a.isEqualSet(to: b))
expectTrue(a.isEqualSet(to: Set(b)))
let c = 2 ..< 7
expectFalse(a.isEqual(to: BitSet.Counted(c)))
expectFalse(a.isEqual(to: BitSet(c)))
expectFalse(a.isEqual(to: c))
expectFalse(a.isEqual(to: Set(c)))
expectFalse(a.isEqualSet(to: BitSet.Counted(c)))
expectFalse(a.isEqualSet(to: BitSet(c)))
expectFalse(a.isEqualSet(to: c))
expectFalse(a.isEqualSet(to: Set(c)))
}
func test_isSubset() {
+11 -11
View File
@@ -1091,25 +1091,25 @@ final class BitSetTest: CollectionTestCase {
func test_isEqual_to_integer_range() {
let a = BitSet(200 ..< 400)
expectTrue(a.isEqual(to: 200 ..< 400))
expectFalse(a.isEqual(to: 201 ..< 401))
expectFalse(a.isEqual(to: -1 ..< 200))
expectFalse(a.isEqual(to: 0 ..< 0))
expectFalse(a.isEqual(to: 0 ..< 1000))
expectFalse(a.isEqual(to: 0 ..< 250))
expectFalse(a.isEqual(to: 270 ..< 400))
expectTrue(a.isEqualSet(to: 200 ..< 400))
expectFalse(a.isEqualSet(to: 201 ..< 401))
expectFalse(a.isEqualSet(to: -1 ..< 200))
expectFalse(a.isEqualSet(to: 0 ..< 0))
expectFalse(a.isEqualSet(to: 0 ..< 1000))
expectFalse(a.isEqualSet(to: 0 ..< 250))
expectFalse(a.isEqualSet(to: 270 ..< 400))
var b = a
b.remove(300)
expectFalse(b.isEqual(to: 200 ..< 400))
expectFalse(b.isEqualSet(to: 200 ..< 400))
let c = BitSet(130 ..< 160)
expectTrue(c.isEqual(to: 130 ..< 160))
expectTrue(c.isEqualSet(to: 130 ..< 160))
}
func test_isEqual_to_counted_BitSet() {
let a = BitSet(200 ..< 400)
expectTrue(a.isEqual(to: a.counted))
expectTrue(a.isEqualSet(to: a.counted))
}
func test_isEqual_to_Sequence() {
@@ -1117,7 +1117,7 @@ final class BitSetTest: CollectionTestCase {
_ bits: BitSet,
_ items: S
) -> Bool where S.Element == Int {
bits.isEqual(to: items)
bits.isEqualSet(to: items)
}
let bits: BitSet = [3, 6, 8, 11]
@@ -1333,18 +1333,18 @@ class OrderedSetTests: CollectionTestCase {
_ set: OrderedSet<Int>,
_ other: S
) -> Bool where S.Element == Int {
set.isEqual(to: other)
set.isEqualSet(to: other)
}
expectEqual(a.isEqual(to: b), expected)
expectEqual(a.isEqual(to: b.unordered), expected)
expectEqual(a.isEqual(to: c), expected)
expectEqual(a.isEqualSet(to: b), expected)
expectEqual(a.isEqualSet(to: b.unordered), expected)
expectEqual(a.isEqualSet(to: c), expected)
expectEqual(checkSequence(a, b), expected)
expectEqual(checkSequence(a, c), expected)
expectEqual(a.isEqual(to: d), expected)
expectEqual(a.isEqual(to: d + d), expected)
expectEqual(a.isEqual(to: r2), expected)
expectEqual(a.isEqualSet(to: d), expected)
expectEqual(a.isEqualSet(to: d + d), expected)
expectEqual(a.isEqualSet(to: r2), expected)
}
}
}
@@ -264,7 +264,7 @@ class PersistentSetTests: CollectionTestCase {
withEverySubset("a", of: testItems) { a in
let x = PersistentSet(a)
let u = Set(a)
expectTrue(x.isEqual(to: x))
expectTrue(x.isEqualSet(to: x))
withEverySubset("b", of: testItems) { b in
let y = PersistentSet(b)
let v = Set(b)
@@ -277,15 +277,15 @@ class PersistentSetTests: CollectionTestCase {
_ b: S
) -> Bool
where S.Element == RawCollider {
a.isEqual(to: b)
a.isEqualSet(to: b)
}
expectEqual(x.isEqual(to: y), reference)
expectEqual(x.isEqual(to: z.keys), reference)
expectEqual(x.isEqualSet(to: y), reference)
expectEqual(x.isEqualSet(to: z.keys), reference)
expectEqual(checkSequence(x, y), reference)
expectEqual(x.isEqual(to: v), reference)
expectEqual(x.isEqual(to: b), reference)
expectEqual(x.isEqual(to: b + b), reference)
expectEqual(x.isEqualSet(to: v), reference)
expectEqual(x.isEqualSet(to: b), reference)
expectEqual(x.isEqualSet(to: b + b), reference)
}
}
}