Created
November 14, 2017 10:47
-
-
Save SjoerdPerfors/30bc30d998d071be38dab1d4c3be237d to your computer and use it in GitHub Desktop.
Tests voor maxspeed in Belgie bij Bemobile server moet 120 terug geven.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func testMaxSpeedsForE19WithMaxSpeed30() { | |
//User got maxSpeed 100 which is incorrect. | |
let locationABefore = CLLocation.init(latitude: 51.01262, longitude: 4.45174) | |
var locationBBefore = CLLocation.init(latitude: 51.01008, longitude: 4.45346) | |
var course = locationABefore.headingForDirection(to: locationBBefore) | |
locationBBefore = CLLocation.init(coordinate: locationBBefore.coordinate, altitude: 0, horizontalAccuracy: 5, verticalAccuracy: 5, course: course, speed: 20, timestamp: Date.init()) | |
let locationCBefore = CLLocation.init(coordinate: CLLocation.init(latitude: 51.00784, longitude: 4.45479).coordinate, altitude: 0, horizontalAccuracy: 5, verticalAccuracy: 5, course: course, speed: 20, timestamp: Date.init()) | |
let locationDBefore = CLLocation.init(coordinate: CLLocation.init(latitude: 51.00611, longitude: 4.45612).coordinate, altitude: 0, horizontalAccuracy: 5, verticalAccuracy: 5, course: course, speed: 20, timestamp: Date.init()) | |
let locationEBefore = CLLocation.init(coordinate: CLLocation.init(latitude: 51.00365, longitude: 4.45814).coordinate, altitude: 0, horizontalAccuracy: 5, verticalAccuracy: 5, course: course, speed: 20, timestamp: Date.init()) | |
let expLocationBBefore = expectation(description: "expLocationBBefore") | |
ReverseGeocodingBeMobileManager.RetieveInfo(withLocation: locationBBefore, AndPreviousLocationCoordinate: locationABefore.coordinate) { (result : HuidigeWeg?) in | |
XCTAssertEqual(result?.maximumSpeed.intValue, 120) | |
XCTAssertEqual(result?.weg, "E19") | |
expLocationBBefore.fulfill() | |
} | |
let expLocationCBefore = expectation(description: "expLocationCBefore") | |
ReverseGeocodingBeMobileManager.RetieveInfo(withLocation: locationCBefore, AndPreviousLocationCoordinate: locationBBefore.coordinate) { (result : HuidigeWeg?) in | |
XCTAssertEqual(result?.maximumSpeed.intValue, 120) | |
XCTAssertEqual(result?.weg, "E19") | |
expLocationCBefore.fulfill() | |
} | |
let expLocationDBefore = expectation(description: "expLocationDBefore") | |
ReverseGeocodingBeMobileManager.RetieveInfo(withLocation: locationDBefore, AndPreviousLocationCoordinate: locationCBefore.coordinate) { (result : HuidigeWeg?) in | |
XCTAssertEqual(result?.maximumSpeed.intValue, 120) | |
XCTAssertEqual(result?.weg, "E19") | |
expLocationDBefore.fulfill() | |
} | |
let expLocationEBefore = expectation(description: "expLocationEBefore") | |
ReverseGeocodingBeMobileManager.RetieveInfo(withLocation: locationEBefore, AndPreviousLocationCoordinate: locationDBefore.coordinate) { (result : HuidigeWeg?) in | |
XCTAssertEqual(result?.maximumSpeed.intValue, 120) | |
//Road is unknown at this location, not really a big deal | |
expLocationEBefore.fulfill() | |
} | |
let locationA = CLLocation.init(latitude: 50.99693, longitude: 4.46371) | |
var locationB = CLLocation.init(latitude: 50.99546, longitude: 4.46489) | |
course = locationA.headingForDirection(to: locationB) | |
locationB = CLLocation.init(coordinate: locationB.coordinate, altitude: 0, horizontalAccuracy: 5, verticalAccuracy: 5, course: course, speed: 20, timestamp: Date.init()) | |
let locationC = CLLocation.init(coordinate: CLLocation.init(latitude: 50.99431, longitude: 4.46618).coordinate, altitude: 0, horizontalAccuracy: 5, verticalAccuracy: 5, course: course, speed: 20, timestamp: Date.init()) | |
let locationD = CLLocation.init(coordinate: CLLocation.init(latitude: 50.99336, longitude: 4.46732).coordinate, altitude: 0, horizontalAccuracy: 5, verticalAccuracy: 5, course: course, speed: 20, timestamp: Date.init()) | |
let locationE = CLLocation.init(coordinate: CLLocation.init(latitude: 50.99261, longitude: 4.46852).coordinate, altitude: 0, horizontalAccuracy: 5, verticalAccuracy: 5, course: course, speed: 20, timestamp: Date.init()) | |
let locationF = CLLocation.init(coordinate: CLLocation.init(latitude: 50.99182, longitude: 4.46964).coordinate, altitude: 0, horizontalAccuracy: 5, verticalAccuracy: 5, course: course, speed: 20, timestamp: Date.init()) | |
let locationG = CLLocation.init(coordinate: CLLocation.init(latitude: 50.99107, longitude: 4.47088).coordinate, altitude: 0, horizontalAccuracy: 5, verticalAccuracy: 5, course: course, speed: 20, timestamp: Date.init()) | |
let locationH = CLLocation.init(coordinate: CLLocation.init(latitude: 50.99000, longitude: 4.47273).coordinate, altitude: 0, horizontalAccuracy: 5, verticalAccuracy: 5, course: course, speed: 20, timestamp: Date.init()) | |
let expLocationB = expectation(description: "locationB") | |
ReverseGeocodingBeMobileManager.RetieveInfo(withLocation: locationB, AndPreviousLocationCoordinate: locationA.coordinate) { (result : HuidigeWeg?) in | |
XCTAssertEqual(result?.maximumSpeed.intValue, 120) | |
XCTAssertEqual(result?.weg, "E19") | |
expLocationB.fulfill() | |
} | |
let expLocationC = expectation(description: "expLocationC") | |
ReverseGeocodingBeMobileManager.RetieveInfo(withLocation: locationC, AndPreviousLocationCoordinate: locationB.coordinate) { (result : HuidigeWeg?) in | |
XCTAssertEqual(result?.maximumSpeed.intValue, 120) | |
XCTAssertEqual(result?.weg, "E19") | |
expLocationC.fulfill() | |
} | |
let expLocationD = expectation(description: "expLocationD") | |
ReverseGeocodingBeMobileManager.RetieveInfo(withLocation: locationD, AndPreviousLocationCoordinate: locationC.coordinate) { (result : HuidigeWeg?) in | |
XCTAssertEqual(result?.maximumSpeed.intValue, 120) | |
XCTAssertEqual(result?.weg, "E19") | |
expLocationD.fulfill() | |
} | |
let expLocationE = expectation(description: "expLocationE") | |
ReverseGeocodingBeMobileManager.RetieveInfo(withLocation: locationE, AndPreviousLocationCoordinate: locationD.coordinate) { (result : HuidigeWeg?) in | |
XCTAssertEqual(result?.maximumSpeed.intValue, 120) | |
XCTAssertEqual(result?.weg, "E19") | |
expLocationE.fulfill() | |
} | |
let expLocationF = expectation(description: "expLocationF") | |
ReverseGeocodingBeMobileManager.RetieveInfo(withLocation: locationF, AndPreviousLocationCoordinate: locationE.coordinate) { (result : HuidigeWeg?) in | |
XCTAssertEqual(result?.maximumSpeed.intValue, 120) | |
XCTAssertEqual(result?.weg, "E19") | |
expLocationF.fulfill() | |
} | |
let expLocationG = expectation(description: "expLocationG") | |
ReverseGeocodingBeMobileManager.RetieveInfo(withLocation: locationG, AndPreviousLocationCoordinate: locationF.coordinate) { (result : HuidigeWeg?) in | |
XCTAssertEqual(result?.maximumSpeed.intValue, 120) | |
XCTAssertEqual(result?.weg, "E19") | |
expLocationG.fulfill() | |
} | |
let expLocationH = expectation(description: "expLocationH") | |
ReverseGeocodingBeMobileManager.RetieveInfo(withLocation: locationH, AndPreviousLocationCoordinate: locationG.coordinate) { (result : HuidigeWeg?) in | |
XCTAssertEqual(result?.maximumSpeed.intValue, 120) | |
XCTAssertEqual(result?.weg, "E19") | |
expLocationH.fulfill() | |
} | |
waitForExpectations(timeout: 10, handler: nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment