Skip to content

Commit a5e6b88

Browse files
authored
Merge pull request swiftlang#21838 from compnerd/prototypes
2 parents 77ec709 + d4a1865 commit a5e6b88

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

test/Prototypes/BigInt.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,21 @@
99
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
//
1111
//===----------------------------------------------------------------------===//
12-
// XFAIL: linux
12+
1313
// RUN: %empty-directory(%t)
1414
// RUN: %target-build-swift -swift-version 4 -o %t/a.out %s
1515
// RUN: %target-run %t/a.out
1616
// REQUIRES: executable_test
1717
// REQUIRES: CPU=x86_64
1818

1919
import StdlibUnittest
20+
#if os(Windows)
21+
import MSVCRT
22+
#elseif os(Linux) || os(Android)
23+
import Glibc
24+
#elseif os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
2025
import Darwin
26+
#endif
2127

2228
extension FixedWidthInteger {
2329
/// Returns the high and low parts of a potentially overflowing addition.
@@ -154,9 +160,9 @@ public struct _BigInt<Word: FixedWidthInteger & UnsignedInteger> :
154160
static func _randomWord() -> Word {
155161
// This handles up to a 64-bit word
156162
if Word.bitWidth > UInt32.bitWidth {
157-
return Word(arc4random()) << 32 | Word(arc4random())
163+
return Word(UInt32.random(in: 0...UInt32.max)) << 32 | Word(UInt32.random(in: 0...UInt32.max))
158164
} else {
159-
return Word(truncatingIfNeeded: arc4random())
165+
return Word(truncatingIfNeeded: UInt32.random(in: 0...UInt32.max))
160166
}
161167
}
162168

@@ -1450,7 +1456,7 @@ func testBinaryInit<T: BinaryInteger>(_ x: T) -> BigInt {
14501456
}
14511457

14521458
func randomBitLength() -> Int {
1453-
return Int(arc4random_uniform(1000) + 2)
1459+
return Int.random(in: 2...1000)
14541460
}
14551461

14561462
var BitTests = TestSuite("Bit")

test/Prototypes/CollectionTransformers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ import Darwin
200200
import Dispatch
201201

202202
// FIXME: port to Linux.
203-
// XFAIL: linux
203+
// XFAIL: linux, windows
204204

205205
// A wrapper for pthread_t with platform-independent interface.
206206
public struct _stdlib_pthread_t : Equatable, Hashable {

0 commit comments

Comments
 (0)