Mercurial > octave
annotate test/command.tst @ 31214:19bd1953fc1d stable
GitHub-CI: Remove ubuntu-18.04 runners from build matrix.
* .github/workflow/make.yaml (ubuntu): GitHub-hosted runners for ubuntu-18.04
are being deprecated. Remove them from build matrix. See also:
https://github.com/actions/runner-images/issues/6002
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Tue, 30 Aug 2022 11:16:27 +0200 |
parents | 796f54d4ddbf |
children | 597f3ee61a48 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3 ## Copyright (C) 2014-2022 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
22799
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
21580
diff
changeset
|
7 ## |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
21580
diff
changeset
|
8 ## This file is part of Octave. |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
21580
diff
changeset
|
9 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23221
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
22799
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
21580
diff
changeset
|
11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23221
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22799
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
21580
diff
changeset
|
13 ## (at your option) any later version. |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
21580
diff
changeset
|
14 ## |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
21580
diff
changeset
|
15 ## Octave is distributed in the hope that it will be useful, but |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
21580
diff
changeset
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
21580
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
21580
diff
changeset
|
18 ## GNU General Public License for more details. |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
21580
diff
changeset
|
19 ## |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
21580
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
21580
diff
changeset
|
21 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23221
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
22799
592fa741e0aa
add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents:
21580
diff
changeset
|
25 |
18234 | 26 ## Don't alter the spacing in the command_test lines. These are |
27 ## specifically testing for possible differences in things like | |
28 ## A(X) or A( X ) or A (X) or A ( X ) | |
29 | |
30 %!function command_test (varargin) | |
31 %! assignin ('caller', 'cmd_out', ['|', sprintf('%s|', varargin{:})]); | |
32 %!endfunction | |
33 | |
34 %!function gobble_command (varargin) | |
35 %!endfunction | |
36 | |
37 ## 0, 1, 2, 3 simple arguments | |
38 %!test | |
39 %! command_test | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
40 %! assert (cmd_out, '|'); |
18234 | 41 %!test |
42 %! command_test a | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
43 %! assert (cmd_out, '|a|'); |
18234 | 44 %!test |
45 %! command_test aa b | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
46 %! assert (cmd_out, '|aa|b|'); |
18234 | 47 %!test |
48 %! command_test aaa bb c | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
49 %! assert (cmd_out, '|aaa|bb|c|'); |
18234 | 50 |
51 ## continuation | |
52 %!test | |
53 %! command_test a... | |
54 %! bb ccc | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
55 %! assert (cmd_out, '|a|bb|ccc|'); |
18234 | 56 %!test |
57 %! command_test a ... | |
58 %! bb ccc | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
59 %! assert (cmd_out, '|a|bb|ccc|'); |
18234 | 60 %!test |
61 %! command_test aa(... | |
62 %! bb cc | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
63 %! assert (cmd_out, '|aa(|bb|cc|'); |
18234 | 64 %!test |
65 %! command_test aa( ... | |
66 %! bb cc | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
67 %! assert (cmd_out, '|aa( |bb|cc|'); |
18234 | 68 |
69 ## comments | |
70 %!test | |
71 %! command_test aa bb cc%comment | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
72 %! assert (cmd_out, '|aa|bb|cc|'); |
18234 | 73 %!test |
74 %! command_test aa bb cc#comment | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
75 %! assert (cmd_out, '|aa|bb|cc|'); |
18234 | 76 %!test |
77 %! command_test aa bb cc %comment | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
78 %! assert (cmd_out, '|aa|bb|cc|'); |
18234 | 79 %!test |
80 %! command_test aa bb cc #comment | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
81 %! assert (cmd_out, '|aa|bb|cc|'); |
18234 | 82 %!test |
83 %! command_test aa bb cc( %comment | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
84 %! assert (cmd_out, '|aa|bb|cc( |'); |
18234 | 85 %!test |
86 %! command_test aa bb cc( #comment | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
87 %! assert (cmd_out, '|aa|bb|cc( |'); |
18234 | 88 |
89 ## semicolons and commas; multiple commands | |
90 %!test | |
91 %! command_test aa bb, gobble_command cc | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
92 %! assert (cmd_out, '|aa|bb|'); |
18234 | 93 %!test |
94 %! command_test aa bb ; gobble_command cc | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
95 %! assert (cmd_out, '|aa|bb|'); |
18234 | 96 %!test |
97 %! command_test aa bb ; command_test cc dd | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
98 %! assert (cmd_out, '|cc|dd|'); |
18234 | 99 %!test |
100 %! command_test aa bb | |
101 %!test | |
102 %! command_test cc dd | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
103 %! assert (cmd_out, '|cc|dd|'); |
18234 | 104 |
105 ## parenthesis matching | |
106 %!test | |
107 %! command_test aa(bb,cc,dd) ee(ff,gg) hh | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
108 %! assert (cmd_out, '|aa(bb,cc,dd)|ee(ff,gg)|hh|'); |
18234 | 109 %!test |
110 %! command_test aa([bb,cc)] | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
111 %! assert (cmd_out, '|aa([bb,cc)]|'); |
18234 | 112 %!test |
113 %! command_test aa(,@!$@"bb"'cc' | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
114 %! assert (cmd_out, '|aa(,@!$@"bb"''cc''|'); |
18234 | 115 %!test |
116 %! command_test aa(bb,cc,dd) | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
117 %! assert (cmd_out, '|aa(bb,cc,dd)|'); |
18234 | 118 %!test |
119 %! command_test aa( bb,cc,dd ) | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
120 %! assert (cmd_out, '|aa( bb,cc,dd )|'); |
18234 | 121 %!test |
122 %! command_test aa (bb,cc,dd) | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
123 %! assert (cmd_out, '|aa|(bb,cc,dd)|'); |
18234 | 124 %!test |
125 %! command_test aa ( bb,cc,dd ) | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
126 %! assert (cmd_out, '|aa|( bb,cc,dd )|'); |
18234 | 127 %!test |
128 %! command_test aa(bb, cc, dd) | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
129 %! assert (cmd_out, '|aa(bb, cc, dd)|'); |
18234 | 130 %!test |
131 %! command_test aa( bb, cc, dd ) | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
132 %! assert (cmd_out, '|aa( bb, cc, dd )|'); |
18234 | 133 %!test |
134 %! command_test aa (bb, cc, dd) | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
135 %! assert (cmd_out, '|aa|(bb, cc, dd)|'); |
18234 | 136 %!test |
137 %! command_test aa ( bb, cc, dd ) | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
138 %! assert (cmd_out, '|aa|( bb, cc, dd )|'); |
18234 | 139 |
140 ## single and double quotes | |
141 %!test | |
142 %! command_test "aa" 'bb' cc | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
143 %! assert (cmd_out, '|aa|bb|cc|'); |
18234 | 144 %!test |
145 %! command_test "aa"'bb'cc | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
146 %! assert (cmd_out, '|aabbcc|'); |
18234 | 147 %!test |
148 %! command_test aa'bb'"cc" | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
149 %! assert (cmd_out, '|aabbcc|'); |
18234 | 150 %!test |
151 %! command_test "aa"bb'cc' | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
152 %! assert (cmd_out, '|aabbcc|'); |
18234 | 153 |
154 ## CVX-inspired | |
155 %!test | |
156 %! command_test Z(n,n) hermitian toeplitz | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
157 %! assert (cmd_out, '|Z(n,n)|hermitian|toeplitz|'); |
18234 | 158 %!test |
159 %! command_test X( n, n ) symmetric | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
160 %! assert (cmd_out, '|X( n, n )|symmetric|'); |
18234 | 161 %!test |
162 %! command_test xw( nm-1, nv ); | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
163 %! assert (cmd_out, '|xw( nm-1, nv )|'); |
18234 | 164 %!test |
165 %! command_test x( sx ) y( sx ) z( sx ) | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
166 %! assert (cmd_out, '|x( sx )|y( sx )|z( sx )|'); |
18234 | 167 %!test |
168 %! command_test coeffs(deg+1) complex; | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
169 %! assert (cmd_out, '|coeffs(deg+1)|complex|'); |
18234 | 170 %!test |
171 %! command_test w( 1, npairs * nv ) v( 1, npairs * nv ) | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
172 %! assert (cmd_out, '|w( 1, npairs * nv )|v( 1, npairs * nv )|'); |
18234 | 173 %!test |
174 %! command_test w(m,1) % edge weights | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
18234
diff
changeset
|
175 %! assert (cmd_out, '|w(m,1)|'); |
18234 | 176 %!test |
28916
ec591c500fa4
maint: Use Octave convention of space after function name in test/.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
177 %! command_test x2( size ( x ) ) |
ec591c500fa4
maint: Use Octave convention of space after function name in test/.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
178 %! assert (cmd_out, '|x2( size ( x ) )|'); |