Property tests for what people paste and type; a one-letter given name
src/props.rs (proptest, 256 cases each, about 3 s of cargo test) holds the rules every input must keep: any text reads as a passport zone without a panic and two lines of zone characters always parse; a composed zone reads back field by field; OCR finds the zone among other lines in either order, in lower case and with spaces, and puts back digits read as letters in the dates; a Thai number with its check digit is valid and another check digit is not; same_name is symmetric and ignores order and case; a kept position and its Google Maps and OpenStreetMap links read back, a swapped pair is outside Thailand; a form date is in range and reads back; normalize is idempotent and blocks are never empty; a diff rebuilds both versions; any change to a journal entry changes its hash, also text moved between two fields; the PDF's line wrap keeps every letter and no line starts with a mark. Their first run found a bug: the photo reader dropped a one-letter given name, since a lone K, C, E or L in filler counts as a misread <. The letter right after the << between the names is now kept (unit test a_one_letter_given_name_is_kept; the shrunk cases are in proptest-regressions/props.txt). 50,000 cases each pass. proptest without fork and timeout (rust-version 1.88; the fleet builds with 1.95). AGENTS.md says when to add one, PLAN has the fuzzing steps.
This commit is contained in:
1 parent
62a37b677a
commit
7b5ec35e7c
9 files changed
+570
-1
No files matched your search
@@ -45,6 +45,14 @@ Lanna Desk (lannadesk.com, the app `visa`) holds passport data of real people. R
|
||||
- **Dates** are shown as "Nov 17, 2026" in Chiang Mai time (`src/dates.rs`);
|
||||
countries are ISO 3166-1 alpha-3 codes as in the passport's zone
|
||||
(`src/countries.rs`, generated by `scripts/gen_countries.py`).
|
||||
- **Property tests** (`src/props.rs`, proptest) hold the rules every input
|
||||
must keep: reading a pasted or photographed zone, a name, a position or a
|
||||
date never panics, a composed zone reads back, a diff rebuilds both
|
||||
versions, any change to a journal entry changes its hash. Code that reads
|
||||
what people paste or upload gets one there. A failure shrinks to the
|
||||
smallest input and lands in `proptest-regressions/`: commit that file with
|
||||
the fix, so every run tries the case first. `PROPTEST_CASES=50000 cargo
|
||||
test --lib props` looks harder than the default 256.
|
||||
- **Writing** for people (pages, docs) follows the house style: plain American
|
||||
English in whole sentences, no em dashes, "Nov 17, 2026" in tables.
|
||||
|
||||
@@ -92,3 +100,4 @@ and dark, at desktop and phone width, with `scripts/dev.sh` running.
|
||||
| `static/` | CSS and JavaScript, compiled in; the URL carries a content hash |
|
||||
| `migrations/` | SQL migrations, compiled in |
|
||||
| `tests/` | integration tests, one binary (`tests/main.rs` declares each file) |
|
||||
| `src/props.rs` | property tests (proptest); `proptest-regressions/` keeps the cases they found |
|
||||
Reference in new issue
Block a user