Mercurial > octave
annotate test/for.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 | 332a6ccac881 |
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:
26946
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:
23925
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:
23925
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:
23925
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 %! for i = 1 | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
28 %! __printf_assert__ ("%d", i); |
17309
5a65b2cc9508
test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents:
16937
diff
changeset
|
29 %! end # "end" is part of test, check not using "endfor" |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
30 %! __printf_assert__ ("\n"); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
31 %! assert (__prog_output_assert__ ("1")); |
5590 | 32 |
33 %!test | |
34 %! for i = 1:4 | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
35 %! __printf_assert__ ("%d", i); |
5590 | 36 %! endfor |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
37 %! __printf_assert__ ("\n"); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
38 %! assert (__prog_output_assert__ ("1234")); |
5590 | 39 |
40 %!test | |
41 %! for i = [1,2,3,4] | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
42 %! __printf_assert__ ("%d", i); |
5590 | 43 %! endfor |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
44 %! __printf_assert__ ("\n"); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
45 %! assert (__prog_output_assert__ ("1234")); |
5590 | 46 |
47 %!test | |
48 %! for i = [1,2;3,4] | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
49 %! __printf_assert__ ("%d", i(1,1)); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
50 %! __printf_assert__ ("%d", i(2,1)); |
5590 | 51 %! endfor |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
52 %! __printf_assert__ ("\n"); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
53 %! assert (__prog_output_assert__ ("1324")); |
5590 | 54 |
55 %!test | |
56 %! for i = I | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
57 %! __printf_assert__ ("%d", imag (i)); |
5590 | 58 %! endfor |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
59 %! __printf_assert__ ("\n"); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
60 %! assert (__prog_output_assert__ ("1")); |
5590 | 61 |
62 %!test | |
63 %! for i = [1,2,3,4]*I | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
64 %! __printf_assert__ ("%d", imag (i)); |
5590 | 65 %! endfor |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
66 %! __printf_assert__ ("\n"); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
67 %! assert (__prog_output_assert__ ("1234")); |
5590 | 68 |
69 %!test | |
70 %! for i = [1,2;3,4]*I | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
71 %! __printf_assert__ ("%d", imag (i(1,1))); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
72 %! __printf_assert__ ("%d", imag (i(2,1))); |
5590 | 73 %! endfor |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
74 %! __printf_assert__ ("\n"); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
75 %! assert (__prog_output_assert__ ("1324")); |
5590 | 76 |
77 %!test | |
78 %! for i = [1,2,3,4] | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
79 %! if (i > 2) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
80 %! break; |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
81 %! endif |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
82 %! __printf_assert__ ("%d", i); |
5590 | 83 %! endfor |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
84 %! __printf_assert__ ("\n"); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
85 %! assert (__prog_output_assert__ ("12")); |
5590 | 86 |
87 %!test | |
88 %! for i = [1,2,3,4] | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
89 %! if (i < 3) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
90 %! continue; |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
91 %! endif |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
92 %! __printf_assert__ ("%d", i); |
5590 | 93 %! endfor |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
94 %! __printf_assert__ ("\n"); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
95 %! assert (__prog_output_assert__ ("34")); |
5590 | 96 |
6587 | 97 %!test |
98 %! a = [1,3;2,4]; | |
99 %! j = 0; | |
100 %! for i = cat (3, a, 4 + a) | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
101 %! assert (i, [1;2] + 2*j++); |
6587 | 102 %! endfor |
103 | |
104 %!test | |
105 %! a = {1,3;2,4}; | |
6602 | 106 %! j = 0; |
16213
b1283d4c06c2
test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
107 %! for i = cat (3, a, cellfun (@(x) 4 + x, a, "UniformOutput", 0)) |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
108 %! assert (i, {1 + 2*j; 2 + 2*j++}); |
6587 | 109 %! endfor |
16681
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16213
diff
changeset
|
110 |
17309
5a65b2cc9508
test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents:
16937
diff
changeset
|
111 ## 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
|
112 ## beginning of a for loop |
16681
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16213
diff
changeset
|
113 %!test |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16213
diff
changeset
|
114 %! for i = 1:5 |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16213
diff
changeset
|
115 %! 'foo'; |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16213
diff
changeset
|
116 %! endfor |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16213
diff
changeset
|
117 %! assert (i, 5); |
17311
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
118 |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
119 %!test |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
120 %! parfor i = 1 |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
121 %! __printf_assert__ ("%d", i); |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
122 %! end # "end" is part of test, check not using "endparfor" |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
123 %! __printf_assert__ ("\n"); |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
124 %! assert (__prog_output_assert__ ("1")); |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
125 |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
126 %!test |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
127 %! parfor i = 1:4 |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
128 %! __printf_assert__ ("%d", i); |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
129 %! endparfor |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
130 %! __printf_assert__ ("\n"); |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
131 %! assert (__prog_output_assert__ ("1234")); |
23514
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
132 |
26946
04e5cb5e2cb3
update bug status in tests
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
133 %!test <*50893> |
23563
614d71cdf614
maint: Strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
23514
diff
changeset
|
134 %! cnt = 0; |
23514
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
135 %! for k = zeros (0,3); |
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
136 %! cnt++; |
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
137 %! endfor |
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
138 %! assert (cnt, 0); |
23925
d64985eaf56d
Change failing BIST tests to pass with Octave-expected values.
Rik <rik@octave.org>
parents:
23573
diff
changeset
|
139 %! assert (k, zeros (0,3)); |
23514
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
140 |
26946
04e5cb5e2cb3
update bug status in tests
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
141 %!test <*50893> |
23563
614d71cdf614
maint: Strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
23514
diff
changeset
|
142 %! cnt = 0; |
23514
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
143 %! for k = zeros (3,0); |
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
144 %! cnt++; |
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
145 %! endfor |
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
146 %! assert (cnt, 0); |
23925
d64985eaf56d
Change failing BIST tests to pass with Octave-expected values.
Rik <rik@octave.org>
parents:
23573
diff
changeset
|
147 %! assert (k, zeros (3,0)); |
23514
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
148 |
26946
04e5cb5e2cb3
update bug status in tests
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
149 %!test <*50893> |
23563
614d71cdf614
maint: Strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
23514
diff
changeset
|
150 %! cnt = 0; |
23514
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
151 %! for k = zeros (3,0, "uint32"); |
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
152 %! cnt++; |
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
153 %! endfor |
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
154 %! assert (cnt, 0); |
23925
d64985eaf56d
Change failing BIST tests to pass with Octave-expected values.
Rik <rik@octave.org>
parents:
23573
diff
changeset
|
155 %! assert (k, zeros (3,0, "uint32")); |
23514
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
156 |
26946
04e5cb5e2cb3
update bug status in tests
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
157 %!test <*50893> |
23563
614d71cdf614
maint: Strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
23514
diff
changeset
|
158 %! cnt = 0; |
23514
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
159 %! for k = cell (0,3); |
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
160 %! cnt++; |
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
161 %! endfor |
fd7a16594614
Don't iterate over empty for loop expressions (bug #50893).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
162 %! assert (cnt, 0); |
23925
d64985eaf56d
Change failing BIST tests to pass with Octave-expected values.
Rik <rik@octave.org>
parents:
23573
diff
changeset
|
163 %! assert (k, cell (0,3)); |
28592
e70c859c4bff
allow infinite limits on for loop ranges (bug #45143)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
164 |
28593
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
165 %!test <*45143> |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
166 %! warning ("on", "Octave:infinite-loop", "local"); |
28592
e70c859c4bff
allow infinite limits on for loop ranges (bug #45143)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
167 %! fail ("for i = 0:inf; break; end", "warning", |
e70c859c4bff
allow infinite limits on for loop ranges (bug #45143)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
168 %! "FOR loop limit is infinite"); |
e70c859c4bff
allow infinite limits on for loop ranges (bug #45143)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
169 %! |
e70c859c4bff
allow infinite limits on for loop ranges (bug #45143)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
170 %! fail ("for i = 0:-1:-inf; break; end", "warning", |
e70c859c4bff
allow infinite limits on for loop ranges (bug #45143)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
171 %! "FOR loop limit is infinite"); |
e70c859c4bff
allow infinite limits on for loop ranges (bug #45143)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
172 |
28593
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
173 %!test <*45143> |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
174 %! warning ("on", "Octave:infinite-loop", "local"); |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
175 %! k = 0; |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
176 %! for i = 1:Inf |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
177 %! if (++k > 10) |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
178 %! break; |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
179 %! endif |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
180 %! endfor |
28592
e70c859c4bff
allow infinite limits on for loop ranges (bug #45143)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
181 %! assert (i, 11); |
28593
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
182 %! |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
183 %! k = 0; |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
184 %! for i = -1:-1:-Inf |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
185 %! if (++k > 10) |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
186 %! break; |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
187 %! endif |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
188 %! endfor |
28592
e70c859c4bff
allow infinite limits on for loop ranges (bug #45143)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
189 %! assert (i, -11); |
28593
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
190 %! |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
191 %! k = 0; |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
192 %! for i = 1:-Inf |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
193 %! if (++k > 10) |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
194 %! break; |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
195 %! endif |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
196 %! endfor |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
197 %! assert (i, zeros (1,0)); |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
198 %! |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
199 %! k = 0; |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
200 %! for i = 0:-1:Inf |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
201 %! if (++k > 10) |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
202 %! break; |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
203 %! endif |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
204 %! endfor |
a9f1a922367b
New warning ID "Octave:infinite-loop" (bug #45143).
Rik <rik@octave.org>
parents:
28592
diff
changeset
|
205 %! assert (i, zeros (1,0)); |