Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap Search Configs #238

Merged
merged 8 commits into from
Mar 24, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions ios-sdk.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@
7D9EBCD51E6E0CA200303E1B /* building-grid.gif in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7D9EBBE21E6DFBAF00303E1B /* building-grid.gif */; };
7D9EBCD81E6E0D9B00303E1B /* [email protected] in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7D9EBC171E6DFBAF00303E1B /* [email protected] */; };
7D9EBCDA1E6E0D9B00303E1B /* [email protected] in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7D9EBC351E6DFBAF00303E1B /* [email protected] */; };
7DB181401E81B472001F9B49 /* MapzenAutocompleteConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB1813A1E81B472001F9B49 /* MapzenAutocompleteConfig.swift */; };
7DB181411E81B472001F9B49 /* MapzenPlaceConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB1813B1E81B472001F9B49 /* MapzenPlaceConfig.swift */; };
7DB181421E81B472001F9B49 /* MapzenReverseConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB1813C1E81B472001F9B49 /* MapzenReverseConfig.swift */; };
7DB181431E81B472001F9B49 /* MapzenSearchConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB1813D1E81B472001F9B49 /* MapzenSearchConfig.swift */; };
7DB181441E81B472001F9B49 /* MapzenSearchDataConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB1813E1E81B472001F9B49 /* MapzenSearchDataConverter.swift */; };
7DB181451E81B472001F9B49 /* MapzenSearchDataObjects.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB1813F1E81B472001F9B49 /* MapzenSearchDataObjects.swift */; };
7DB181491E81B681001F9B49 /* MapzenResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB181481E81B681001F9B49 /* MapzenResponse.swift */; };
7DB1814B1E81B708001F9B49 /* MapzenAutocompleteConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB1814A1E81B708001F9B49 /* MapzenAutocompleteConfigTests.swift */; };
7DB1814D1E81B718001F9B49 /* MapzenPlaceConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB1814C1E81B718001F9B49 /* MapzenPlaceConfigTests.swift */; };
7DB1814F1E81B723001F9B49 /* MapzenReverseConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB1814E1E81B723001F9B49 /* MapzenReverseConfigTests.swift */; };
7DB181511E81B72F001F9B49 /* MapzenSearchConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB181501E81B72F001F9B49 /* MapzenSearchConfigTests.swift */; };
7DB181531E81B73A001F9B49 /* MapzenSearchDataConverterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB181521E81B73A001F9B49 /* MapzenSearchDataConverterTests.swift */; };
7DB181551E81B745001F9B49 /* MapzenSearchDataObjectsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB181541E81B745001F9B49 /* MapzenSearchDataObjectsTests.swift */; };
7DB181571E81B77B001F9B49 /* MapzenResponseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB181561E81B77B001F9B49 /* MapzenResponseTests.swift */; };
7DC7F0941E70C26B009E722B /* TestLocationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC7F0931E70C26B009E722B /* TestLocationManager.swift */; };
7DC7F0981E71E138009E722B /* TestAnnotationTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC7F0971E71E138009E722B /* TestAnnotationTarget.swift */; };
7DC7F09A1E7204BE009E722B /* MapzenManagerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC7F0991E7204BE009E722B /* MapzenManagerExtensions.swift */; };
Expand Down Expand Up @@ -118,6 +132,20 @@
7D9EBC421E6DFBAF00303E1B /* walkabout-style-more-labels.yaml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "walkabout-style-more-labels.yaml"; sourceTree = "<group>"; };
7D9EBC511E6DFBAF00303E1B /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
7D9EBC5C1E6DFBAF00303E1B /* zinc-style-more-labels.yaml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "zinc-style-more-labels.yaml"; sourceTree = "<group>"; };
7DB1813A1E81B472001F9B49 /* MapzenAutocompleteConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapzenAutocompleteConfig.swift; sourceTree = "<group>"; };
7DB1813B1E81B472001F9B49 /* MapzenPlaceConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapzenPlaceConfig.swift; sourceTree = "<group>"; };
7DB1813C1E81B472001F9B49 /* MapzenReverseConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapzenReverseConfig.swift; sourceTree = "<group>"; };
7DB1813D1E81B472001F9B49 /* MapzenSearchConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapzenSearchConfig.swift; sourceTree = "<group>"; };
7DB1813E1E81B472001F9B49 /* MapzenSearchDataConverter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapzenSearchDataConverter.swift; sourceTree = "<group>"; };
7DB1813F1E81B472001F9B49 /* MapzenSearchDataObjects.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapzenSearchDataObjects.swift; sourceTree = "<group>"; };
7DB181481E81B681001F9B49 /* MapzenResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapzenResponse.swift; sourceTree = "<group>"; };
7DB1814A1E81B708001F9B49 /* MapzenAutocompleteConfigTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapzenAutocompleteConfigTests.swift; sourceTree = "<group>"; };
7DB1814C1E81B718001F9B49 /* MapzenPlaceConfigTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapzenPlaceConfigTests.swift; sourceTree = "<group>"; };
7DB1814E1E81B723001F9B49 /* MapzenReverseConfigTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapzenReverseConfigTests.swift; sourceTree = "<group>"; };
7DB181501E81B72F001F9B49 /* MapzenSearchConfigTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapzenSearchConfigTests.swift; sourceTree = "<group>"; };
7DB181521E81B73A001F9B49 /* MapzenSearchDataConverterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapzenSearchDataConverterTests.swift; sourceTree = "<group>"; };
7DB181541E81B745001F9B49 /* MapzenSearchDataObjectsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapzenSearchDataObjectsTests.swift; sourceTree = "<group>"; };
7DB181561E81B77B001F9B49 /* MapzenResponseTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapzenResponseTests.swift; sourceTree = "<group>"; };
7DC7F0931E70C26B009E722B /* TestLocationManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestLocationManager.swift; sourceTree = "<group>"; };
7DC7F0971E71E138009E722B /* TestAnnotationTarget.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestAnnotationTarget.swift; sourceTree = "<group>"; };
7DC7F0991E7204BE009E722B /* MapzenManagerExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapzenManagerExtensions.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -390,13 +418,26 @@
7D7D49941E7709A1006074EB /* TestUrlSession.swift */,
7D7D49921E7708E5006074EB /* TestSessionDataTask.swift */,
7D503BCF1E78944300FDDC4F /* TestTGMarkerPickResult.swift */,
7DB1814A1E81B708001F9B49 /* MapzenAutocompleteConfigTests.swift */,
7DB1814C1E81B718001F9B49 /* MapzenPlaceConfigTests.swift */,
7DB1814E1E81B723001F9B49 /* MapzenReverseConfigTests.swift */,
7DB181501E81B72F001F9B49 /* MapzenSearchConfigTests.swift */,
7DB181521E81B73A001F9B49 /* MapzenSearchDataConverterTests.swift */,
7DB181541E81B745001F9B49 /* MapzenSearchDataObjectsTests.swift */,
7DB181561E81B77B001F9B49 /* MapzenResponseTests.swift */,
);
path = "ios-sdkTests";
sourceTree = "<group>";
};
DBC84EA51C985B6D00EE80D8 /* src */ = {
isa = PBXGroup;
children = (
7DB1813A1E81B472001F9B49 /* MapzenAutocompleteConfig.swift */,
7DB1813B1E81B472001F9B49 /* MapzenPlaceConfig.swift */,
7DB1813C1E81B472001F9B49 /* MapzenReverseConfig.swift */,
7DB1813D1E81B472001F9B49 /* MapzenSearchConfig.swift */,
7DB1813E1E81B472001F9B49 /* MapzenSearchDataConverter.swift */,
7DB1813F1E81B472001F9B49 /* MapzenSearchDataObjects.swift */,
7D7847231E6775EA000D56CA /* dimensions */,
DBC869911D3663C700DDC4FE /* PeliasMapkitExtensions.swift */,
DB70FEA81DE3425800249509 /* MapViewController.swift */,
Expand All @@ -407,6 +448,7 @@
7D2FB7661E6103D500CB82CF /* DictionaryExtensions.swift */,
7D7DAE201E60EEA300FFCA6F /* ApplicationExtensions.swift */,
7DC7F0991E7204BE009E722B /* MapzenManagerExtensions.swift */,
7DB181481E81B681001F9B49 /* MapzenResponse.swift */,
);
path = src;
sourceTree = "<group>";
Expand Down Expand Up @@ -629,26 +671,33 @@
buildActionMask = 2147483647;
files = (
DBFB759F1E2046D100CF6173 /* TangramExtensions.swift in Sources */,
7DB181421E81B472001F9B49 /* MapzenReverseConfig.swift in Sources */,
7DB181491E81B681001F9B49 /* MapzenResponse.swift in Sources */,
DBFB759D1E20345500CF6173 /* SearchPinsViewController.swift in Sources */,
7D7DAE211E60EEA300FFCA6F /* ApplicationExtensions.swift in Sources */,
7D7847251E6775EA000D56CA /* Dimensions.swift in Sources */,
DB188EEA1E2846600054DEFD /* MapzenManager.swift in Sources */,
DBF441AE1D351B0A007DEE95 /* TangramVC.swift in Sources */,
7DB181431E81B472001F9B49 /* MapzenSearchConfig.swift in Sources */,
DB22E59E1DA473CA004264E0 /* RouteDirectionCell.swift in Sources */,
DB5B31511DE4A173005EB816 /* LocationManager.swift in Sources */,
DBC869921D3663C700DDC4FE /* PeliasMapkitExtensions.swift in Sources */,
DB188EEE1E290D310054DEFD /* MapzenRoutingController.swift in Sources */,
DB70FEA91DE3425800249509 /* MapViewController.swift in Sources */,
7DB181411E81B472001F9B49 /* MapzenPlaceConfig.swift in Sources */,
7D503BCC1E77457A00FDDC4F /* SampleMapViewController.swift in Sources */,
7DB181451E81B472001F9B49 /* MapzenSearchDataObjects.swift in Sources */,
DB22E59A1DA45D73004264E0 /* RoutingSearchVC.swift in Sources */,
DBBF368B1D64DA6A0069D769 /* RoutingViewController.swift in Sources */,
7DC7F09A1E7204BE009E722B /* MapzenManagerExtensions.swift in Sources */,
7D2FB7671E6103D500CB82CF /* DictionaryExtensions.swift in Sources */,
7DB181401E81B472001F9B49 /* MapzenAutocompleteConfig.swift in Sources */,
DB188EF01E2C44F40054DEFD /* RouteDisplayViewController.swift in Sources */,
7D503BCE1E77468B00FDDC4F /* SampleTableViewController.swift in Sources */,
DB22E59C1DA46640004264E0 /* RoutingResultTableVC.swift in Sources */,
DBC869901D3662DD00DDC4FE /* AutocompleteTableVC.swift in Sources */,
DB7A33D81C8F8E8B009CC743 /* AppDelegate.swift in Sources */,
7DB181441E81B472001F9B49 /* MapzenSearchDataConverter.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -658,16 +707,23 @@
files = (
7D7DAE1D1E60C5C900FFCA6F /* TestApplication.swift in Sources */,
7DC7F0941E70C26B009E722B /* TestLocationManager.swift in Sources */,
7DB181511E81B72F001F9B49 /* MapzenSearchConfigTests.swift in Sources */,
7DB1814F1E81B723001F9B49 /* MapzenReverseConfigTests.swift in Sources */,
7DC7F0981E71E138009E722B /* TestAnnotationTarget.swift in Sources */,
7DB181551E81B745001F9B49 /* MapzenSearchDataObjectsTests.swift in Sources */,
7DF0AA2E1E5520ED00B0406E /* TestTGMapViewController.swift in Sources */,
7DB181571E81B77B001F9B49 /* MapzenResponseTests.swift in Sources */,
7DB1814D1E81B718001F9B49 /* MapzenPlaceConfigTests.swift in Sources */,
DB188EEC1E28492A0054DEFD /* MapzenManagerTests.swift in Sources */,
7DC7F09C1E72066B009E722B /* TestMapzenManager.swift in Sources */,
7D7D49951E7709A1006074EB /* TestUrlSession.swift in Sources */,
7DC7F0A21E770443009E722B /* MapzenRoutingControllerTests.swift in Sources */,
7D503BD01E78944300FDDC4F /* TestTGMarkerPickResult.swift in Sources */,
7DB181531E81B73A001F9B49 /* MapzenSearchDataConverterTests.swift in Sources */,
DBCBC5BF1E0AE1CF0045B345 /* MapViewControllerTests.swift in Sources */,
7D2FB7691E64E66B00CB82CF /* DictionaryExtensionsTests.swift in Sources */,
7D7D49931E7708E5006074EB /* TestSessionDataTask.swift in Sources */,
7DB1814B1E81B708001F9B49 /* MapzenAutocompleteConfigTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
24 changes: 24 additions & 0 deletions ios-sdkTests/MapzenAutocompleteConfigTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// MapzenAutocompleteConfigTests.swift
// ios-sdk
//
// Created by Sarah Lensing on 3/21/17.
// Copyright © 2017 Mapzen. All rights reserved.
//

import XCTest
@testable import ios_sdk

class MapzenAutocompleteConfigTests: XCTestCase {

var config: MapzenAutocompleteConfig = MapzenAutocompleteConfig.init(searchText: "test", focusPoint: MzGeoPoint.init(latitude: 70.0, longitude: 40.0), completionHandler: { (response) in })

func testFocusPointIsCorrect() {
XCTAssertEqual(MzGeoPoint(latitude: 70.0, longitude: 40.0), config.focusPoint)
}

func testSearchTestIsCorrect() {
XCTAssertEqual("test", config.searchText)
}

}
20 changes: 20 additions & 0 deletions ios-sdkTests/MapzenPlaceConfigTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// MapzenPlaceConfigTests.swift
// ios-sdk
//
// Created by Sarah Lensing on 3/21/17.
// Copyright © 2017 Mapzen. All rights reserved.
//

import XCTest
@testable import ios_sdk

class MapzenPlaceConfigTests: XCTestCase {

var config: MapzenPlaceConfig = MapzenPlaceConfig.init(places: [MzPlaceQueryItem.init(placeId: "123", dataSource: .openStreetMap, layer: .address)], completionHandler: { (response) in })

func testPlacesAreCorrect() {
XCTAssertEqual(config.places.count, 1)
XCTAssertEqual(MzPlaceQueryItem.init(placeId: "123", dataSource: .openStreetMap, layer: .address), config.places.first)
}
}
43 changes: 43 additions & 0 deletions ios-sdkTests/MapzenResponseTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// MapzenResponseTests.swift
// ios-sdk
//
// Created by Sarah Lensing on 3/21/17.
// Copyright © 2017 Mapzen. All rights reserved.
//

import XCTest
@testable import ios_sdk
import Pelias

class MapzenResponseTests: XCTestCase {
let data = Data()
let urlResponse = URLResponse()
let error = NSError(domain:"Test", code: 1, userInfo: nil)
var response: MapzenResponse?

override func setUp() {
response = MapzenResponse(PeliasResponse(data: data, response: urlResponse, error: error))
}

func testData() {
XCTAssertEqual(response?.peliasResponse.data, data)
XCTAssertEqual(response?.data, data)
}

func testResponse() {
XCTAssertEqual(response?.peliasResponse.response, urlResponse)
XCTAssertEqual(response?.response, urlResponse)
}

func testError() {
let error = NSError(domain:"Test", code: 1, userInfo: nil)
XCTAssertEqual(response?.peliasResponse.error, error)
XCTAssertEqual(response?.error, error)
}

func testEquals() {
let otherResponse = MapzenResponse(PeliasResponse(data: Data(), response: urlResponse, error: NSError(domain:"Test", code: 1, userInfo: nil)))
XCTAssertEqual(response, otherResponse)
}
}
39 changes: 39 additions & 0 deletions ios-sdkTests/MapzenReverseConfigTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// MapzenReverseConfigTests.swift
// ios-sdk
//
// Created by Sarah Lensing on 3/21/17.
// Copyright © 2017 Mapzen. All rights reserved.
//

import XCTest
@testable import ios_sdk

class MapzenReverseConfigTests: XCTestCase {

var config: MapzenReverseConfig = MapzenReverseConfig.init(point: MzGeoPoint.init(latitude: 70.0, longitude: 40.0), completionHandler: { (response) in })

func testPointIsCorrect() {
XCTAssertEqual(MzGeoPoint(latitude: 70.0, longitude: 40.0), config.point)
}

func testNumOfResults() {
config.numberOfResults = 8
XCTAssertEqual(8, config.numberOfResults)
}

func testBoundaryCountry() {
config.boundaryCountry = "US"
XCTAssertEqual("US", config.boundaryCountry)
}

func testDataSources() {
config.dataSources = [.geoNames, .openAddresses]
XCTAssertEqual([.geoNames, .openAddresses], config.dataSources!)
}

func testLayers() {
config.layers = [.address, .country]
XCTAssertEqual([.address, .country], config.layers!)
}
}
57 changes: 57 additions & 0 deletions ios-sdkTests/MapzenSearchConfigTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// MapzenSearchConfigTests.swift
// ios-sdk
//
// Created by Sarah Lensing on 3/21/17.
// Copyright © 2017 Mapzen. All rights reserved.
//

import XCTest
@testable import ios_sdk

class MapzenSearchConfigTests: XCTestCase {

var config: MapzenSearchConfig = MapzenSearchConfig.init(searchText: "test", completionHandler: { (response) in })

func testSearchTextIsCorrect() {
XCTAssertEqual("test", config.searchText)
}

func testNumOfResults() {
config.numberOfResults = 8
XCTAssertEqual(8, config.numberOfResults)
}

func testBoundaryCountry() {
config.boundaryCountry = "US"
XCTAssertEqual("US", config.boundaryCountry)
}

func testBoundaryRect() {
let rect = MzSearchRect(minLatLong: MzGeoPoint(latitude: 70.0, longitude: 40.0), maxLatLong: MzGeoPoint(latitude: 75.0, longitude: 40.0))
config.boundaryRect = rect
XCTAssertEqual(rect, config.boundaryRect)
}

func testBoundaryCircle() {
let circle = MzSearchCircle(center: MzGeoPoint(latitude: 70.0, longitude: 40.0), radius: 10)
config.boundaryCircle = circle
XCTAssertEqual(circle, config.boundaryCircle)
}

func testFocusPoint() {
let point = MzGeoPoint(latitude: 70.0, longitude: 40.0)
config.focusPoint = point
XCTAssertEqual(point, config.focusPoint)
}

func testDataSources() {
config.dataSources = [.geoNames, .openAddresses]
XCTAssertEqual([.geoNames, .openAddresses], config.dataSources!)
}

func testLayers() {
config.layers = [.address, .country]
XCTAssertEqual([.address, .country], config.layers!)
}
}
Loading