Mercurial > octave
annotate test/if.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:
29359
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:
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/>. |
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 %! i = 0; | |
28 %! if (i == 0) | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
29 %! i++; |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
30 %! __printf_assert__ ("%d\n", i); |
17309
5a65b2cc9508
test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents:
16937
diff
changeset
|
31 %! end # "end" is part of test, check not using "endif" |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
32 %! assert (__prog_output_assert__ ("1")); |
5590 | 33 |
34 %!test | |
35 %! if (eye (2)) | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
36 %! __printf_assert__ ("fail\n"); |
5590 | 37 %! else |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
38 %! __printf_assert__ ("pass\n"); |
17309
5a65b2cc9508
test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents:
16937
diff
changeset
|
39 %! endif |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
40 %! assert (__prog_output_assert__ ("pass")); |
5590 | 41 |
42 %!test | |
43 %! x = 2; | |
44 %! if (eye (2)) | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
45 %! __printf_assert__ ("fail\n"); |
5590 | 46 %! elseif (x) |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
47 %! __printf_assert__ ("pass\n"); |
5590 | 48 %! endif |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
49 %! assert (__prog_output_assert__ ("pass")); |
5590 | 50 |
51 %!test | |
52 %! x = 0; | |
53 %! y = -2; | |
54 %! if (eye (2)) | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
55 %! __printf_assert__ ("fail\n"); |
5590 | 56 %! elseif (x) |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
57 %! __printf_assert__ ("fail\n"); |
5590 | 58 %! elseif (y) |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
59 %! __printf_assert__ ("pass\n"); |
17309
5a65b2cc9508
test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents:
16937
diff
changeset
|
60 %! endif |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
61 %! assert (__prog_output_assert__ ("pass")); |
5590 | 62 |
63 %!test | |
64 %! x = 0; | |
65 %! y = -2; | |
66 %! if (eye (2)) | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
67 %! __printf_assert__ ("fail\n"); |
5590 | 68 %! elseif (x) |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
69 %! __printf_assert__ ("fail\n"); |
5590 | 70 %! elseif (x) |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
71 %! __printf_assert__ ("fail\n"); |
5590 | 72 %! else |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
73 %! __printf_assert__ ("pass\n"); |
5590 | 74 %! endif |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
75 %! assert (__prog_output_assert__ ("pass")); |
5590 | 76 |
77 %!test | |
78 %! x = 0; | |
79 %! y = -2; | |
80 %! if (y) | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
81 %! __printf_assert__ ("pass\n"); |
5590 | 82 %! elseif (x) |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
83 %! __printf_assert__ ("fail\n"); |
5590 | 84 %! elseif (x) |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
85 %! __printf_assert__ ("fail\n"); |
17309
5a65b2cc9508
test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents:
16937
diff
changeset
|
86 %! endif |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
87 %! assert (__prog_output_assert__ ("pass")); |
5590 | 88 |
17309
5a65b2cc9508
test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents:
16937
diff
changeset
|
89 ## test parsing of single-quoted character string appearing at the |
5a65b2cc9508
test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents:
16937
diff
changeset
|
90 ## beginning of an if condition |
16681
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16030
diff
changeset
|
91 %!test |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16030
diff
changeset
|
92 %! if (1) |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16030
diff
changeset
|
93 %! 'foo'; |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16030
diff
changeset
|
94 %! x = 13; |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16030
diff
changeset
|
95 %! endif |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16030
diff
changeset
|
96 %! assert (x, 13); |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16030
diff
changeset
|
97 |
17309
5a65b2cc9508
test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents:
16937
diff
changeset
|
98 ## test parsing of single-quoted character string appearing at the |
5a65b2cc9508
test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents:
16937
diff
changeset
|
99 ## beginning of an if condition |
16681
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16030
diff
changeset
|
100 %!test |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16030
diff
changeset
|
101 %! if (0) |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16030
diff
changeset
|
102 %! x = 42; |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16030
diff
changeset
|
103 %! elseif (1) |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16030
diff
changeset
|
104 %! 'foo'; |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16030
diff
changeset
|
105 %! x = 13; |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16030
diff
changeset
|
106 %! endif |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16030
diff
changeset
|
107 %! assert (x, 13); |
17309
5a65b2cc9508
test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents:
16937
diff
changeset
|
108 |
21990
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
109 ## test "is_true" of different data types |
28907
11f1207111c5
maint: Don't use semicolon at end of single-line BIST tests.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
110 %!error diag (NaN) || 0 |
21990
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
111 %!test |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
112 %! d1 = diag ([]) || 0; |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
113 %! d2 = diag (1) || 0; |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
114 %! d3 = diag ([1 2]) || 0; |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
115 %! assert ([d1 d2 d3], [false true false]); |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
116 |
28907
11f1207111c5
maint: Don't use semicolon at end of single-line BIST tests.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
117 %!error sparse (NaN) || 0 |
11f1207111c5
maint: Don't use semicolon at end of single-line BIST tests.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
118 %!error sparse ([1 1 ; 1 NaN]) || 0 |
21990
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
119 %!test |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
120 %! s1 = sparse ([]) || 0; |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
121 %! s2 = sparse (1) || 0; |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
122 %! s3 = sparse ([1 0 ; 0 2]) || 0; |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
123 %! s4 = sparse ([1 1 ; 1 1]) || 0; |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
124 %! assert ([s1 s2 s3 s4], [false true false true]); |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
125 |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
126 %!test |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
127 %! r1 = (1:10) || 0; |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
128 %! r2 = (-10:-1) || 0; |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
129 %! r3 = (-1:1) || 0; |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
130 %! assert ([r1 r2 r3], [true true false]); |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
131 |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
132 %!test |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
133 %! c1 = [2i 4i] || 0; |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
134 %! c2 = [22 4i] || 0; |
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
135 %! c3 = i || 0; |
28916
ec591c500fa4
maint: Use Octave convention of space after function name in test/.
Rik <rik@octave.org>
parents:
28907
diff
changeset
|
136 %! c4 = complex (0) || 0; |
21990
efce657ceb86
Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
19697
diff
changeset
|
137 %! assert ([c1 c2 c3 c4], [true true true false]); |