// // HashingTests.swift // FirebladeECSTests // // Created by Christian Treffs on 16.10.17. // import Darwin import XCTest @testable import FirebladeECS class HashingTests: XCTestCase { func testCollisionsInCritialRange() { var hashSet: Set = Set() var range: CountableRange = 0 ..< 1_000_000 let maxComponents: Int = 1000 let components: [Int] = (0.. Int { let upperBound: Int = 44 let high = UInt(arc4random()) << UInt(upperBound) let low = UInt(arc4random()) assert(high.leadingZeroBitCount < 64-upperBound) assert(high.trailingZeroBitCount >= upperBound) assert(low.leadingZeroBitCount >= 32) assert(low.trailingZeroBitCount <= 32) let rand: UInt = high | low let cH = Int(bitPattern: rand) return cH } }