Skip to content

Commit

Permalink
build based on dc86dc6
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Mar 14, 2024
1 parent 41360d7 commit 0b8a60f
Show file tree
Hide file tree
Showing 16 changed files with 87 additions and 85 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-14T17:35:36","documenter_version":"1.3.0"}}
{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-03-14T17:41:06","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="Thursday 14 March 2024 17:35">Thursday 14 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="Thursday 14 March 2024 17:41">Thursday 14 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}}:
4330504481792362756 + 991526633369953466im
-5937152989431779906 - 14515684493316442im
-1190139771756737034 - 1024001723129802114im
5857427233037395864 + 4334958247935356272im
-3138609724702571308 - 8036647154652251224im</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)
6783286361161715046 - 5684948202049968822im
-5759171981357965212 - 1967184722379113890im
-1140949718046290508 + 7068748584123091430im
898864789436359740 - 8246398294077639548im
4574817186779362426 + 4159963392733398680im</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}:
0x8e
0xf0
0x36
0x38
0xa6
0xd0
0xe0
0x9e
0x96
0xaa</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)
0x0a
0x10
0xb8
0x80
0x5a
0x5a
0x0e
0x0e
0x12
0xdc</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}:
0xaa
0x8a
0x70
0x3a
0x60
0x60
0x72
0x80
0x4a
0x40
0xce
0x6a
0xf6
0x1e
0xc0
0x8c</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="Thursday 14 March 2024 17:35">Thursday 14 March 2024</span>. Using Julia version 1.10.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
0xa4
0xa0
0x8c</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="Thursday 14 March 2024 17:41">Thursday 14 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 0b8a60f

Please sign in to comment.