Skip to content

Commit

Permalink
Merge pull request #189 from CodaFi/rental-tux
Browse files Browse the repository at this point in the history
Try testing on linux
  • Loading branch information
CodaFi authored Sep 18, 2016
2 parents 983b595 + d6a8bdc commit 5dec398
Show file tree
Hide file tree
Showing 19 changed files with 270 additions and 132 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ matrix:
before_install:
- git submodule update --init --recursive
- wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import -
- wget https://swift.org/builds/swift-3.0-preview-6/ubuntu1404/swift-3.0-PREVIEW-6/swift-3.0-PREVIEW-6-ubuntu14.04.tar.gz
- tar xzf swift-3.0-PREVIEW-6-ubuntu14.04.tar.gz
- export PATH=${PWD}/swift-3.0-PREVIEW-6-ubuntu14.04/usr/bin:"${PATH}"
- wget https://swift.org/builds/swift-3.0-release/ubuntu1404/swift-3.0-RELEASE/swift-3.0-RELEASE-ubuntu14.04.tar.gz
- tar xzf swift-3.0-RELEASE-ubuntu14.04.tar.gz
- export PATH=${PWD}/swift-3.0-RELEASE-ubuntu14.04/usr/bin:"${PATH}"
script:
- swift build
- swift test
notifications:
webhooks:
urls:
Expand Down
3 changes: 3 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ let package = Package(
name: "SwiftCheck",
targets: [
Target(name: "SwiftCheck"),
Target(
name: "SwiftCheckTests",
dependencies: ["SwiftCheck"]),
]
)

242 changes: 122 additions & 120 deletions SwiftCheck.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// LinuxMain.swift
// SwiftCheck
//
// Created by Robert Widmann on 9/18/16.
// Copyright © 2016 Typelift. All rights reserved.
//

import XCTest

@testable import SwiftCheckTests

#if !os(macOS)
XCTMain([
BooleanIdentitySpec.allTests,
ComplexSpec.allTests,
DiscardSpec.allTests,
FailureSpec.allTests,
GenSpec.allTests,
LambdaSpec.allTests,
ModifierSpec.allTests,
PathSpec.allTests,
PropertySpec.allTests,
RawRepresentableSpec.allTests,
ReplaySpec.allTests,
RoseSpec.allTests,
ShrinkSpec.allTests,
SimpleSpec.allTests,
TestSpec.allTests,
])
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,10 @@ class BooleanIdentitySpec : XCTestCase {
return ((x && y) || (x && z) || (!y && z)) == ((x && y) || (!y && z))
}
}

#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
static var allTests = testCase([
("testAll", testAll),
])
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ class ComplexSpec : XCTestCase {
return e.characters.filter({ $0 == ":" }).count == 3
}
}

#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
static var allTests = testCase([
("testEmailAddressProperties", testEmailAddressProperties),
("testIPv6Properties", testIPv6Properties),
])
#endif
}

// MARK: String Conveniences
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,11 @@ class DiscardSpec : XCTestCase {
return Discard()
}.expectFailure
}


#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
static var allTests = testCase([
("testDiscardFailure", testDiscardFailure),
])
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
import SwiftCheck
import XCTest

#if os(Linux)
import Glibc
#else
import Darwin
#endif

enum SwiftCheckError : Error {
case bogus
}
Expand Down Expand Up @@ -60,4 +66,11 @@ class FailureSpec : XCTestCase {
override func tearDown() {
XCTAssert(failCount == tests.count)
}


#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
static var allTests = testCase([
("testProperties", testProperties),
])
#endif
}
8 changes: 8 additions & 0 deletions Tests/GenSpec.swift → Tests/SwiftCheckTests/GenSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import SwiftCheck
import XCTest
import Foundation

class GenSpec : XCTestCase {
func testAll() {
Expand Down Expand Up @@ -308,6 +309,13 @@ class GenSpec : XCTestCase {
}
}
}

#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
static var allTests = testCase([
("testAll", testAll),
("testLaws", testLaws),
])
#endif
}

internal func curry<A, B, C>(_ f : @escaping (A, B) -> C) -> (A) -> (B) -> C {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,11 @@ class LambdaSpec : XCTestCase {
}
}
}

#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
static var allTests = testCase([
("testAll", testAll),
])
#endif
}

Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,10 @@ class ModifierSpec : XCTestCase {
return (xs.getArray.filter(f).reduce(true, { $0.0 && f($0.1) }) as Bool)
}
}

#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
static var allTests = testCase([
("testModifiers", testModifiers),
])
#endif
}
10 changes: 8 additions & 2 deletions Tests/PathSpec.swift → Tests/SwiftCheckTests/PathSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ class PathSpec : XCTestCase {
private static func smallProp<A : Integer & Arbitrary>(_ pth : Path<A>) -> Bool {
return path({ x in
return (x >= -100 || -100 >= 0) && x <= 100
}, pth)
}, pth)
}

private static func largeProp<A : Integer & Arbitrary>(_ pth : Path<A>) -> Property {
return somePath({ x in
return (x < -1000000 || x > 1000000)
}, pth)
}, pth)
}

func testAll() {
Expand Down Expand Up @@ -97,5 +97,11 @@ class PathSpec : XCTestCase {
return PathSpec.largeProp(Path(unPath: x.unPath.map { $0.getLarge }))
}
}

#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
static var allTests = testCase([
("testAll", testAll),
])
#endif
}

Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,10 @@ class PropertySpec : XCTestCase {
return ((x ^&&^ y) ^||^ (x ^&&^ z) ^||^ (y.invert ^&&^ z)) == ((x ^&&^ y) ^||^ (y.invert ^&&^ z))
}
}

#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
static var allTests = testCase([
("testProperties", testProperties),
])
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ enum ExplicitRawIntValues : Int {
case two = 2
}

class RawRepresentableSpec: XCTestCase {
func testRepresentable() {
class RawRepresentableSpec : XCTestCase {
func testAll() {
property("only generates Foo, Bar, or Baz") <- forAll { (e: ImplicitRawValues) in
return [.foo, .bar, .baz].contains(e)
}
Expand All @@ -33,4 +33,10 @@ class RawRepresentableSpec: XCTestCase {
return [.zero, .one, .two].contains(e)
}
}

#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
static var allTests = testCase([
("testAll", testAll),
])
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SwiftCheck
import XCTest

class ReplaySpec : XCTestCase {
func testProperties() {
func testAll() {
property("Test is replayed at specific args") <- forAll { (seedl : Int, seedr : Int, size : Int) in
let replayArgs = CheckerArguments(replay: .some(StdGen(seedl, seedr), size))
var foundArgs : [Int] = []
Expand All @@ -28,4 +28,10 @@ class ReplaySpec : XCTestCase {
return foundArgs == foundArgs2
}
}

#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
static var allTests = testCase([
("testAll", testAll),
])
#endif
}
7 changes: 7 additions & 0 deletions Tests/RoseSpec.swift → Tests/SwiftCheckTests/RoseSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ class RoseSpec : XCTestCase {
}
}
}

#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
static var allTests = testCase([
("testAll", testAll),
("testLaws", testLaws),
])
#endif
}

struct RoseTreeOf<A : Arbitrary> : Arbitrary {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@ class ShrinkSpec : XCTestCase {
}
}
}

#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
static var allTests = testCase([
("testAll", testAll),
])
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,11 @@ class SimpleSpec : XCTestCase {
// !!!: for some reason this always gets a size of 0, so using mapSize as a hack to increase size
}.mapSize { $0 + 100 })
}
}

#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
static var allTests = testCase([
("testAll", testAll),
("testComposeWithMutableType", testComposeWithMutableType),
])
#endif
}
9 changes: 7 additions & 2 deletions Tests/TestSpec.swift → Tests/SwiftCheckTests/TestSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

import SwiftCheck
import class XCTest.XCTestCase
import XCTest

class TestSpec : XCTestCase {
func testAll() {
Expand Down Expand Up @@ -50,5 +50,10 @@ class TestSpec : XCTestCase {
}
}
}
}

#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
static var allTests = testCase([
("testAll", testAll),
])
#endif
}

0 comments on commit 5dec398

Please sign in to comment.