Skip to content

Commit e9cfe4a

Browse files
committed
Update to Swift 3.1
1 parent 45fcb20 commit e9cfe4a

File tree

6 files changed

+15
-18
lines changed

6 files changed

+15
-18
lines changed

.travis.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ matrix:
55
include:
66
- os: osx
77
language: objective-c
8-
osx_image: xcode8
8+
osx_image: xcode8.3
99
before_install:
10-
- gem install cocoapods
1110
- git submodule update --init --recursive
1211
- pushd Utilities
1312
- ./compile.sh
@@ -17,7 +16,7 @@ matrix:
1716
- carthage build --no-skip-current
1817
- os: osx
1918
language: objective-c
20-
osx_image: xcode8
19+
osx_image: xcode8.3
2120
before_install:
2221
- git submodule update --init --recursive
2322
- pushd Utilities
@@ -46,9 +45,9 @@ matrix:
4645
before_install:
4746
- git submodule update --init --recursive
4847
- wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import -
49-
- wget https://swift.org/builds/swift-3.0.2-release/ubuntu1404/swift-3.0.2-RELEASE/swift-3.0.2-RELEASE-ubuntu14.04.tar.gz
50-
- tar xzf swift-3.0.2-RELEASE-ubuntu14.04.tar.gz
51-
- export PATH=${PWD}/swift-3.0.2-RELEASE-ubuntu14.04/usr/bin:"${PATH}"
48+
- wget https://swift.org/builds/swift-3.1-release/ubuntu1404/swift-3.1-RELEASE/swift-3.1-RELEASE-ubuntu14.04.tar.gz
49+
- tar xzf swift-3.1-RELEASE-ubuntu14.04.tar.gz
50+
- export PATH=${PWD}/swift-3.1-RELEASE-ubuntu14.04/usr/bin:"${PATH}"
5251
- pushd Utilities
5352
- ./compile.sh
5453
- popd

Sources/Arbitrary.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ extension Float : Arbitrary {
244244
public static func shrink(_ x : Float) -> [Float] {
245245
let tail = Int64(x).shrinkIntegral.map(Float.init(_:))
246246
if (x.sign == .minus) {
247-
return [abs(x)] + tail
247+
return [Swift.abs(x)] + tail
248248
}
249249
return tail
250250
}
@@ -273,7 +273,7 @@ extension Double : Arbitrary {
273273
public static func shrink(_ x : Double) -> [Double] {
274274
let tail = Int64(x).shrinkIntegral.map(Double.init(_:))
275275
if (x.sign == .minus) {
276-
return [abs(x)] + tail
276+
return [Swift.abs(x)] + tail
277277
}
278278
return tail
279279
}

Sources/Lattice.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,24 @@ extension Int64 : LatticeType {}
5757
extension Float : LatticeType {
5858
/// The lower limit of the `Float` type.
5959
public static var min : Float {
60-
return FLT_MIN
60+
return Float.leastNormalMagnitude
6161
}
6262

6363
/// The upper limit of the `Float` type.
6464
public static var max : Float {
65-
return FLT_MAX
65+
return Float.greatestFiniteMagnitude
6666
}
6767
}
6868

6969
extension Double : LatticeType {
7070
/// The lower limit of the `Double` type.
7171
public static var min : Double {
72-
return DBL_MIN
72+
return Double.leastNormalMagnitude
7373
}
7474

7575
/// The upper limit of the `Double` type.
7676
public static var max : Double {
77-
return DBL_MAX
77+
return Double.greatestFiniteMagnitude
7878
}
7979
}
8080

Sources/Modifiers.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ public struct PointerOf<T : Arbitrary> : Arbitrary, CustomStringConvertible {
313313
fileprivate let _impl : PointerOfImpl<T>
314314

315315
/// Retrieves the underlying pointer value.
316-
public var getPointer : UnsafePointer<T> {
317-
return UnsafePointer(self._impl.ptr!)
316+
public var getPointer : UnsafeBufferPointer<T> {
317+
return UnsafeBufferPointer(start: self._impl.ptr, count: self.size)
318318
}
319319

320320
public var size : Int {
@@ -673,7 +673,7 @@ private final class PointerOfImpl<T : Arbitrary> : Arbitrary {
673673
return Gen.pure(PointerOfImpl(UnsafeMutablePointer<T>.allocate(capacity: size), size))
674674
}
675675
let pt = UnsafeMutablePointer<T>.allocate(capacity: n)
676-
let gt = sequence(Array((0..<n)).map { _ in T.arbitrary }).map(pt.initialize)
676+
let gt = sequence(Array((0..<n)).map { _ in T.arbitrary }).map({ UnsafeMutableBufferPointer(start: pt, count: n).initialize(from: $0) })
677677
return gt.map { _ in PointerOfImpl(pt, n) }
678678
}
679679
}

Tests/SwiftCheckTests/FileCheck.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
import Foundation
1010
#if os(Linux)
1111
import Glibc
12-
13-
typealias NSRegularExpression = RegularExpression
1412
#else
1513
import Darwin
1614
#endif

Tests/SwiftCheckTests/ModifierSpec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ModifierSpec : XCTestCase {
2727
// CHECK-NEXT: *** Passed 100 tests
2828
// CHECK-NEXT: .
2929
property("Pointers behave") <- forAll { (x : PointerOf<Int>) in
30-
return x.size != 0
30+
return x.size != 0 && x.getPointer.count == x.size
3131
}
3232

3333
// CHECK-NEXT: *** Passed 100 tests

0 commit comments

Comments
 (0)