Skip to content

Commit

Permalink
Address test failures on Swift 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ikesyo committed Feb 8, 2019
1 parent 554beac commit 2de3b5d
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions Tests/NimbleTests/Matchers/BeCloseToTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
func testBeCloseToWithin() {
expect(1.2).to(beCloseTo(9.300, within: 10))

failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") {
expect(1.2).toNot(beCloseTo(1.2001, within: 1.0))
failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") {
expect(1.2).toNot(beCloseTo(1.2001, within: 1.1))
}
}

Expand All @@ -26,17 +26,17 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
expect(NSNumber(value: 1.2)).to(beCloseTo(NSNumber(value: 9.300), within: 10))
expect(1.2).to(beCloseTo(NSNumber(value: 9.300), within: 10))

failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") {
expect(NSNumber(value: 1.2)).toNot(beCloseTo(1.2001, within: 1.0))
failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") {
expect(NSNumber(value: 1.2)).toNot(beCloseTo(1.2001, within: 1.1))
}
}

func testBeCloseToWithCGFloat() {
expect(CGFloat(1.2)).to(beCloseTo(1.2001))
expect(CGFloat(1.2)).to(beCloseTo(CGFloat(1.2001)))

failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") {
expect(CGFloat(1.2)).toNot(beCloseTo(1.2001, within: 1.0))
failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") {
expect(CGFloat(1.2)).toNot(beCloseTo(1.2001, within: 1.1))
}
}

Expand Down Expand Up @@ -71,23 +71,23 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
expect(1.2) (9.300, 10)
expect(1.2) == (9.300, 10)

failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") {
expect(1.2) (1.0, 0.1)
failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") {
expect(1.3) (1.1, 0.1)
}
failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") {
expect(1.2) == (1.0, 0.1)
failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") {
expect(1.3) == (1.1, 0.1)
}
}

func testPlusMinusOperator() {
expect(1.2) 9.300 ± 10
expect(1.2) == 9.300 ± 10

failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") {
expect(1.2) 1.0 ± 0.1
failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") {
expect(1.3) 1.1 ± 0.1
}
failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") {
expect(1.2) == 1.0 ± 0.1
failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") {
expect(1.3) == 1.1 ± 0.1
}
}

Expand Down Expand Up @@ -132,11 +132,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
expect([0.0, 1.1, 2.2]) [0.0001, 1.1001, 2.2001]
expect([0.0, 1.1, 2.2]).to(beCloseTo([0.1, 1.2, 2.3], within: 0.1))

failsWithErrorMessage("expected to be close to <[0, 1]> (each within 0.0001), got <[0, 1.1]>") {
expect([0.0, 1.1]) [0.0, 1.0]
failsWithErrorMessage("expected to be close to <[0.1, 1.1]> (each within 0.0001), got <[0.1, 1.2]>") {
expect([0.1, 1.2]) [0.1, 1.1]
}
failsWithErrorMessage("expected to be close to <[0.2, 1.2]> (each within 0.1), got <[0, 1.1]>") {
expect([0.0, 1.1]).to(beCloseTo([0.2, 1.2], within: 0.1))
failsWithErrorMessage("expected to be close to <[0.3, 1.3]> (each within 0.1), got <[0.1, 1.2]>") {
expect([0.1, 1.2]).to(beCloseTo([0.3, 1.3], within: 0.1))
}
}
}

0 comments on commit 2de3b5d

Please sign in to comment.