Skip to content

Vocabulary

proptastic is one library in several languages, and it uses the same words in each: a property written in Java reads like one written in Rust, and a failure says the same things. So what you learn in one carries over, and a team that uses two languages tests both the same way.

The words are kept in a contract, which each edition’s tests check its API against. These tables are read from it. Each language writes a word in its own casing, forAll or for_all, and that counts as the same word.

Starting a property, and its domains

JavaRust pendingSwift plannedWhat it does
forAllfor_allforAllstart a property, one draw per domain
domaindomaindomaina custom domain: combined from domains and a constructor, or named with a source
anyanyanya domain found from a type: each scalar from its word, a sum type's variants in declaration order (decision 84)
integersintegersintegersintegers
doublesdoublesdoublesfloating-point numbers
booleansbooleansbooleansbooleans
stringsstringsstringsstrings
listslistslistslists, the language's native type
setssetssetssets, the language's native type
mapsmapsmapsmaps, the language's native type
optionalsoptionalsoptionalsoptional values, the language's native type
elementselementselementsone of the values given
oneOfone_ofoneOfa value from one of the domains given
weightedweightedweighteda domain weighing more or less in a oneOf: drawn in proportion to its weight, an unweighted part weighing 1
stepsstepsstepsstart a stateful test: the state each try starts from, then its steps; or steps as values of one type (a record, an enum), each a value of one domain taken by one function
leanleanleana model built by Lean's Lake: by its name, the program Lake built in models/lean; or the executable in a project at a path
commandcommandcommanda model in any language: an executable that speaks the model protocol
specspecspeca TLA+ spec a stateful test follows: the state graph TLC checked, every next state it allows, or, with no graph, each step judged by TLC (decision 110); by its name, the graph in models/tla
recordrecordrecordinside a step: what the step saw, which the steps one at a time must give too, in some order, when they run on threads; anywhere else it does nothing
locklocklocka named lock for the state of steps run on threads: taking it is a point where another thread may run, a thread asking for it while another holds it waits, and a deadlock is found and named; a plain lock anywhere else
threadthreadthreadone thread's steps, in order, pinning steps run on threads for .example: one thread(…) for each thread
firstfirstfirstthe steps taken on one thread before the threads start, pinning steps run on threads for .example, before the thread(…)s (decision 109)
handleshandleshandlesvalues steps make that later steps use, named for what they are: in an argument's place they draw one the run kept and hasn't dropped (decision 105)
handlehandlehandlethe nth value a run's handles of a name kept, as a step's argument in a pin: handle("account", 1) (decision 105)
fromStatefrom_statefromStatea step's argument from a domain the state gives, as it is when the run reaches the step, its precondition checked first (decision 106)
datesdatesdatescalendar dates in the language's own date type, 1900-01-01 to 2100-12-31 unless bounded, about one try in five on a calendar edge; a failure shrinks toward Monday 2001-01-01, or the allowed day nearest it (decisions 79 and 80)
timestimestimestimes of day, whole seconds mostly and fractions sometimes; a failure shrinks toward midnight (decision 81)
dateTimesdate_timesdateTimesa date and a time of day with no zone, drawn as a date and a time; a failure shrinks toward 2001-01-01T00:00 (decision 81)
instantsinstantsinstantsmoments, in UTC, in the dates' window; a failure shrinks toward 2001-01-01T00:00:00Z (decision 81)
durationsdurationsdurationssigned lengths of time, edges at zero, one unit, a day, 23 and 25 hours; a failure shrinks toward zero (decision 81)
offsetsoffsetsoffsetsfixed UTC offsets, edges at half and quarter hours and the extremes; a failure shrinks toward UTC (decision 81)
zoneszoneszonesregion zones from calendar.zones, UTC first; in .inZones(zones()) a zone's transitions are edges, and a failure names the tz database's version (decision 91) (the zones module)
luhnNumbersluhn_numbersluhnNumbersLuhn numbers, 12 to 19 digits and their check digit; .mistyped() for ones a digit off (decision 98) (the identifiers module)
ibansibansibansIBANs with their mod-97 check digits, from countries whose account numbers carry no check of their own (decision 98) (the identifiers module)
isinsisinsisinsISINs: a country, nine letters or digits and the Luhn check digit (decision 98) (the identifiers module)
isbnsisbnsisbnsISBN-13s with their check digit (decision 98) (the identifiers module)
ipAddressesip_addressesipAddressesIP addresses, version 4 first, edges at loopback, private, link-local and the version 6 forms; a failure shrinks toward 0.0.0.0 (decision 94) (provisional) (the internet module)
domainsdomainsdomainsRFC 1123 host names under common top-level domains, or the test's own; a failure shrinks toward a.com (decision 94) (provisional) (the internet module)
emailsemailsemailsemail addresses both RFC 5322's dot-atom and HTML accept; a failure shrinks toward [email protected] (decision 94) (provisional) (the internet module)
urlsurlsurlsabsolute http and https URLs a WHATWG parser leaves as they are; a failure shrinks toward https://a.com/ (decision 94) (provisional) (the internet module)
decimalsdecimalsdecimalsexact decimal numbers, an unscaled whole number and a scale; a failure shrinks toward zero, then toward fewer places (decision 82)
uuidsuuidsuuidsUUIDs of version 4 and 7, their version and variant set by construction; a failure shrinks toward the one whose drawn bits are all zero (decision 82)
floatsfloatsfloats32-bit floating-point numbers, the language's own, by doubles()'s laws in their own range, NaN, the infinities, -0.0 and the smallest subnormal among them unbounded (decision 88)
bytesbytesbytesbyte strings, the language's own, edges empty, all zero and all 0xFF (decision 88)
bigIntegersbig_integersbigIntegersarbitrary-precision integers, the i128 range unless bounded, written as 64-bit choices (decisions 87 and 88)

On a property

JavaRust pendingSwift plannedWhat it does
checkcheckcheckrun it now; throws or panics with the shrunk counterexample
exampleexampleexamplepin one example, a value per draw
examplesexamplesexamplespin many examples from a collection
viaviaviawhere the example before it came from
triestriestriesthe number of tries
exhaustivelyexhaustivelyexhaustivelyevery value the draws can take, once each, in place of random tries (decision 47)
seedseedseedthe seed
idididthe key of a property's corpus, so renaming the test keeps its entries
followsfollowsfollowsrun the property against a model: the code's answer must be one the model allows, and every outcome the model names must come up
unreachableunreachableunreachablean outcome of the model the draws can't reach, and why: printed, and a failure if it comes up
allowallowallowa health check that's fine for this property, and why: it isn't made (decision 46)
threadsthreadsthreadsrun a stateful test's steps on several threads at once, sharing one state: every schedule within the bound, switching threads only at points proptastic sees; it fails on a deadlock, a thread stuck elsewhere, a broken invariant, a step's own failure, or answers that no order of the steps, one at a time, gives

Inside a check

JavaRust pendingSwift plannedWhat it does
assumeassumeassumeskip a try unless a condition holds (how to use it)
classifyclassifyclassifylabel a try, for the distribution report
targettargettargetscore a try, for the run to climb toward higher scores (decision 62)
requirerequirerequirelabel a try and ask for a share of tries: the run fails when the label is surely rarer, and says it is incomplete when the tries can't tell (decisions 45 and 107)
keepkeepkeepinside a step: keeps a value the step made, for later steps to draw, and returns it (decision 105)
dropdropdropinside a step: the step is done with a value kept, so no later step draws it (decision 105)

On a domain

JavaRust pendingSwift plannedWhat it does
edgesedgesedgesedge values of your own, drawn one try in 8 on top of the domain's own
writtenAswritten_aswrittenAshow to write the domain's values as source, for a type the edition can't write itself, so a pin line pins the value, not the seed; draws exactly as the domain does (decision 95)
fromfromfroma string domain's alphabet, or several alphabets one after another: their characters only, each as likely, the first the simplest; strings.alphabets names the common ones (decision 96)
matchingmatchingmatchingstrings a regular expression matches in full, in the language's own syntax (decision 41)
finitefinitefinitea floating-point domain without NaN, the infinities, -0.0 and the smallest subnormal, which unbounded it draws one try in 16
withwithwitha by-type domain's field given a domain of its own, named as the edition names a field (Java its accessor), wherever its type is drawn
mapmapmaptransform each value
filterfilterfilterkeep only the values that pass
flatMapflat_mapflatMapa dependent value: one value decides another's domain
ofSizeof_sizeofSizea collection's size, exact or between bounds
ofLengthof_lengthofLengtha string's length, exact or between bounds
averageSizeaverage_sizeaverageSizea collection's average size, within its bounds
averageLengthaverage_lengthaverageLengtha string's average length in code points, within its bounds
nonEmptynon_emptynonEmptya size or length of at least 1
nonBlanknon_blanknonBlankstrings with at least one character outside strings.whitespace, built so, never filtered: a string drawn all whitespace has one place drawn again from the rest (decision 96)
singleLinesingle_linesingleLinestrings with no character of strings.lineBreaks, left out by index, never filtered (decision 96)
mistypedmistypedmistypedan identifier with one character typed wrong, which its check catches (decision 98) (the identifiers module)
excludingexcludingexcludingvalues left out of any domain, by equality: stepped over by index where the domain draws by index (whole numbers, elements, dates), else rejected as a filter rejects (decision 92); on dates also days of the week, a set of dates, or those a function names, drawn by index, never filtered (decision 79)
ononononly dates on the days of the week given, drawn by index, never filtered (decision 79)
everyeveryeverytimes, date-times or instants on a grid of one step only, counted from midnight (decision 81)
inZonesin_zonesinZonesa date-time placed in a zone drawn from the domain given; a region zone's transitions are edges, and a wall time it repeats takes either offset (decisions 81 and 91) (provisional)
placesplacesplacesthe most places after the point a decimal domain draws (decision 82)
inSerialsin_serialsinSerialsdates or date-times as serial numbers in a spreadsheet system: Excel 1900, Excel 1904 or OLE Automation (decision 85) (the serials module)
inBase64in_base64inBase64the drawn bytes as base64 text, standard or URL-safe, padded or not, always canonical (decision 88)
inHexin_hexinHexthe drawn bytes as hex text, lower or upper case (decision 88)
nonCanonicalnon_canonicalnonCanonicalencoded text a strict decoder must refuse: non-zero pad bits, wrong padding (decision 88)

Bounds

JavaRust pendingSwift plannedWhat it does
atLeastat_leastatLeastlower bound, inclusive
atMostat_mostatMostupper bound, inclusive
greaterThangreater_thangreaterThanlower bound, exclusive
lessThanless_thanlessThanupper bound, exclusive

On a source

JavaRust pendingSwift plannedWhat it does
drawdrawdrawdraw a value from a domain, inside a named domain

On steps

JavaRust pendingSwift plannedWhat it does
stepstepstepone step, by name, with a domain for each of its arguments and what it does with them; as a function, step(name, arguments…) pins one step for .example
whenwhenwhenthe precondition of the step before it: a step whose precondition doesn't hold is skipped, and the run goes on
invariantinvariantinvariantwhat holds at the start and after every step, by name, so a failure can say which broke

Where a language makes the same word impossible or wrong, the contract registers the difference and says why. These are all of them:

IdWhat differsWhy
E1How a setting is set besides its PROPTASTIC_* variableEach language's runtime offers its own (Java's system properties); most have none.
E2How a test is named: the name the random stream is keyed on (decision 12) and the manifest's id, class, method and signatureEach language names a test its own way: a class and a method's signature, a module path and a function.
E3The command a rerun: line prints to run exactly one test (decisions 14 and 16), and the hosts it knowsEach ecosystem's build and test runners.
E4Where counterexamples, events and the manifest go by default, and how processes running at once share the manifestEach build tool has its own output directory.
E5Where auto colour (decision 22) knows output is rendered, and the variables besides FORCE_COLOR that force itEach ecosystem's runners show output differently, and has its own conventions for forcing colour.
E6How a pin line spells values and steps as source (decision 30)Each language's literals.
E7The escape a value and a pin line use for a character that can't be seen (decision 17)Each language's string literals.
E8When the edition knows the draws' names (decision 31)Whether a language keeps a closure's parameter names at run time.
E9When the steps have a text for the state (decisions 32 and 39)Whether generic code can ask a type for its text.
E10How final states of steps on threads are compared, and what keys the search's cache (decision 39)Each language's equality, and whether its text is safe to compare.
E11When a step's own failure is threw rather than failed, and what it names (decisions 32 and 39)Whether a language can tell a failure from a failed assertion.
E12What generates typed steps and pins from an interface of steps (decision 38), and its pin formJava's annotation processors, Rust's attribute macros, Swift's macros.
E13How a state and its steps are shared across threads (decision 39)A language's rules for sharing data between threads.
E14What lock(name) returns, and how the code under test takes it (decision 39)Each language's lock types.
E15Which of the language's types a model's JSON writes as whole numbers, floating point, sum types' variants, sets and arrays (decision 33)Each language's types, and its usual JSON library's form for them.
E16The syntax matching(regex) reads, and the engine each draw is checked against (decision 42)Each language's own regular expressions.
E17What a string's length counts, which a counterexample's characters are shrunk against (decision 43)Each language's own strings.
E18How the edition runs TLC to check a spec's invariants on the code's state (decision 34) and judge the steps of a spec with no graph (decision 110)TLC is a Java program: an edition on the JVM runs it on its own Java, others find one.
E19Which hosts the CLI drives for the edition, how it runs exactly the properties it selects, and how it makes the host run when the build would call the tests up to date (decisions 49 and 50)Each ecosystem's build tools and test runners.
E20How example inserts a pin line into a property's chain, and what it refuses (decision 54)Each language's syntax for a chain.
E21How fuzz runs the properties for as long as it's given (decision 56)Each ecosystem's runners: a JVM build is slow to start, and Rust's built test binaries run one test each.
E22How the code under test is given switch points for .threads(n), and the interface it calls (decision 65)Each runtime rewrites code its own way, or not at all.
E23Which test checks the contract's golden counterexample ids, golden corpus entry names and the choices' text examples against the edition's own store (decisions 52 and 67)Each edition's own contract test reads the one contract, in its own language.
E24Which of the language's types dates(), times(), dateTimes(), instants(), durations(), offsets(), decimals() and uuids() draw, what .excluding and .on take, and where they're packaged (decisions 79 to 82)The editions' types differ more here than anywhere else: Java has java.time in the JDK; Rust has none in std but SystemTime and an unsigned Duration, so its types come from crates, behind features; Swift's Foundation has Date, an instant only, and no civil date, so Swift settles its own date type before dates() binds.
E25How with names the field of a by-type domain it gives a domain of its ownEach language names a field its own way: Java an accessor reference, Rust an attribute on a derive, as a closure can't name a field at run time (E8), Swift a key path.
E26The language's character type, drawn by type as one character as strings draw it, in strings' order, a the simplest (decision 88)The three languages mean three things by a character: Java a UTF-16 code unit, Rust a Unicode scalar, Swift an extended grapheme cluster, so no one word could mean one thing.
E27How the alphabets in strings.alphabets are named for from(…): their characters, in order, are the contract'sEach language names constants its own way and keeps them in its own place: Java upper snake case on the class a test imports statically, Rust a module of &str constants, Swift static members found by leading dot (.lowercase).
J1longs() beside integers()Java has no generic numeric integers<T>: Rust says integers::<i64>(), Swift integers(Int64.self).
J2PropertyFailure extends org.opentest4j.AssertionFailedErrorIt keeps what an IDE and a build tool read from the original: the message is the original's, a blank line and the report; expected, actual, the cause and the stack trace are copied from the original.
J3the static atLeast, atMost, greaterThan and lessThan for sizes live in io.proptastic.bounds.BoundsJava imports statics by class: their own small package, so import static io.proptastic.bounds.Bounds.*; reads well (Brian, 26 Nov). Mockito's static atLeast and atMost clash with a star import of both, which is accepted.
J4In Kotlin, .with(Line::quantity, d) from proptastic-kotlin names a data class's property by KProperty1A Kotlin property reference reaches Java as a lambda that hides its name; the extension lets Kotlin name it, and keeps Kotlin out of the library's jar (decision 44).
J5io.proptastic.Points's methods, each what rewritten code calls in place of, or before, its ownThe agent's rewriting calls them, not a person: each is named for the call it stands in for, a monitor's wait and notify as waitOn and notifyOn, as Object's are final; unswitched goes before a call no point can be put inside, which the next pass says; LockSupport's, a blocking queue's and a StampedLock's calls that wait keep their own names (decision 65).
J6io.proptastic.Probes.hit(id), what code rewritten for coverage calls at each probeThe agent's rewriting calls it, not a person (decision 66).
J7io.proptastic.Fuzzing's arm, stop, result, disarm and running, what fuzz's worker calls to search a propertyThe worker calls them, not a person: an edition's fuzz worker reaches its library its own way (decision 69).
J8io.proptastic.Compares' icmp, lcmp and equals, what code rewritten for coverage calls in place of its comparisonsThe agent's rewriting calls them, not a person, each named for the comparison it stands in for (decision 71).
J9unsigned, 128-bit and platform-width integersJava has no unsigned, 128-bit or platform-width integer types; char is its only unsigned primitive. Storing an unsigned value in signed bits, as Protocol Buffers does, would shrink toward the wrong zero and weight the wrong end, and print 2^64-1 as -1. Instead: bigIntegers().atLeast(BigInteger.ZERO).atMost(…) for an unsigned or a 128-bit value; longs() only for a 64-bit pattern the code already reads as unsigned, such as with Long.toUnsignedString.
J10java(TheModel.class), and Model.serve, outcome and answer, for a model written in JavaA model in Java speaks the protocol through the library, from its own main, and runs with the tests' own Java (decision 104); a model in another language is that language's program, run by command(…).
R1a tuple for several draws, for_all((a, b)), several-draw examples, .example((a, b)), and two size bounds, of_size((at_least(1), at_most(50)))Rust has no variadics or overloads.
R2integers::<i32>(), with a turbofishRust can't default a function's type parameter.
R3the helper traits IntoDomain, SourceForm and IntoExcludingFor range and tuple domains, pin lines, and the shapes .excluding(…) takes (decisions 79 and 92): Rust has no overloads.
R4domain_of((d1, d2, d3), |(a, b, c)| …) for the combined formRust has no overloads, so domain(|d| …) keeps the name and the combined form takes a second one (Brian, 24 Nov).
R5an Arbitrary trait (Rust) or protocol (Swift) behind any::<T>() and any(T.self)VOCABULARY.md's any row: Java finds a domain from the class by reflection; Rust and Swift put a trait or protocol behind it.
R6the failed at and saved facts; a failing pinned example prints them tooVOCABULARY.md's failure output: Rust only. saved is a JSON file under target/proptastic/.
R7domains draw owned values only: String, Vec<u8>, PathBuf, never &str or &[u8]; the check borrowsA value must outlive its try to be shrunk, replayed, printed and saved; borrowed data can't. proptastic's fuzz reads choices, not a buffer to slice.
S1into: before a constructor: domain(d1, d2, into: Trade.init)Swift requires a label on a parameter that follows a parameter pack. The trailing-closure form, domain(d1, d2) { a, b in … }, needs none.
S2try assume(…)Swift can leave a closure only by throwing. Write try #expect(…) when the checked expression throws (a Swift rule).
S3.ofSize(atLeast: 1, atMost: 50), labelled with the bound wordsVOCABULARY.md's bounds: Swift labels the arguments, with the same words, as Swift does.
S4arbitrary-precision integersSwift's standard library has no big integer type, and proptastic doesn't invent one. Instead: integers(Int128.self), the range an unbounded bigIntegers() draws elsewhere.

Editions says which editions there are, and how far along each is.

Privacy