Skip to content

Commit e863c2e

Browse files
committed
More test instructions
1 parent 78bebfd commit e863c2e

File tree

1 file changed

+42
-4
lines changed

1 file changed

+42
-4
lines changed

README.md

+42-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ You'll need:
2323
- `npm run fmt` to auto-format code
2424
- `npm run check` to see TypeScript errors
2525

26-
The `tests` directory has some diff-based tests. `cd backend; cargo test
27-
--release` will run them. You'll need to follow the instructions below to
28-
ensure you have `bristol` and `strasbourg` areas set up.
29-
3026
### Faster local development
3127

3228
The tool operates on fixed study areas, generated from clips of OSM data.
@@ -60,6 +56,48 @@ for x in $AREAS; do
6056
done
6157
```
6258

59+
### Tests
60+
61+
(Don't spend too much time looking after these particular tests; they've been
62+
helpful to spot unexpected changes in calculating existing modal filters, but
63+
they're often just noisy when cell geometry slightly changes.)
64+
65+
The `tests` directory has some diff-based tests. `cd backend; cargo test
66+
--release` will run them. You'll need to follow the instructions above to
67+
ensure you have `bristol` and `strasbourg` areas set up. To accept the diffs,
68+
just commit the changed files.
69+
70+
There's a few ways to understand / verify the diffs.
71+
72+
First, you can manually try the tool
73+
[before](https://a-b-street.github.io/ltn/) and after (running locally). You
74+
can load a `.geojson` file from `tests/` as a project, then click the
75+
neighbourhood boundary (Bristol has two tests, Strasbourg just one). Then just
76+
visually compare things -- cells, shortcuts, and existing filters.
77+
78+
You can also try just diffing the output GeoJSON file as text. They're stored
79+
without pretty-printed newlines/indentation to save size in git, but you can do
80+
something like this to view, assuming you have `jq` and `meld` (or another diff
81+
tool):
82+
83+
```
84+
function json_diff {
85+
cat $1 | jq > /tmp/before.json
86+
git show HEAD^:./$1 | jq > /tmp/after.json
87+
meld /tmp/before.json /tmp/after.json
88+
}
89+
90+
cd tests/output
91+
json_diff bristol_west.geojson
92+
```
93+
94+
Finally, if you have the before and after output GeoJSON file (`json_diff`
95+
creates `/tmp/before.geojson` and `/tmp/after.geojson`), then you can try
96+
exploring in [GeoDiffr](https://dabreegster.github.io/geodiffr). You'll want to
97+
"remove unchanged features", then try to understand the remaining changes. This
98+
tool is not very sophisticated; it's only helpful sometimes when filters
99+
change, but it's less useful if big cell polygons change.
100+
63101
### Architecture
64102

65103
The Rust `backend` crate gets compiled to WASM, with generally type-unsafe APIs

0 commit comments

Comments
 (0)