tests/> cargo test --release
This is a collection of test cases for osm2streets. Each test case has a directory with:
input.osm
, from the export tab of https://www.openstreetmap.org or saved from JOSMtest.json
, defining thedriving_side
and describing the situationgeometry.json
e.g., a GeoJSON of theStreetNetwork
road and intersection polygons
The outputs here are current implementations, not gold standards (though we could add some of them). Use them to observe your changes as you work. (more coming soon...)
Install Rust, then:
git clone https://github.com/a-b-street/osm2streets
cd osm2streets/tests
cargo test --release
You can also omit --release
for faster compilation, but slower running. Each
test case is expensive enough to justify release mode.
Use the street-explorer
web app to view and inspect the test output. If you've made changes locally and want to compare to the current output in the main
branch, use http://osm2streets.org.
When you work on the osm2streets code or related dependencies, there might be an effect on the test case output. When there's a difference, you can generate the new GeoJSON file, manually view the old and new version, and decide if the changes are acceptable or not.
- Run
cargo test --release
to test your current changes - Manually verify any diffs using
street-explorer
. Commit the ones that are intentional. - Push your changes
If you identify an interesting situation in OSM that isn't similar to an existing test case, please add it!
- Go to https://a-b-street.github.io/osm2streets/
- Navigate to the area of interest
- Press
Download osm.xml
- Create a new directory in
src
. The naming scheme is not very organized yet. - Put your OSM XML file in that directory as
input.osm
- Copy a
test.json
file from another directory and modify accordingly. Thenotes
are free-form, but please at least include a useful link to OSM to view the area there. - Run
cargo test --release
. It will fail with something likesrc/montlake_roundabout/geometry.json has changed.
- Add the new
geometry.json
file to git after viewing it withstreet-explorer
- You can re-run
cargo test --release
to verify things now pass. - Push!
How large should the input OSM area be? Enough to cover whatever you want to
test, but otherwise minimal to not bloat the size of this repository. See
existing test cases for examples. Note that osm2streets
will clip roads that
extend out of the bounding box and generate special "map edge" intersections
along the edges.