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
Generated
+38
@@ -1536,6 +1536,22 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proptest"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8530004ccb15eae51c7e40009fbe317f341f804db54dc033eec1c50be28cfa0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"chacha20",
|
||||
"core_detect",
|
||||
"num-traits",
|
||||
"rand 0.10.4",
|
||||
"rand_xorshift",
|
||||
"regex-syntax",
|
||||
"unarray",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "qrcode"
|
||||
version = "0.14.1"
|
||||
@@ -1681,6 +1697,15 @@ dependencies = [
|
||||
"rand_core 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_xorshift"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60aa6af80be32871323012e02e6e65f8a7cc7890931ae421d217ad8fe0df2ccf"
|
||||
dependencies = [
|
||||
"rand_core 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "read-fonts"
|
||||
version = "0.39.2"
|
||||
@@ -1709,6 +1734,12 @@ dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6"
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.12.28"
|
||||
@@ -2587,6 +2618,12 @@ version = "1.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
|
||||
|
||||
[[package]]
|
||||
name = "unarray"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.18"
|
||||
@@ -2690,6 +2727,7 @@ dependencies = [
|
||||
"krilla",
|
||||
"lettre",
|
||||
"minijinja",
|
||||
"proptest",
|
||||
"qrcode",
|
||||
"reqwest",
|
||||
"ring",
|
||||
|
||||
Reference in new issue
Block a user