Skip to content

Commit

Permalink
build based on a66b031
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Mar 18, 2024
1 parent 2eb350c commit 77100c3
Show file tree
Hide file tree
Showing 17 changed files with 128 additions and 82 deletions.
2 changes: 1 addition & 1 deletion dev/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-03-18T08:15:31","documenter_version":"1.3.0"}}
{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-03-18T14:22:37","documenter_version":"1.3.0"}}
2 changes: 1 addition & 1 deletion dev/Examples/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
Test Summary: | Pass Total Time
successor | 1 1 0.0s
Test Summary: | Pass Total Time
commutative | 1 1 0.0s</code></pre><p>In this way, we can even reuse properties from other invocations of <code>@check</code> with new, perhaps more specialized, inputs. For generalization, we can use <a href="../interfaces.html#Supposition.Data.Just"><code>Data.Just</code></a> to pass our <code>add</code> function to the generalized properties.</p><div class="admonition is-info"><header class="admonition-header">Nesting @testset</header><div class="admonition-body"><p>From Julia 1.11 onwards, <code>@check</code> can also report its own results as part of a parent <code>@testset</code>. This is unfortunately unsupported on 1.10 and earlier.</p></div></div><p>Be aware that while all checks pass, we <em>do not have a guarantee that our code is correct for all cases</em>. Sampling elements to test is a statistical process and as such we can only gain <em>confidence</em> that our code is correct. You may view this in the light of Bayesian statistics, where we update our prior that the code is correct as we run our testsuite more often. This is also true were we not using property based testing or Supposition.jl at all - with traditional testing approaches, only the values we&#39;ve actually run the code with can be said to be tested.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../intro.html">« Introduction to PBT</a><a class="docs-footer-nextpage" href="composition.html">Composing Generators »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.3.0 on <span class="colophon-date" title="Monday 18 March 2024 08:15">Monday 18 March 2024</span>. Using Julia version 1.10.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
commutative | 1 1 0.0s</code></pre><p>In this way, we can even reuse properties from other invocations of <code>@check</code> with new, perhaps more specialized, inputs. For generalization, we can use <a href="../interfaces.html#Supposition.Data.Just"><code>Data.Just</code></a> to pass our <code>add</code> function to the generalized properties.</p><div class="admonition is-info"><header class="admonition-header">Nesting @testset</header><div class="admonition-body"><p>From Julia 1.11 onwards, <code>@check</code> can also report its own results as part of a parent <code>@testset</code>. This is unfortunately unsupported on 1.10 and earlier.</p></div></div><p>Be aware that while all checks pass, we <em>do not have a guarantee that our code is correct for all cases</em>. Sampling elements to test is a statistical process and as such we can only gain <em>confidence</em> that our code is correct. You may view this in the light of Bayesian statistics, where we update our prior that the code is correct as we run our testsuite more often. This is also true were we not using property based testing or Supposition.jl at all - with traditional testing approaches, only the values we&#39;ve actually run the code with can be said to be tested.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../intro.html">« Introduction to PBT</a><a class="docs-footer-nextpage" href="composition.html">Composing Generators »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.3.0 on <span class="colophon-date" title="Monday 18 March 2024 14:22">Monday 18 March 2024</span>. Using Julia version 1.10.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
48 changes: 24 additions & 24 deletions dev/Examples/composition.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
a + b*im
end
example(even_complex, 5)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">5-element Vector{Complex{Int64}}:
2752760855691222456 + 9185325055203860000im
2721239641308166320 - 6519060463350309794im
-792499340749969814 + 7822151153240062920im
-3012185317395296980 + 3386777971430740402im
-3584653322904586754 - 2364397546728602998im</code></pre><p>In essence, <code>@composed</code> takes a function that is given some generators, and ultimately returns a generator that runs the function on those given generators. As a full-fledged <code>Possibility</code>, you can of course do everything you&#39;d expect to do with other <code>Possibility</code> objects from Supposition.jl, including using them as input to other <code>@composed</code>! This makes them a powerful tool for composing custom generators.</p><pre><code class="language-julia hljs">@check function all_complex_even(c=even_complex)
6019700903807578500 - 8313298539823883170im
-1438201868394916230 - 895209546803064492im
2799120192082868140 + 2915887774257404170im
4257919243146095746 - 8091476124391236834im
121985162987987114 - 7035457560865416800im</code></pre><p>In essence, <code>@composed</code> takes a function that is given some generators, and ultimately returns a generator that runs the function on those given generators. As a full-fledged <code>Possibility</code>, you can of course do everything you&#39;d expect to do with other <code>Possibility</code> objects from Supposition.jl, including using them as input to other <code>@composed</code>! This makes them a powerful tool for composing custom generators.</p><pre><code class="language-julia hljs">@check function all_complex_even(c=even_complex)
iseven(real(c)) &amp;&amp; iseven(imag(c))
end</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">Test Summary: | Pass Total Time
all_complex_even | 1 1 0.0s</code></pre><div class="admonition is-warning"><header class="admonition-header">Type stability</header><div class="admonition-body"><p>The inferred type of objects created by a generator from <code>@composed</code> is a <em>best effort</em> and may be wider than expected. E.g. if the input generators are non-<code>const</code> globals, it can easily happen that type inference falls back to <code>Any</code>. The same goes for other type instabilities and the usual best-practices surrounding type stability.</p></div></div><p>In addition, <code>@composed</code> defines the function given to it as well as a regular function, which means that you can call &amp; reuse it however you like:</p><pre><code class="language-julia hljs">complex_even(1.0,2.0)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">0.0 + 2.0im</code></pre><h2 id="Filtering,-mapping,-and-other-combinators"><a class="docs-heading-anchor" href="#Filtering,-mapping,-and-other-combinators">Filtering, mapping, and other combinators</a><a id="Filtering,-mapping,-and-other-combinators-1"></a><a class="docs-heading-anchor-permalink" href="#Filtering,-mapping,-and-other-combinators" title="Permalink"></a></h2><h3 id="filter"><a class="docs-heading-anchor" href="#filter"><code>filter</code></a><a id="filter-1"></a><a class="docs-heading-anchor-permalink" href="#filter" title="Permalink"></a></h3><p>Of course, manually marking, mapping or filtering inside of <code>@composed</code> is sometimes a bit too much. For these cases, all <code>Possibility</code> support <code>filter</code> and <code>map</code>, returning a new <a href="../interfaces.html#Supposition.Data.Satisfying"><code>Data.Satisfying</code></a> or <a href="../interfaces.html#Supposition.Data.Map"><code>Data.Map</code></a> <code>Possibility</code> respectively:</p><pre><code class="language-julia hljs">using Supposition
Expand All @@ -25,30 +25,30 @@
f = filter(iseven, intgen)

example(f, 10)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">10-element Vector{UInt8}:
0x94
0x66
0x44
0xae
0x7e
0x58
0x64
0x88
0x3e
0x3a</code></pre><p>Note that filtering is, in almost all cases, strictly worse than constructing the desired objects directly. For example, if the filtering predicate rejects too many examples from the input space, it can easily happen that no suitable examples can be found:</p><pre><code class="language-julia hljs">g = filter(&gt;(typemax(UInt8)), intgen)
0x0e
0x2e
0x26
0x96
0x4c
0xb0
0xf0
0xf6
0xde</code></pre><p>Note that filtering is, in almost all cases, strictly worse than constructing the desired objects directly. For example, if the filtering predicate rejects too many examples from the input space, it can easily happen that no suitable examples can be found:</p><pre><code class="language-julia hljs">g = filter(&gt;(typemax(UInt8)), intgen)
example(g, 10)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">ERROR: Tried sampling 100000 times, without getting a result. Perhaps you&#39;re filtering out too many examples?</code></pre><p>It is best to only filter when you&#39;re certain that the part of the state space you&#39;re filtering out is not substantial.</p><h3 id="map"><a class="docs-heading-anchor" href="#map"><code>map</code></a><a id="map-1"></a><a class="docs-heading-anchor-permalink" href="#map" title="Permalink"></a></h3><p>In order to make it easier to directly construct conforming instances, you can use <code>map</code>, transforming the output of one <code>Possibility</code> into a different object:</p><pre><code class="language-julia hljs">using Supposition

intgen = Data.Integers{UInt8}()
makeeven(x) = (x÷0x2)*0x2
m = map(makeeven, intgen)

example(m, 10)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">10-element Vector{UInt8}:
0xe8
0xbc
0x16
0x12
0xa2
0x6a
0x4c
0x6c
0xa6
0x82</code></pre><div class="admonition is-warning"><header class="admonition-header">Type stability</header><div class="admonition-body"><p>The inferred type of objects created by a generator from <code>map</code> is a <em>best effort</em> and may be wider than expected. Ensure your function <code>f</code> is easily inferrable to have good chances for <code>map</code>ping it to be inferable as well.</p></div></div></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="basic.html">« Basic Usage</a><a class="docs-footer-nextpage" href="recursive.html">Recursive Generation »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.3.0 on <span class="colophon-date" title="Monday 18 March 2024 08:15">Monday 18 March 2024</span>. Using Julia version 1.10.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
0x94
0xa4
0x34
0xce
0xb0
0xf6
0x60
0x52
0xb8
0x38</code></pre><div class="admonition is-warning"><header class="admonition-header">Type stability</header><div class="admonition-body"><p>The inferred type of objects created by a generator from <code>map</code> is a <em>best effort</em> and may be wider than expected. Ensure your function <code>f</code> is easily inferrable to have good chances for <code>map</code>ping it to be inferable as well.</p></div></div></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="basic.html">« Basic Usage</a><a class="docs-footer-nextpage" href="recursive.html">Recursive Generation »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.3.0 on <span class="colophon-date" title="Monday 18 March 2024 14:22">Monday 18 March 2024</span>. Using Julia version 1.10.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit 77100c3

Please sign in to comment.