Skip to content

Domains

A pass is only as good as what was drawn. This catalogue lists each domain with what it draws, what a counterexample from it shrinks toward, and how often it draws what, so you can tell which values a run checked often and which hardly at all.

Each table’s rows are slices of the draws that add up to 100%: a draw counts in the first row it fits, so a row that says “another” or “any other” leaves out the rows above it. Each share was measured by drawing from the domain, with seed 0x5eed, by a test the build runs, so it’s what the code draws, not a figure typed here. The shares follow from one rule, how values are drawn, which says why each comes out as it does, and how to change it: bounds, .edges(…), weighted(…), sizes.

integers()

Draws
any int
Shrinks toward
0
DrawnHow often
07.5%
another from −128 to 12851.2%
Integer.MAX_VALUE6.4%
Integer.MIN_VALUE6.0%
any other int28.9%

integers().atLeast(1).atMost(10_000)

Draws
an int within its bounds
Shrinks toward
the bound nearest 0, here 1
DrawnHow often
18.0%
2 to 424.0%
5 to 25631.3%
257 to 9,99930.4%
10,000, the far end6.3%

longs()

Draws
any long
Shrinks toward
0
DrawnHow often
07.5%
another from −128 to 12851.2%
Long.MAX_VALUE6.4%
Long.MIN_VALUE6.0%
any other long28.9%

bigIntegers()

Draws
a BigInteger from -2^127 to 2^127-1, the range Rust's i128 has, as two 64-bit choices
Shrinks toward
0
DrawnHow often
07.9%
another from −128 to 12854.6%
any other within 64 bits0.0%
-2^127, the far end6.3%
any other past 64 bits31.2%

doubles()

Draws
any double, NaN, the infinities, -0.0 and the smallest subnormal among them
Shrinks toward
a whole number, 0.0 if it can
DrawnHow often
NaN1.4%
an infinity2.4%
a whole number77.7%
a number with a fraction18.5%

floats()

Draws
any float, NaN, the infinities, -0.0f and the smallest subnormal among them
Shrinks toward
a whole number, 0.0f if it can
DrawnHow often
NaN1.4%
an infinity2.4%
Float.MAX_VALUE or its negative3.9%
another whole number73.8%
a number with a fraction18.5%

booleans()

Draws
false or true
Shrinks toward
false
DrawnHow often
false49.9%
true50.1%

elements("buy", "sell", "hold")

Draws
one of the values given
Shrinks toward
the first
DrawnHow often
"buy"33.6%
"sell"33.2%
"hold"33.2%

strings()

Draws
any string, every Unicode code point among its characters
Shrinks toward
the empty string, each character toward a
On average
7.0 characters
DrawnHow often
empty12.4%
a character past U+FFFF among them67.1%
every character up to U+FFFF20.5%

strings().from("ACGT")

Draws
strings of the alphabet's characters only
Shrinks toward
the empty string, each character toward the first, A
On average
7.0 characters
DrawnHow often
empty12.4%
1 to 30 characters86.0%
over 30 characters1.6%

strings().nonBlank()

Draws
strings with a character that isn't whitespace, built so, never filtered
Shrinks toward
a, each character toward a
On average
8.0 characters
DrawnHow often
one character12.4%
another with whitespace among them34.2%
any other string53.4%

strings().singleLine()

Draws
strings with no line break, every other code point among their characters
Shrinks toward
the empty string, each character toward a
On average
7.0 characters
DrawnHow often
empty12.4%
another with a tab or a space5.0%
any other string82.6%

lists(integers())

Draws
lists, each element drawn from the domain given
Shrinks toward
the empty list, each element shrunk too
On average
7.0 elements
DrawnHow often
empty12.4%
1 to 30 elements86.1%
over 30 elements1.5%

sets(integers())

Draws
sets of distinct elements
Shrinks toward
the empty set
On average
6.0 elements
DrawnHow often
empty12.4%
1 to 30 elements87.3%
over 30 elements0.3%

maps(strings(), integers())

Draws
maps of distinct keys, each to a value
Shrinks toward
the empty map
On average
6.6 entries
DrawnHow often
empty12.4%
1 to 30 entries86.5%
over 30 entries1.1%

optionals(integers())

Draws
a value from the domain given, or none
Shrinks toward
Optional.empty()
DrawnHow often
empty24.9%
a value75.1%

bytes()

Draws
a byte[], each byte 0x00 to 0xFF, its ends often; empty, all zero or all 0xFF as edges
Shrinks toward
the empty array, each byte toward 0
On average
6.7 bytes
DrawnHow often
empty16.2%
all 0x004.4%
all 0xFF4.4%
any other bytes75.0%

bytes().inBase64()

Draws
the bytes' canonical base64 text, the standard alphabet, padded
Shrinks toward
the empty string
DrawnHow often
empty16.2%
padded with =59.4%
unpadded, its bytes a multiple of 324.4%

dates()

Draws
a LocalDate in 1900-01-01 to 2100-12-31, a calendar edge about one try in five
Shrinks toward
Monday 2001-01-01, or the bound nearest it
DrawnHow often
2001-01-01, the anchor0.0%
1900-01-01 or 2100-12-31, the ends2.8%
29 February1.0%
another day from 28 December to 4 January10.0%
another 29th to 31st of a month10.3%
any other day75.9%

dates().excluding(SATURDAY, SUNDAY)

Draws
a weekday in 1900 to 2100, never a weekend, drawn by its index among the weekdays
Shrinks toward
Monday 2001-01-01, the weekday nearest it
DrawnHow often
a Saturday or a Sunday0.0%
a month's first or last weekday20.2%
another Monday15.9%
another Friday15.4%
any other weekday48.5%

times()

Draws
a LocalTime, a whole second most tries, a fraction of a second one try in 8
Shrinks toward
midnight, the fraction first
DrawnHow often
midnight0.0%
a fraction of a second11.6%
another whole second before noon44.6%
a whole second from noon on43.8%

dateTimes()

Draws
a LocalDateTime: a date as dates() draws it, then a time on it
Shrinks toward
2001-01-01T00:00
DrawnHow often
midnight0.0%
29 February, after midnight1.0%
the 29th to the 31st of another month, after midnight18.2%
any other time80.8%

instants()

Draws
an Instant in 1900 to 2100, a date and a time in UTC
Shrinks toward
2001-01-01T00:00:00Z
DrawnHow often
before 1970, a whole second31.3%
before 1970, a fraction3.9%
from 1970, a whole second57.4%
from 1970, a fraction7.4%

durations()

Draws
a signed Duration up to 73,414 days either way, an edge about one try in five
Shrinks toward
zero
DrawnHow often
zero7.0%
23 hours, a day or 25 hours, either way10.8%
another under a minute, either way36.9%
any other negative22.6%
any other positive22.7%

offsets()

Draws
a ZoneOffset in whole minutes from -18:00 to +18:00
Shrinks toward
UTC
DrawnHow often
UTC2.1%
beyond -12:00 to +14:0025.9%
another whole hour4.9%
any other offset67.1%

dateTimes().inZones(offsets())

Provisional: inZones may change in a minor release, until every edition has it.

Draws
a ZonedDateTime: a date-time, then a zone it's placed in
Shrinks toward
2001-01-01T00:00Z, UTC
DrawnHow often
in UTC2.0%
in another offset98.0%

zones()

Draws
a ZoneId from the contract's list of region zones, UTC first
Shrinks toward
UTC
DrawnHow often
UTC13.1%
a zone not a whole hour from UTC20.6%
any other zone66.3%

dateTimes().inZones(zones())

Provisional: inZones may change in a minor release, until every edition has it.

Draws
a ZonedDateTime in a region zone, its transitions as edges
Shrinks toward
2001-01-01T00:00Z[UTC]
DrawnHow often
the later offset of a repeated hour1.4%
another within a day of a transition13.4%
any other85.2%

luhnNumbers()

Draws
12 to 19 digits, the last the Luhn check digit of the rest
Shrinks toward
"000000000000"
On average
15.1 digits
DrawnHow often
16 digits, a card's usual length7.6%
another length92.4%

ibans()

Draws
an IBAN, its check digits by mod 97, from countries whose accounts have no check of their own
Shrinks toward
the shortest country's, "NL54AAAA0000000000"
DrawnHow often
with letters after the country61.2%
digits only after the country38.8%

isbns().mistyped()

Draws
an ISBN-13 with one digit typed wrong, which its check catches
Shrinks toward
the first digit wrong, "0780000000002"
DrawnHow often
978 at the front30.0%
979 at the front34.5%
a typo in the prefix35.5%

any(short.class)

Draws
a short, an integer within its bounds, as byte is within its own
Shrinks toward
0
DrawnHow often
07.5%
Short.MAX_VALUE6.4%
Short.MIN_VALUE6.0%
any other short80.1%

any(char.class)

Draws
a char: a character of the Basic Multilingual Plane in strings' order, never a lone surrogate
Shrinks toward
'a'
DrawnHow often
a letter or digit of ASCII29.2%
another character of ASCII16.7%
past ASCII54.1%

decimals().places(2)

Draws
a BigDecimal of 0 to 2 places, its unscaled value in 64 bits, an edge about one try in five
Shrinks toward
fewer places, then zero
DrawnHow often
zero12.0%
another whole number24.3%
a tie, ending in 56.0%
another of 1 place23.1%
another of 2 places34.6%

uuids()

Draws
a UUID of version 4 or 7, its version and variant set by construction
Shrinks toward
00000000-0000-4000-8000-000000000000
DrawnHow often
version 440.1%
version 739.7%
the nil UUID10.0%
the max UUID10.2%

dates().inSerials(Serial.EXCEL_1900)

Draws
a date as its serial in Excel's 1900 system, a double, and serials no date gives
Shrinks toward
36892.0, Monday 2001-01-01's serial
DrawnHow often
0, the day before serial 10.5%
the fictitious 60, 29 February 19000.5%
another before 61, 1 March 19002.0%
61 or later97.0%

domain(…), map, filter, flatMap, records and any(…) draw from these, so they draw what their parts do. Domains shows how to build them.

Privacy