Skip to content

Commit

Permalink
Add more cross references to exposed API
Browse files Browse the repository at this point in the history
It's good to link the struct docs that should be used when
redefining the default configuration.

Also, fix a tiny misuse of admonitions.
  • Loading branch information
Seelengrab committed Mar 4, 2024
1 parent 2988f55 commit 2980ca3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/src/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ the hood, modify the currently running testcase.
```@docs
Supposition.target!(::Float64)
Supposition.assume!(::Bool)
Supposition.produce!
Supposition.produce!(::Data.Possibility)
Supposition.reject!
Supposition.DEFAULT_CONFIG
```
Expand Down
4 changes: 2 additions & 2 deletions src/Supposition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export produce!
"""
DEFAULT_CONFIG
A `ScopedValue` holding the `CheckConfig` that will be used by default & as a fallback.
A `ScopedValue` holding the [`CheckConfig`](@ref) that will be used by default & as a fallback.
Currently uses these values:
Expand All @@ -42,7 +42,7 @@ Currently uses these values:
* `broken`: `false`
* `buffer_size`: `100_000`
`@check` will use a _new_ instance of `Random.Xoshiro` by itself.
[`@check`](@ref) will use a _new_ instance of `Random.Xoshiro` by itself.
"""
const DEFAULT_CONFIG = ScopedValue{CheckConfig}(CheckConfig(;
rng=Random.Xoshiro(rand(Random.RandomDevice(), UInt)),
Expand Down
14 changes: 9 additions & 5 deletions src/api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ using Test: Test, @testset, @test
using Logging: @debug

"""
example(gen::Possibility; tries=100_000)
example(pos::Possibility; tries=100_000, generation::Int)
Generate an example for the given `Possibility`.
`example` tries to have `gen` produce an example `tries` times
and throws an error if `gen` doesn't produce one in that timeframe.
`example` tries to have `pos` produce an example `tries` times
and throws an error if `pos` doesn't produce one in that timeframe.
`generation` indicates how "late" in a usual run of `@check` the example
might have been generated.
Usage:
Expand Down Expand Up @@ -37,9 +39,11 @@ function example(pos::Data.Possibility; tries=100_000, generation::Int=rand(1:50
end

"""
example(gen::Possibility, n::Integer)
example(gen::Possibility, n::Integer; tries=100_000)
Generate `n` examples for the given `Possibility`.
Generate `n` examples for the given `Possibility`. Each example
is given `tries` attempts to generate. If any fail, the entire process
is aborted.
```julia-repl
julia> using Supposition, Supposition.Data
Expand Down
2 changes: 1 addition & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Options:
* `broken`: Whether the invocation is expected to fail. Defaults to `false`.
* `buffer_size`: The default maximum buffer size to use for a test case. Defaults to `100_000`.
!!! warn "Buffer Size"
!!! warning "Buffer Size"
At any one point, there may be more than one active buffer being worked on.
You can try to increase this value when you encounter a lot of `Overrun`.
Do not set this too large, or you're very likely to run out of memory; the default
Expand Down

0 comments on commit 2980ca3

Please sign in to comment.