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
@@ -0,0 +1,8 @@
|
||||
# Seeds for failure cases proptest has generated in the past. It is
|
||||
# automatically read and these particular cases re-run before any
|
||||
# novel cases are generated.
|
||||
#
|
||||
# It is recommended to check this file in to source control so that
|
||||
# everyone who runs the test benefits from these saved cases.
|
||||
cc d5095b55f5484851f94e5e5d75b898c01e0eb8b393f2b54c29f7e026ffb46721 # shrinks to z = Zone { state: "AAA", surname: "A", given: "K", number: "0", nationality: "AAA", born: 1927-01-01, sex: "F", expires: 2000-01-01 }, at = [23]
|
||||
cc 61a1971ea58fb2629e4ae7439568210b0c06aeca1f47104215a00e4d741049f3 # shrinks to z = Zone { state: "AAA", surname: "A", given: "C", number: "0", nationality: "AAA", born: 1927-01-01, sex: "F", expires: 2000-01-01 }, noise = [], swap = false, spaced = false
|
||||
Reference in new issue
Block a user