mirror of
https://github.com/apple/swift-numerics
synced 2026-11-29 05:24:24 +00:00
[BigIntTests] Update testFloatingPoint_random()
This commit is contained in:
1 parent
1b733de54a
commit
506ea36331
1 file changed
+22
-3
@@ -175,9 +175,28 @@ final class BigIntTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testFloatingPoint_random() {
|
||||
for _ in 0 ..< 1000 {
|
||||
let random = Float64.random(in: -0x1p52 ... +0x1p52)
|
||||
XCTAssertEqual(BigInt(random), BigInt(Int64(random)))
|
||||
for _ in 0 ..< 100 {
|
||||
let small = Float32.random(in: -10 ... +10)
|
||||
XCTAssertEqual(BigInt(small), BigInt(Int64(small)))
|
||||
|
||||
let large = Float32.random(in: -0x1p23 ... +0x1p23)
|
||||
XCTAssertEqual(BigInt(large), BigInt(Int64(large)))
|
||||
}
|
||||
|
||||
for _ in 0 ..< 100 {
|
||||
let small = Float64.random(in: -10 ... +10)
|
||||
XCTAssertEqual(BigInt(small), BigInt(Int64(small)))
|
||||
|
||||
let large = Float64.random(in: -0x1p52 ... +0x1p52)
|
||||
XCTAssertEqual(BigInt(large), BigInt(Int64(large)))
|
||||
}
|
||||
|
||||
for _ in 0 ..< 100 {
|
||||
let small = FloatXX.random(in: -10 ... +10)
|
||||
XCTAssertEqual(BigInt(small), BigInt(Int64(small)))
|
||||
|
||||
let large = FloatXX.random(in: -0x1p52 ... +0x1p52)
|
||||
XCTAssertEqual(BigInt(large), BigInt(Int64(large)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user