Skip to content

Commit

Permalink
build based on 719fdae
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Nov 3, 2023
1 parent fac1ad9 commit c2221e3
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 15 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.9.3","generation_timestamp":"2023-11-03T13:06:12","documenter_version":"1.1.2"}}
{"documenter":{"julia_version":"1.9.3","generation_timestamp":"2023-11-03T13:57:08","documenter_version":"1.1.2"}}
4 changes: 2 additions & 2 deletions dev/advanced/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
end;</code></pre><h2 id="Implementation"><a class="docs-heading-anchor" href="#Implementation">Implementation</a><a id="Implementation-1"></a><a class="docs-heading-anchor-permalink" href="#Implementation" title="Permalink"></a></h2><p>Let&#39;s try to see if our favorite number types do indeed behave like a group.</p><pre><code class="language-julia hljs">Group.neutral(::Type{N}) where {N&lt;:Number} = one(N)
Group.multiplication(x::Number, y::Number) = x * y
Group.inversion(x::Number) = inv(x)</code></pre><p>First, we check it for floating point numbers, giving a list of <code>Arguments</code> objects with the proper fields to the <code>test</code> function.</p><pre><code class="language-julia hljs">float_pairs = [Arguments(x = 2.0, y = 1.0)]
Interfaces.test(Group.GroupInterface, Float64, float_pairs)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">true</code></pre><p>We can thus declare proudly</p><pre><code class="language-julia hljs">@implements Group.GroupInterface Float64</code></pre><p>Now we check it for integer numbers. The reason it fails is because for an integer <code>x</code>, the inverse <code>1/x</code> is no longer an integer! Thus integer numbers are not a multiplicative group.</p><pre><code class="language-julia hljs">int_pairs = [Arguments(x = 2, y = 1)]
Interfaces.test(Group.GroupInterface, Float64, float_pairs)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">true</code></pre><p>We can thus declare proudly</p><pre><code class="language-julia hljs">@implements Group.GroupInterface Float64 [Arguments(x = 2.0, y = 1.0)]</code></pre><p>Now we check it for integer numbers. The reason it fails is because for an integer <code>x</code>, the inverse <code>1/x</code> is no longer an integer! Thus integer numbers are not a multiplicative group.</p><pre><code class="language-julia hljs">int_pairs = [Arguments(x = 2, y = 1)]
Interfaces.test(Group.GroupInterface, Int, int_pairs)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">false</code></pre><p>What happens if we give an input whose field types (<code>Int</code>) are not coherent with the type we are testing (<code>Float64</code>)?</p><pre><code class="language-julia hljs">try
Interfaces.test(Group.GroupInterface, Float64, int_pairs)
catch e
print(e.msg)
end</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">Each tested object must either be an instance of `Float64` or an instance of `Arguments` whose field types include at least one subtype of `Float64`. You provided a `Arguments{(:x, :y), Tuple{Int64, Int64}}` instead.</code></pre><p>In summary, there are two things to remember:</p><ol><li>The anonymous functions in the interface conditions of <code>Interfaces.@interface</code> should accept a single object of type <code>Arguments</code> and then work with its named fields. These fields should be listed in the docstring.</li><li>The list of objects passed to <code>Interface.test</code> must all be of type <code>Arguments</code>, with the right named fields. At least one field must have the type you are testing.</li></ol><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../basic/">« Basic</a><a class="docs-footer-nextpage" href="../api/">API reference »</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="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Friday 3 November 2023 13:06">Friday 3 November 2023</span>. Using Julia version 1.9.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
end</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">Each tested object must either be an instance of `Float64` or an instance of `Arguments` whose field types include at least one subtype of `Float64`. You provided a `Arguments{(:x, :y), Tuple{Int64, Int64}}` instead.</code></pre><p>In summary, there are two things to remember:</p><ol><li>The anonymous functions in the interface conditions of <code>Interfaces.@interface</code> should accept a single object of type <code>Arguments</code> and then work with its named fields. These fields should be listed in the docstring.</li><li>The list of objects passed to <code>Interface.test</code> must all be of type <code>Arguments</code>, with the right named fields. At least one field must have the type you are testing.</li></ol><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../basic/">« Basic</a><a class="docs-footer-nextpage" href="../api/">API reference »</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="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Friday 3 November 2023 13:57">Friday 3 November 2023</span>. Using Julia version 1.9.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit c2221e3

Please sign in to comment.