holyturt / SwiftOverpassWrapper

A wrapper of the Overpass API for Swift.
MIT License
16 stars 2 forks source link

Add unit tests for XML entity parsers #5

Closed wtimme closed 6 years ago

wtimme commented 6 years ago

This branch adds unit tests for XML parsers by moving the logic to dedicated categories and adding test XML files. It furthermore improves the readability in a couple of places by preferring guard statements over force-unwrapping optionals.

For the commonly shared properties id and tags, I've added superclass OverpassEntity that all entities (nodes, ways and relations) inherit from. I'm not sure whether this is the best approach and would like to get feedback and am very open for suggestions. 👍🏼

holyturt commented 6 years ago

Thank you, @wtimme! This PR is amazing. Separating basic data into OverpassEntity increases simplicity. The OverpassResponse.swift's number of lines are reduced almost by half! And the unit tests are great as well! Good job! 👏