@ciao-lang/ts-ciao-interface
Version:
Simple Ciao interface for node.
41 lines (40 loc) • 13.3 kB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="theme-color" content="#273f79"/><link rel="stylesheet" href="lpdoc.css" type="text/css"/><script type="text/javascript" src="lpdoc.js"></script><title>Special properties for testing — Run-time Checking, Testing, and Profiling for Ciao</title></head><body><div class="lpdoc-page fixleftbar"><a href="#" id="sidebar-toggle-button" class="lpdoc-navbutton"><span id="sidebar-button-arrow">☰</span></a><div id="sidebar" class="lpdoc-sidebar"><div class="lpdoc-nav"><span class="lpdoc-on-right"><a class="lpdoc-navbutton" href="unittest.html">↑</a><a class="lpdoc-navbutton" href="unittest.html">←</a><a class="lpdoc-navbutton" href="unittestdecls_doc.html">→</a><a class="lpdoc-navbutton" href="ciaodbg_ref_mansearch.html">🔍</a></span><span><a href="ciaodbg_ref_manfulltoc.html">TOC</a></span></div><hr></hr><ul class="lpdoc-itemize-sectpath"><li><a href="ciaodbg_ref_man.html">Run-time Checking, Testing, and Profiling for Ciao</a> »<br/> </li><li><a href="unittest.html">Unit testing</a> »<br/> </li><li><a href=""><strong>Special properties for testing</strong></a></li></ul><hr></hr><em>ON THIS PAGE</em><ul><li><a href="#Usage and interface">Usage and interface</a></li><li><a href="#Documentation on exports">Documentation on exports</a></li><li><a href="#Documentation on imports">Documentation on imports</a></li></ul></div><div class="lpdoc-main"><div id=""><h1>Special properties for testing</h1><a class="lpdoc-idx-anchor" href="ciaodbg_ref_mansearch.html#unittest_props"></a>
<strong>Author(s):</strong> <a class="lpdoc-idx-anchor" id="Edison Mera" href="ciaodbg_ref_mansearch.html#Edison Mera">Edison Mera</a>, <a class="lpdoc-idx-anchor" id="Pedro Lopez" href="ciaodbg_ref_mansearch.html#Pedro Lopez">Pedro López</a>, <a class="lpdoc-idx-anchor" id="Manuel Hermenegildo" href="ciaodbg_ref_mansearch.html#Manuel Hermenegildo">Manuel Hermenegildo</a>.<p>
<strong>Stability: [</strong><strong>beta</strong><strong>] </strong>Most of the functionality is there but it is still missing some testing and/or verification.<p><br/>
This module defines special properties and commands to be used in test declarations. They are called in general ``test commands.'' This includes some that are random generators.<br/><div id="Usage and interface"><h2>Usage and interface</h2><div class="lpdoc-cartouche"><ul><li><strong>Library usage:</strong><br/><tt>:- use_module(library(unittest/unittest_props)).</tt><li><strong>Exports:</strong><br/><ul class="lpdoc-itemize-minus"><li><em>Properties:</em><br/><a class="lpdoc-idx-anchor" id="0" href="#try_sols/2"><tt>try_sols/2</tt></a>, <a class="lpdoc-idx-anchor" id="1" href="#times/2"><tt>times/2</tt></a>, <a class="lpdoc-idx-anchor" id="2" href="#generate_from_calls_n/2"><tt>generate_from_calls_n/2</tt></a>, <a class="lpdoc-idx-anchor" id="3" href="#timeout/2"><tt>timeout/2</tt></a>, <a class="lpdoc-idx-anchor" id="4" href="#near/3"><tt>near/3</tt></a>, <a class="lpdoc-idx-anchor" id="5" href="#user_error/2"><tt>user_error/2</tt></a>, <a class="lpdoc-idx-anchor" id="6" href="#test_command/1"><tt>test_command/1</tt></a>, <a class="lpdoc-idx-anchor" id="7" href="#bound_random/3"><tt>bound_random/3</tt></a>, <a class="lpdoc-idx-anchor" id="8" href="#float_random/1"><tt>float_random/1</tt></a>, <a class="lpdoc-idx-anchor" id="9" href="#exp_float_random/1"><tt>exp_float_random/1</tt></a>, <a class="lpdoc-idx-anchor" id="10" href="#exp_float_random_extended/1"><tt>exp_float_random_extended/1</tt></a>.
</ul></ul></div></div><div id="Documentation on exports"><h2>Documentation on exports</h2><div><div class="lpdoc-defname"><span class="lpdoc-predtag">PROPERTY</span><a class="lpdoc-idx-anchor" id="try_sols/2" href="ciaodbg_ref_mansearch.html#try_sols/2">try_sols/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>try_sols(G,N)</tt>
</span><p>For this test of <span class="lpdoc-var">G</span> get at most <span class="lpdoc-var">N</span> solutions (normally 2 solutions are generated, just enough to detect non-determinism).</p><ul class="lpdoc-itemize-minus"><li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="11" href="#test_command/1"><tt>test_command/1</tt></a>)</span><span><span class="lpdoc-var">try_sols(G,N)</span> is a test command.
</span>
</ul>
<em>Meta-predicate</em> with arguments: <tt>try_sols(goal,?)</tt>.<br/></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PROPERTY</span><a class="lpdoc-idx-anchor" id="times/2" href="ciaodbg_ref_mansearch.html#times/2">times/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>times(G,N)</tt>
</span><p>This test of <span class="lpdoc-var">G</span> should be repeated <span class="lpdoc-var">N</span> times.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="12" href="#test_command/1"><tt>test_command/1</tt></a>)</span><span><span class="lpdoc-var">times(G,N)</span> is a test command.
</span>
</ul>
<em>Meta-predicate</em> with arguments: <tt>times(goal,?)</tt>.<br/></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PROPERTY</span><a class="lpdoc-idx-anchor" id="generate_from_calls_n/2" href="ciaodbg_ref_mansearch.html#generate_from_calls_n/2">generate_from_calls_n/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>generate_from_calls_n(G,N)</tt>
</span><p>For this test of <span class="lpdoc-var">G</span> generate (at most) <span class="lpdoc-var">N</span> initial test states from the calls field (normally only the first solution is generated).</p><ul class="lpdoc-itemize-minus"><li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="13" href="#test_command/1"><tt>test_command/1</tt></a>)</span><span><span class="lpdoc-var">generate_from_calls_n(G,N)</span> is a test command.
</span>
</ul>
<em>Meta-predicate</em> with arguments: <tt>generate_from_calls_n(goal,?)</tt>.<br/></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PROPERTY</span><a class="lpdoc-idx-anchor" id="timeout/2" href="ciaodbg_ref_mansearch.html#timeout/2">timeout/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>timeout(G,N)</tt>
</span><p>For this test of <span class="lpdoc-var">G</span> abort if runtime exceeds <span class="lpdoc-var">N</span> milliseconds (normally the default timeout is 600000 milliseconds, and can be altered using the 'unittest_default_timeout' flag). A timeout of 0 means no timeout</p><ul class="lpdoc-itemize-minus"><li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="14" href="#test_command/1"><tt>test_command/1</tt></a>)</span><span><span class="lpdoc-var">timeout(G,N)</span> is a test command.
</span>
</ul>
<em>Meta-predicate</em> with arguments: <tt>timeout(goal,?)</tt>.<br/></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PROPERTY</span><a class="lpdoc-idx-anchor" id="near/3" href="ciaodbg_ref_mansearch.html#near/3">near/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>near(A,B,Eps)</tt>
</span><p>Verifies that abs(<span class="lpdoc-var">B</span> - <span class="lpdoc-var">A</span>)/(abs(<span class="lpdoc-var">B</span>) + abs(<span class="lpdoc-var">A</span>)) =< <span class="lpdoc-var">Eps</span>.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PROPERTY</span><a class="lpdoc-idx-anchor" id="user_error/2" href="ciaodbg_ref_mansearch.html#user_error/2">user_error/2</a></div><div class="lpdoc-deftext">Not implemented yet.<p><span class="lpdoc-usage-header">Usage:</span><p>The predicate should write to the current error stream the specified string.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PROPERTY</span><a class="lpdoc-idx-anchor" id="test_command/1" href="ciaodbg_ref_mansearch.html#test_command/1">test_command/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>test_command(X)</tt>
</span><p><span class="lpdoc-var">X</span> is a test command.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="15" href="ciaodbg_ref_mansearch.html#sideff/2"><tt>sideff/2</tt></a>)</span><span><span class="lpdoc-var">test_command(X)</span> is side-effect <span class="lpdoc-var">free</span>.
</span>
</ul>
<em>Meta-predicate</em> with arguments: <tt>test_command(goal)</tt>.<br/></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PROPERTY</span><a class="lpdoc-idx-anchor" id="bound_random/3" href="ciaodbg_ref_mansearch.html#bound_random/3">bound_random/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><p>Similar to the predicate random:random/3</p><ul class="lpdoc-itemize-minus"></ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PROPERTY</span><a class="lpdoc-idx-anchor" id="float_random/1" href="ciaodbg_ref_mansearch.html#float_random/1">float_random/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><p>Similar to the predicate random:random/1</p><ul class="lpdoc-itemize-minus"></ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PROPERTY</span><a class="lpdoc-idx-anchor" id="exp_float_random/1" href="ciaodbg_ref_mansearch.html#exp_float_random/1">exp_float_random/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><p>Generates any floating point random number.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PROPERTY</span><a class="lpdoc-idx-anchor" id="exp_float_random_extended/1" href="ciaodbg_ref_mansearch.html#exp_float_random_extended/1">exp_float_random_extended/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><p>Generates any floating point random number including special cases like infinite, nan or zero whith sign.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p>
</div><div id="Documentation on imports"><h2>Documentation on imports</h2>This module has the following direct dependencies:<ul class="lpdoc-itemize-minus"><li><em>System library modules:</em><br/><a class="lpdoc-idx-anchor" id="16" href="ciaodbg_ref_mansearch.html#random"><tt>random</tt></a>, <a class="lpdoc-idx-anchor" id="17" href="ciaodbg_ref_mansearch.html#aggregates"><tt>aggregates</tt></a>.
<li><em>Internal (engine) modules:</em><br/><a class="lpdoc-idx-anchor" id="18" href="ciaodbg_ref_mansearch.html#term_basic"><tt>term_basic</tt></a>, <a class="lpdoc-idx-anchor" id="19" href="ciaodbg_ref_mansearch.html#arithmetic"><tt>arithmetic</tt></a>, <a class="lpdoc-idx-anchor" id="20" href="ciaodbg_ref_mansearch.html#atomic_basic"><tt>atomic_basic</tt></a>, <a class="lpdoc-idx-anchor" id="21" href="ciaodbg_ref_mansearch.html#basiccontrol"><tt>basiccontrol</tt></a>, <a class="lpdoc-idx-anchor" id="22" href="ciaodbg_ref_mansearch.html#exceptions"><tt>exceptions</tt></a>, <a class="lpdoc-idx-anchor" id="23" href="ciaodbg_ref_mansearch.html#term_compare"><tt>term_compare</tt></a>, <a class="lpdoc-idx-anchor" id="24" href="ciaodbg_ref_mansearch.html#term_typing"><tt>term_typing</tt></a>, <a class="lpdoc-idx-anchor" id="25" href="ciaodbg_ref_mansearch.html#debugger_support"><tt>debugger_support</tt></a>, <a class="lpdoc-idx-anchor" id="26" href="ciaodbg_ref_mansearch.html#basic_props"><tt>basic_props</tt></a>, <a class="lpdoc-idx-anchor" id="27" href="ciaodbg_ref_mansearch.html#hiord_rt"><tt>hiord_rt</tt></a>, <a class="lpdoc-idx-anchor" id="28" href="ciaodbg_ref_mansearch.html#stream_basic"><tt>stream_basic</tt></a>.
<li><em>Packages:</em><br/><a class="lpdoc-idx-anchor" id="29" href="ciaodbg_ref_mansearch.html#prelude"><tt>prelude</tt></a>, <a class="lpdoc-idx-anchor" id="30" href="ciaodbg_ref_mansearch.html#initial"><tt>initial</tt></a>, <a class="lpdoc-idx-anchor" id="31" href="ciaodbg_ref_mansearch.html#condcomp"><tt>condcomp</tt></a>, <a class="lpdoc-idx-anchor" id="32" href="ciaodbg_ref_mansearch.html#assertions"><tt>assertions</tt></a>, <a class="lpdoc-idx-anchor" id="33" href="ciaodbg_ref_mansearch.html#assertions/assertions_basic"><tt>assertions/assertions_basic</tt></a>, <a class="lpdoc-idx-anchor" id="34" href="ciaodbg_ref_mansearch.html#hiord"><tt>hiord</tt></a>.
</ul></div></div><div class="lpdoc-footer">Generated with LPdoc using Ciao</div></div><div class="lpdoc-clearer"></div></div></body></html>