Mercurial > octave
annotate test/prefer.tst @ 31249:de6fc38c78c6
Make Jacobian types offered by dlsode.f accessible by lsode (bug #31626).
* liboctave/numeric/LSODE-opts.in: Add options "jacobian type", "lower jacobian
subdiagonals", and "upper jacobian subdiagonals".
* liboctave/numeric/LSODE.cc (file scope, lsode_j,
LSODE::do_integrate (double)): Handle new configurable Jacobian types.
* build-aux/mk-opts.pl: Don't implicitly convert to integer in condition.
author | Olaf Till <olaf.till@uni-jena.de> |
---|---|
date | Fri, 12 Nov 2010 08:53:05 +0100 |
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:
29358
diff
changeset
|
3 ## Copyright (C) 2006-2022 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26596
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/>. |
7016 | 7 ## |
8 ## This file is part of Octave. | |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
7016 | 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:
23220
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## (at your option) any later version. |
7016 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## GNU General Public License for more details. |
7016 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
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:
23220
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 ######################################################################## |
7016 | 25 |
5590 | 26 %!test |
27 %! m = [3 2]; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
28 %! assert (all (m == (3:-1:2))); |
5590 | 29 |
30 %!test | |
31 %! m = [3, | |
32 %! 2]; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
33 %! assert (all (m == (3:-1:2)')); |
5590 | 34 |
35 %!test | |
36 %! a = 2; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
37 %! assert ([a - 1], 1); |
5590 | 38 |
39 %!test | |
40 %! m = [3,2]; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
41 %! fail ("[m ']"); |
5590 | 42 |
21317
a4faec57f4c8
maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
43 %!assert (all ([3 2] == (3:-1:2))) |
5590 | 44 |
21317
a4faec57f4c8
maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
45 %!assert (all ([3, 2] == (3:-1:2))) |
5590 | 46 |
47 %!test | |
48 %! m = [3,2]; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
49 %! assert (all ([m (1)] == (3:-1:1))); |
5590 | 50 |
51 %!test | |
52 %! m = [3,2]; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
53 %! assert ([m(1)],3); |
5590 | 54 |
55 %!test | |
56 %! a = 2; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
57 %! assert ([a- 1], 1); |
5590 | 58 |
59 %!test | |
60 %! a = 1; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
61 %! assert (all ([a -1] == (1:-2:-1))); |
5590 | 62 |
63 %!test | |
5781 | 64 %! wsn = warning ("query", "Octave:str-to-num"); |
65 %! warning ("off", "Octave:str-to-num"); | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
66 %! assert ("d" + 0, 100); |
5781 | 67 %! warning (wsn.state, "Octave:str-to-num"); |
5590 | 68 |
69 %!test | |
5781 | 70 %! wsn = warning ("query", "Octave:str-to-num"); |
71 %! warning ("on", "Octave:str-to-num"); | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
72 %! fail ("'d' + 0", "warning"); |
5781 | 73 %! warning (wsn.state, "Octave:str-to-num"); |
5590 | 74 |
75 %!test | |
19022
cf24eef5051d
prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
76 %! wir = warning ("query", "Octave:imag-to-real"); |
cf24eef5051d
prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
77 %! warning ("off", "Octave:imag-to-real"); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
78 %! assert (eye (1+i), 1); |
19022
cf24eef5051d
prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
79 %! warning (wir.state, "Octave:imag-to-real"); |
5590 | 80 |
81 %!test | |
19022
cf24eef5051d
prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
82 %! wir = warning ("query", "Octave:imag-to-real"); |
cf24eef5051d
prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
83 %! warning ("on", "Octave:imag-to-real"); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
84 %! fail ("eye (1+i)", "warning"); |
19022
cf24eef5051d
prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
85 %! warning (wir.state, "Octave:imag-to-real"); |
5590 | 86 |
87 %!test | |
5781 | 88 %! wrre = warning ("query", "Octave:resize-on-range-error"); |
89 %! warning ("off", "Octave:resize-on-range-error"); | |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
90 %! clear a; |
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
91 %! a(2) = 1; a(3) = 2; |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
92 %! assert (all (a == [0,1,2])); |
5781 | 93 %! warning (wrre.state, "Octave:resize-on-range-error"); |
5590 | 94 |
95 %!test | |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
96 %! clear a; |
5590 | 97 %! a(1) = 1; a(2) = 2; |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
98 %! assert (all (a == [1,2])); |
5590 | 99 |
100 %!test | |
5794 | 101 %! ped = print_empty_dimensions (); |
102 %! print_empty_dimensions (0); | |
5590 | 103 %! a = cell (1, 1); |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
8583
diff
changeset
|
104 %! b = type ("-q", "a"); |
25760
2ccad4396afc
findstr.m: Make m-file a legacy function.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
105 %! assert (! isempty (strfind (b{1}, "[]"))); |
2ccad4396afc
findstr.m: Make m-file a legacy function.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
106 %! assert (isempty (strfind (b{1} ,"[](0x0)"))); |
5794 | 107 %! print_empty_dimensions (ped); |
5590 | 108 |
109 %!test | |
5794 | 110 %! ped = print_empty_dimensions (); |
111 %! print_empty_dimensions (1); | |
5590 | 112 %! a = cell (1, 1); |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
8583
diff
changeset
|
113 %! b = type ("-q", "a"); |
25760
2ccad4396afc
findstr.m: Make m-file a legacy function.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
114 %! assert (! isempty (strfind (b{1}, "[](0x0)"))); |
5794 | 115 %! print_empty_dimensions (ped); |
5590 | 116 |
21317
a4faec57f4c8
maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
117 %!assert (all (size (inv ([])) == [0, 0])) |
5590 | 118 |
21317
a4faec57f4c8
maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
119 %!assert (all (svd ([]) == zeros (0, 1))) |
5590 | 120 |
121 %!test | |
5794 | 122 %! sp = save_precision (); |
123 %! save_precision (1); | |
5590 | 124 %! x = pi; |
19278
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19022
diff
changeset
|
125 %! nm = tempname (); |
16213
b1283d4c06c2
test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
126 %! save ("-text", nm, "x"); |
5590 | 127 %! clear x; |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
128 %! load (nm); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
129 %! unlink (nm); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
130 %! assert (x,3); |
5794 | 131 %! save_precision (sp); |
5590 | 132 |
133 %!test | |
5794 | 134 %! sp = save_precision (); |
135 %! save_precision (5); | |
5590 | 136 %! x = pi; |
19278
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19022
diff
changeset
|
137 %! nm = tempname (); |
16213
b1283d4c06c2
test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
138 %! save ("-text", nm, "x"); |
5590 | 139 %! clear x; |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
140 %! load (nm); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
141 %! unlink (nm); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
142 %! assert (x, 3.1416); |
5794 | 143 %! save_precision (sp); |
5590 | 144 |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
145 %% FIXME: How to capture standard output for comparison? |
5590 | 146 %!function f () |
147 %! 1 | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
148 %!endfunction |
5590 | 149 %!#test |
5794 | 150 %! sf = silent_functions (); |
151 %! silent_functions (0); | |
5590 | 152 %! f |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
153 %! assert (??); |
5794 | 154 %! silent_functions (sf); |
5590 | 155 |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
156 %% FIXME: Same problem as above!!! |
5590 | 157 %!function f () |
158 %! 1 | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
159 %!endfunction |
5590 | 160 %!#test |
5794 | 161 %! sf = silent_functions (); |
162 %! silent_functions (1); | |
5590 | 163 %! f |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
164 %! assert (??); |
5794 | 165 %! silent_functions (sf); |
5590 | 166 |
167 %!test | |
5781 | 168 %! wndz = warning ("query", "Octave:neg-dim-as-zero"); |
169 %! warning ("on", "Octave:neg-dim-as-zero"); | |
19022
cf24eef5051d
prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
170 %! fail ("eye (-1) == []", "warning", "converting negative dimension"); |
5781 | 171 %! warning (wndz.state, "Octave:neg-dim-as-zero"); |
5590 | 172 |
173 %!test | |
5781 | 174 %! wndz = warning ("query", "Octave:neg-dim-as-zero"); |
175 %! warning ("off", "Octave:neg-dim-as-zero"); | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
176 %! assert (all (size (eye (-1)) == [0, 0])); |
5781 | 177 %! warning (wndz.state, "Octave:neg-dim-as-zero"); |
5590 | 178 |
179 %!test | |
5781 | 180 %! watv = warning ("query", "Octave:assign-as-truth-value"); |
181 %! warning ("on", "Octave:assign-as-truth-value"); | |
19022
cf24eef5051d
prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
182 %! fail ("if (x = 1) 1; endif", "warning", "assignment used as truth value"); |
5781 | 183 %! warning (watv.state, "Octave:assign-as-truth-value"); |
5590 | 184 |
185 %!test | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
186 %! assert (isinf (1/0)); |
5590 | 187 |
188 %!test | |
189 %! a = 1; | |
190 %! b = 0; | |
26596
cc0d942d0e20
Remove inconsistent warning "Octave:divide-by-zero" (bug #46650).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26376
diff
changeset
|
191 %! assert (isinf (a/b)); |