Skip to content

Commit dc34df9

Browse files
latest help files
1 parent 112e360 commit dc34df9

File tree

3,556 files changed

+2569080
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,556 files changed

+2569080
-0
lines changed

docs/releases/en_US/latest/CHANGELOG-0.1.x.html

Lines changed: 464 additions & 0 deletions
Large diffs are not rendered by default.

docs/releases/en_US/latest/CHANGELOG-0.2.x.html

Lines changed: 573 additions & 0 deletions
Large diffs are not rendered by default.

docs/releases/en_US/latest/CHANGELOG-0.3.x.html

Lines changed: 642 additions & 0 deletions
Large diffs are not rendered by default.

docs/releases/en_US/latest/CHANGELOG-0.4.x.html

Lines changed: 600 additions & 0 deletions
Large diffs are not rendered by default.

docs/releases/en_US/latest/CHANGELOG-0.5.x.html

Lines changed: 578 additions & 0 deletions
Large diffs are not rendered by default.

docs/releases/en_US/latest/CHANGELOG-0.6.x.html

Lines changed: 743 additions & 0 deletions
Large diffs are not rendered by default.

docs/releases/en_US/latest/CHANGELOG-0.7.x.html

Lines changed: 418 additions & 0 deletions
Large diffs are not rendered by default.

docs/releases/en_US/latest/CHANGELOG.html

Lines changed: 902 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
2+
<html xmlns:ext="http://io.github.nelson_lang/ext" lang="en">
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5+
<title>assert</title>
6+
<link rel="stylesheet" href="highlight.css">
7+
<link rel="stylesheet" href="nelson_common.css">
8+
<script src="nelson_help.js"></script><style>
9+
@media (prefers-color-scheme: dark) {
10+
/* target both class names used in different XSLT outputs */
11+
.chapter-description, .chapter-desc { color: #e6eef8 !important; }
12+
.chapter-description p, .chapter-desc p { color: inherit !important; }
13+
}
14+
@media (prefers-color-scheme: light) {
15+
.chapter-description, .chapter-desc { color: #444 !important; }
16+
.chapter-description p, .chapter-desc p { color: inherit !important; }
17+
}
18+
</style>
19+
</head>
20+
<body>
21+
<a href="./index.html" class="home-summary-link"><button class="home-summary-btn" aria-label="Back to help index"><svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12L12 3l9 9"></path><path d="M9 21V12h6v9"></path><path d="M9 21h6"></path></svg></button></a><div class="header"><div class="title"><span class="keyword-title">assert</span></div></div>
22+
<div class="section syntax-section"><div class="subtitle">Check that condition is true.</div></div>
23+
<div class="section syntax-section">
24+
<div class="section-title">
25+
<span class="syntax-icon">📝</span>Syntax</div>
26+
<pre class="syntax-block"><code class="language-matlab">assert(x)
27+
r = assert(x)
28+
[r, msg] = assert(x)
29+
assert(x, err_msg)
30+
r = assert(x, err_msg)
31+
[r, msg] = assert(x, err_msg)
32+
</code></pre>
33+
</div>
34+
<div class="section">
35+
<div class="section-title">
36+
<span class="syntax-icon">📥</span>Input Arguments</div>
37+
<table class="param-table">
38+
<tr>
39+
<th>Parameter</th>
40+
<th>Description</th>
41+
</tr>
42+
<tr>
43+
<td class="param-name">x</td>
44+
<td>a logical value to be tested for truthfulness.</td>
45+
</tr>
46+
<tr>
47+
<td class="param-name">err_msg</td>
48+
<td>a string containing the custom error message to display in case of assertion failure (optional).</td>
49+
</tr>
50+
</table>
51+
</div>
52+
<div class="section">
53+
<div class="section-title">
54+
<span class="syntax-icon">📤</span>Output Arguments</div>
55+
<table class="param-table">
56+
<tr>
57+
<th>Parameter</th>
58+
<th>Description</th>
59+
</tr>
60+
<tr>
61+
<td class="param-name">r</td>
62+
<td>a logical value: true if the assertion passes, false otherwise.</td>
63+
</tr>
64+
<tr>
65+
<td class="param-name">msg</td>
66+
<td>a string containing the error message. If x == true, then msg == ''. If x == false, then msg contains the assertion failure message.</td>
67+
</tr>
68+
</table>
69+
</div>
70+
<div class="section">
71+
<div class="section-title">
72+
<span class="syntax-icon">📄</span>Description</div>
73+
<div>
74+
<p><b>assert</b> raises an error if the input value is false.</p>
75+
<p>This function also raises an error if the input is not a logical value, ensuring type safety.</p>
76+
<p>When the optional <b>err_msg</b> parameter is provided, it will be used as the error message instead of the default message when the assertion fails.</p>
77+
<p>This is the fundamental assertion function that forms the basis for testing conditions in programs and unit tests.</p>
78+
</div>
79+
</div>
80+
<div class="section">
81+
<div class="section-title">
82+
<span class="syntax-icon">💡</span>Examples</div>
83+
<div class="example">
84+
<div class="example-title">Test assertion failure with custom error message:</div>
85+
<div style="display:flex;align-items:flex-start;gap:8px;">
86+
<pre class="syntax-block" style="flex:1 1 auto;margin:0;"><code class="language-matlab">try
87+
assert(4 == 3, _('error for comparison.'))
88+
catch ME
89+
disp(['Error: ' ME.message])
90+
end</code></pre>
91+
<button class="copy-btn" type="button" onclick="copyExample(this)" title="Copy"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 20 20" fill="none" style="display:block;"><rect x="7" y="3" width="10" height="14" rx="2" fill="white" fill-opacity="0.15" stroke="white" stroke-width="1.2"></rect><rect x="3" y="7" width="10" height="10" rx="2" fill="currentColor"></rect></svg></button>
92+
</div>
93+
</div>
94+
<div class="example">
95+
<div class="example-title">Test successful assertion:</div>
96+
<div style="display:flex;align-items:flex-start;gap:8px;">
97+
<pre class="syntax-block" style="flex:1 1 auto;margin:0;"><code class="language-matlab">assert(5 &gt; 3);
98+
disp('Assertion passed: 5 is greater than 3')</code></pre>
99+
<button class="copy-btn" type="button" onclick="copyExample(this)" title="Copy"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 20 20" fill="none" style="display:block;"><rect x="7" y="3" width="10" height="14" rx="2" fill="white" fill-opacity="0.15" stroke="white" stroke-width="1.2"></rect><rect x="3" y="7" width="10" height="10" rx="2" fill="currentColor"></rect></svg></button>
100+
</div>
101+
</div>
102+
<div class="example">
103+
<div class="example-title">Using return values to handle assertion results:</div>
104+
<div style="display:flex;align-items:flex-start;gap:8px;">
105+
<pre class="syntax-block" style="flex:1 1 auto;margin:0;"><code class="language-matlab">[r, msg] = assert(false, 'This condition is false');
106+
if ~r
107+
disp(['Assertion failed: ' msg])
108+
end</code></pre>
109+
<button class="copy-btn" type="button" onclick="copyExample(this)" title="Copy"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 20 20" fill="none" style="display:block;"><rect x="7" y="3" width="10" height="14" rx="2" fill="white" fill-opacity="0.15" stroke="white" stroke-width="1.2"></rect><rect x="3" y="7" width="10" height="10" rx="2" fill="currentColor"></rect></svg></button>
110+
</div>
111+
</div>
112+
<div class="example">
113+
<div class="example-title">Basic assertion without custom message:</div>
114+
<div style="display:flex;align-items:flex-start;gap:8px;">
115+
<pre class="syntax-block" style="flex:1 1 auto;margin:0;"><code class="language-matlab">x = 10;
116+
assert(x &gt; 0) % Will pass
117+
assert(x &lt; 0) % Will fail with default message</code></pre>
118+
<button class="copy-btn" type="button" onclick="copyExample(this)" title="Copy"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 20 20" fill="none" style="display:block;"><rect x="7" y="3" width="10" height="14" rx="2" fill="white" fill-opacity="0.15" stroke="white" stroke-width="1.2"></rect><rect x="3" y="7" width="10" height="10" rx="2" fill="currentColor"></rect></svg></button>
119+
</div>
120+
</div>
121+
</div>
122+
<div class="section">
123+
<div class="section-title">
124+
<span class="syntax-icon">🔗</span>See Also</div>
125+
<div>
126+
<a class="see-also-link" href="../assert_functions/assert_istrue.html">assert_istrue</a><a class="see-also-link" href="../assert_functions/assert_isfalse.html">assert_isfalse</a><a class="see-also-link" href="../assert_functions/assert_isequal.html">assert_isequal</a><a class="see-also-link" href="../assert_functions/assert_checkerror.html">assert_checkerror</a>
127+
</div>
128+
</div>
129+
<div class="section">
130+
<div class="section-title">
131+
<span class="syntax-icon">🕔</span>Version History</div>
132+
<table class="param-table">
133+
<tr>
134+
<th>Version</th>
135+
<th>Description</th>
136+
</tr>
137+
<tr>
138+
<td class="version">1.0.0</td>
139+
<td>initial version</td>
140+
</tr>
141+
</table>
142+
</div>
143+
<!--Author: Allan CORNET--><div class="section" style="margin-top:40px; text-align:center;">
144+
<a id="github-edit-link" class="github-edit-btn" target="_blank" rel="noopener noreferrer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg><span id="github-edit-text">Edit this page on GitHub</span></a><style>
145+
.github-edit-btn { display:inline-flex; align-items:center; gap:6px; font-size:14px; padding:6px 12px; border:1px solid #ddd; border-radius:4px; background:#f5f5f5; color:#333; text-decoration:none; transition:all 0.2s ease; }
146+
.github-edit-btn:hover { background:#e9e9e9; border-color:#ccc; color:#000; }
147+
</style>
148+
</div>
149+
</body>
150+
</html>
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
2+
<html xmlns:ext="http://io.github.nelson_lang/ext" lang="en">
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5+
<title>assert_checkerror</title>
6+
<link rel="stylesheet" href="highlight.css">
7+
<link rel="stylesheet" href="nelson_common.css">
8+
<script src="nelson_help.js"></script><style>
9+
@media (prefers-color-scheme: dark) {
10+
/* target both class names used in different XSLT outputs */
11+
.chapter-description, .chapter-desc { color: #e6eef8 !important; }
12+
.chapter-description p, .chapter-desc p { color: inherit !important; }
13+
}
14+
@media (prefers-color-scheme: light) {
15+
.chapter-description, .chapter-desc { color: #444 !important; }
16+
.chapter-description p, .chapter-desc p { color: inherit !important; }
17+
}
18+
</style>
19+
</head>
20+
<body>
21+
<a href="./index.html" class="home-summary-link"><button class="home-summary-btn" aria-label="Back to help index"><svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12L12 3l9 9"></path><path d="M9 21V12h6v9"></path><path d="M9 21h6"></path></svg></button></a><div class="header"><div class="title"><span class="keyword-title">assert_checkerror</span></div></div>
22+
<div class="section syntax-section"><div class="subtitle">Check that a command raises the expected error.</div></div>
23+
<div class="section syntax-section">
24+
<div class="section-title">
25+
<span class="syntax-icon">📝</span>Syntax</div>
26+
<pre class="syntax-block"><code class="language-matlab">assert_checkerror(command, expected_error_message)
27+
r = assert_checkerror(command, expected_error_message)
28+
[r, msg] = assert_checkerror(command, expected_error_message)
29+
assert_checkerror(command, expected_error_message, expected_error_identifier)
30+
r = assert_checkerror(command, expected_error_message, expected_error_identifier)
31+
[r, msg] = assert_checkerror(command, expected_error_message, expected_error_identifier)
32+
</code></pre>
33+
</div>
34+
<div class="section">
35+
<div class="section-title">
36+
<span class="syntax-icon">📥</span>Input Arguments</div>
37+
<table class="param-table">
38+
<tr>
39+
<th>Parameter</th>
40+
<th>Description</th>
41+
</tr>
42+
<tr>
43+
<td class="param-name">command</td>
44+
<td>a string containing the command to execute and test for errors.</td>
45+
</tr>
46+
<tr>
47+
<td class="param-name">expected_error_message</td>
48+
<td>a string containing the expected error message that should be raised.</td>
49+
</tr>
50+
<tr>
51+
<td class="param-name">expected_error_identifier</td>
52+
<td>a string containing the expected error identifier (optional).</td>
53+
</tr>
54+
</table>
55+
</div>
56+
<div class="section">
57+
<div class="section-title">
58+
<span class="syntax-icon">📤</span>Output Arguments</div>
59+
<table class="param-table">
60+
<tr>
61+
<th>Parameter</th>
62+
<th>Description</th>
63+
</tr>
64+
<tr>
65+
<td class="param-name">r</td>
66+
<td>a logical value: true if the test passes, false otherwise.</td>
67+
</tr>
68+
<tr>
69+
<td class="param-name">msg</td>
70+
<td>a string containing the error message. If r == true, then msg == ''. If r == false, then msg contains the assertion failure message.</td>
71+
</tr>
72+
</table>
73+
</div>
74+
<div class="section">
75+
<div class="section-title">
76+
<span class="syntax-icon">📄</span>Description</div>
77+
<div>
78+
<p><b>assert_checkerror</b> verifies that executing a command raises the expected error message.</p>
79+
<p>If the command does not raise any error, or if it raises an error with a different message than expected, the assertion fails.</p>
80+
<p>When the optional <b>expected_error_identifier</b> parameter is provided, the function also checks that the error identifier matches the expected one.</p>
81+
<p>This function is particularly useful for unit testing to ensure that invalid inputs or operations properly generate the expected error conditions.</p>
82+
</div>
83+
</div>
84+
<div class="section">
85+
<div class="section-title">
86+
<span class="syntax-icon">💡</span>Examples</div>
87+
<div class="example">
88+
<div class="example-title">Test that cos function with no arguments raises the expected error:</div>
89+
<div style="display:flex;align-items:flex-start;gap:8px;">
90+
<pre class="syntax-block" style="flex:1 1 auto;margin:0;"><code class="language-matlab">assert_checkerror('cos', _('Wrong number of input arguments.'));</code></pre>
91+
<button class="copy-btn" type="button" onclick="copyExample(this)" title="Copy"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 20 20" fill="none" style="display:block;"><rect x="7" y="3" width="10" height="14" rx="2" fill="white" fill-opacity="0.15" stroke="white" stroke-width="1.2"></rect><rect x="3" y="7" width="10" height="10" rx="2" fill="currentColor"></rect></svg></button>
92+
</div>
93+
</div>
94+
<div class="example">
95+
<div class="example-title">Example that demonstrates assertion failure with wrong expected message:</div>
96+
<div style="display:flex;align-items:flex-start;gap:8px;">
97+
<pre class="syntax-block" style="flex:1 1 auto;margin:0;"><code class="language-matlab">try
98+
assert_checkerror('cos', _('Wrong error message.'));
99+
catch ME
100+
disp(['Error: ' ME.message])
101+
end</code></pre>
102+
<button class="copy-btn" type="button" onclick="copyExample(this)" title="Copy"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 20 20" fill="none" style="display:block;"><rect x="7" y="3" width="10" height="14" rx="2" fill="white" fill-opacity="0.15" stroke="white" stroke-width="1.2"></rect><rect x="3" y="7" width="10" height="10" rx="2" fill="currentColor"></rect></svg></button>
103+
</div>
104+
</div>
105+
<div class="example">
106+
<div class="example-title">Test with both error message and error identifier:</div>
107+
<div style="display:flex;align-items:flex-start;gap:8px;">
108+
<pre class="syntax-block" style="flex:1 1 auto;margin:0;"><code class="language-matlab">assert_checkerror('mustBeFinite(NaN)', _('Value must be finite.'), 'Nelson:validators:mustBeFinite')</code></pre>
109+
<button class="copy-btn" type="button" onclick="copyExample(this)" title="Copy"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 20 20" fill="none" style="display:block;"><rect x="7" y="3" width="10" height="14" rx="2" fill="white" fill-opacity="0.15" stroke="white" stroke-width="1.2"></rect><rect x="3" y="7" width="10" height="10" rx="2" fill="currentColor"></rect></svg></button>
110+
</div>
111+
</div>
112+
<div class="example">
113+
<div class="example-title">Using return values to handle assertion results:</div>
114+
<div style="display:flex;align-items:flex-start;gap:8px;">
115+
<pre class="syntax-block" style="flex:1 1 auto;margin:0;"><code class="language-matlab">[r, msg] = assert_checkerror('cos', _('Wrong number of input arguments.'));
116+
if r
117+
disp('Test passed: cos function properly raises expected error')
118+
else
119+
disp(['Test failed: ' msg])
120+
end</code></pre>
121+
<button class="copy-btn" type="button" onclick="copyExample(this)" title="Copy"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 20 20" fill="none" style="display:block;"><rect x="7" y="3" width="10" height="14" rx="2" fill="white" fill-opacity="0.15" stroke="white" stroke-width="1.2"></rect><rect x="3" y="7" width="10" height="10" rx="2" fill="currentColor"></rect></svg></button>
122+
</div>
123+
</div>
124+
</div>
125+
<div class="section">
126+
<div class="section-title">
127+
<span class="syntax-icon">🔗</span>See Also</div>
128+
<div>
129+
<a class="see-also-link" href="../assert_functions/assert_istrue.html">assert_istrue</a><a class="see-also-link" href="../assert_functions/assert_isfalse.html">assert_isfalse</a>
130+
</div>
131+
</div>
132+
<div class="section">
133+
<div class="section-title">
134+
<span class="syntax-icon">🕔</span>Version History</div>
135+
<table class="param-table">
136+
<tr>
137+
<th>Version</th>
138+
<th>Description</th>
139+
</tr>
140+
<tr>
141+
<td class="version">1.0.0</td>
142+
<td>initial version</td>
143+
</tr>
144+
</table>
145+
</div>
146+
<!--Author: Allan CORNET--><div class="section" style="margin-top:40px; text-align:center;">
147+
<a id="github-edit-link" class="github-edit-btn" target="_blank" rel="noopener noreferrer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg><span id="github-edit-text">Edit this page on GitHub</span></a><style>
148+
.github-edit-btn { display:inline-flex; align-items:center; gap:6px; font-size:14px; padding:6px 12px; border:1px solid #ddd; border-radius:4px; background:#f5f5f5; color:#333; text-decoration:none; transition:all 0.2s ease; }
149+
.github-edit-btn:hover { background:#e9e9e9; border-color:#ccc; color:#000; }
150+
</style>
151+
</div>
152+
</body>
153+
</html>

0 commit comments

Comments
 (0)