Skip to content

Commit

Permalink
removed unnecessary equal and != implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
adamnemecek committed May 18, 2022
1 parent d82c208 commit a3ac458
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
11 changes: 1 addition & 10 deletions Sources/SwiftRoaring/RoaringBitmap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -294,20 +294,11 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
/**
* Return true if the two bitmaps contain the same elements.
*/
public func equals(_ x: RoaringBitmap) -> Bool {
return croaring.roaring_bitmap_equals(self.ptr, x.ptr)
}
/**
* Return true if the two bitmaps contain the same elements.
*/
public static func ==(left: RoaringBitmap, right: RoaringBitmap) -> Bool {
return left.equals(right)
}
/**
* Return true if the two bitmaps DO NOT contain the same elements.
*/
public static func !=(left: RoaringBitmap, right: RoaringBitmap) -> Bool {
return !(left == right)
return croaring.roaring_bitmap_equals(left.ptr, right.ptr)
}

/**
Expand Down
9 changes: 2 additions & 7 deletions Tests/swiftRoaringTests/swiftRoaringTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ class swiftRoaringTests: XCTestCase {

func testEquals() {
let cpy = rbm.copy()
XCTAssertTrue(cpy.equals(rbm))
XCTAssertTrue(cpy == rbm)
XCTAssertEqual(cpy != rbm, false)
XCTAssertFalse(cpy != rbm)
}

func testSubset() {
Expand Down Expand Up @@ -347,10 +346,6 @@ class swiftRoaringTests: XCTestCase {
}

func makeList(_ n: Int) -> [UInt32] {
#if os(Linux)
return (0..<n).map { _ in UInt32(Int.random(in: 0 ..< 1000)) }
#else
return (0..<n).map { _ in UInt32(arc4random_uniform(1000)+1) }
#endif
return (0..<n).map { _ in UInt32.random(in: 0 ..< 1000) }
}
}

0 comments on commit a3ac458

Please sign in to comment.