Skip to content

Commit 0dda842

Browse files
committed
Fix availability of Float16 type
1 parent f45342c commit 0dda842

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Sources/PropertyBased/Gen+Float.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ extension Gen where Value == Double {
7777
}
7878
}
7979

80+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
8081
@available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
8182
extension Gen where Value == Float16 {
8283
/// Produces a generator of random floats within the specified range.
@@ -97,6 +98,7 @@ extension Gen where Value == Float16 {
9798
return value(in: range)
9899
}
99100
}
101+
#endif
100102

101103
#if !(os(Windows) || os(Android)) && (arch(i386) || arch(x86_64))
102104
extension Gen where Value == Float80 {

Tests/PropertyBasedTests/GenTests.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ import Testing
1616
}
1717
}
1818

19+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
20+
@available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
1921
@Test func testGenerateFloat16() async {
2022
await testGen(Gen.float16(in: 0...1))
2123
await testGen(Gen.float16(in: 0..<1))
2224
}
25+
#endif
26+
2327
@Test func testGenerateFloat32() async {
2428
await testGen(Gen.float(in: 0...1))
2529
await testGen(Gen.float(in: 0..<1))
@@ -29,6 +33,13 @@ import Testing
2933
await testGen(Gen.double(in: 0..<1))
3034
}
3135

36+
#if !(os(Windows) || os(Android)) && (arch(i386) || arch(x86_64))
37+
@Test func testGenerateFloat80() async {
38+
await testGen(Gen.float80(in: 0...1))
39+
await testGen(Gen.float80(in: 0..<1))
40+
}
41+
#endif
42+
3243
@Test func testGenerateInt() async { await testGen(Gen.int()) }
3344
@Test func testGenerateInt8() async { await testGen(Gen.int8()) }
3445
@Test func testGenerateInt16() async { await testGen(Gen.int16()) }

0 commit comments

Comments
 (0)