annotate test/for.tst @ 20595:c1a6c31ac29a

eliminate more simple uses of error_state * ov-classdef.cc: Eliminate simple uses of error_state.
author John W. Eaton <jwe@octave.org>
date Tue, 06 Oct 2015 00:20:02 -0400
parents 4197fc428c7d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19731
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
1 ## Copyright (C) 2006-2015 John W. Eaton
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
2 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
3 ## This file is part of Octave.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
4 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
6 ## under the terms of the GNU General Public License as published by
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
8 ## your option) any later version.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
9 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
13 ## General Public License for more details.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
14 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
15 ## You should have received a copy of the GNU General Public License
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
17 ## <http://www.gnu.org/licenses/>.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6602
diff changeset
18
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
19 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
20 %! for i = 1
16019
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
21 %! __printf_assert__ ("%d", i);
17309
5a65b2cc9508 test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents: 16937
diff changeset
22 %! 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
23 %! __printf_assert__ ("\n");
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
24 %! assert (__prog_output_assert__ ("1"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
25
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
26 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
27 %! for i = 1:4
16019
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
28 %! __printf_assert__ ("%d", i);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
29 %! 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__ ("1234"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
32
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
33 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
34 %! 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
35 %! __printf_assert__ ("%d", i);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
39
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
40 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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(1,1));
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
43 %! __printf_assert__ ("%d", i(2,1));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
44 %! endfor
16019
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
45 %! __printf_assert__ ("\n");
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
46 %! assert (__prog_output_assert__ ("1324"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
47
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
48 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
49 %! for i = I
16019
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
50 %! __printf_assert__ ("%d", imag (i));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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__ ("1"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
54
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
55 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
56 %! 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
57 %! __printf_assert__ ("%d", imag (i));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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__ ("1234"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
61
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
62 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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(1,1)));
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
65 %! __printf_assert__ ("%d", imag (i(2,1)));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
66 %! endfor
16019
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
67 %! __printf_assert__ ("\n");
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
68 %! assert (__prog_output_assert__ ("1324"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
69
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
70 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
71 %! 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
72 %! if (i > 2)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
73 %! break;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
74 %! endif
16019
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
75 %! __printf_assert__ ("%d", i);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
76 %! endfor
16019
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
77 %! __printf_assert__ ("\n");
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
78 %! assert (__prog_output_assert__ ("12"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
79
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
80 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
81 %! 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
82 %! if (i < 3)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
83 %! continue;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
84 %! endif
16019
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
85 %! __printf_assert__ ("%d", i);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
86 %! endfor
16019
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
87 %! __printf_assert__ ("\n");
5b2126a8c84f install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
88 %! assert (__prog_output_assert__ ("34"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
89
6587
00fad3bad2a5 [project @ 2007-04-26 20:23:31 by dbateman]
dbateman
parents: 5590
diff changeset
90 %!test
00fad3bad2a5 [project @ 2007-04-26 20:23:31 by dbateman]
dbateman
parents: 5590
diff changeset
91 %! a = [1,3;2,4];
00fad3bad2a5 [project @ 2007-04-26 20:23:31 by dbateman]
dbateman
parents: 5590
diff changeset
92 %! j = 0;
00fad3bad2a5 [project @ 2007-04-26 20:23:31 by dbateman]
dbateman
parents: 5590
diff changeset
93 %! for i = cat (3, a, 4 + a)
00fad3bad2a5 [project @ 2007-04-26 20:23:31 by dbateman]
dbateman
parents: 5590
diff changeset
94 %! assert (i, [1;2] + 2*j++)
00fad3bad2a5 [project @ 2007-04-26 20:23:31 by dbateman]
dbateman
parents: 5590
diff changeset
95 %! endfor
00fad3bad2a5 [project @ 2007-04-26 20:23:31 by dbateman]
dbateman
parents: 5590
diff changeset
96
00fad3bad2a5 [project @ 2007-04-26 20:23:31 by dbateman]
dbateman
parents: 5590
diff changeset
97 %!test
00fad3bad2a5 [project @ 2007-04-26 20:23:31 by dbateman]
dbateman
parents: 5590
diff changeset
98 %! a = {1,3;2,4};
6602
8ebd4f842715 [project @ 2007-04-30 17:12:45 by jwe]
jwe
parents: 6587
diff changeset
99 %! j = 0;
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16030
diff changeset
100 %! for i = cat (3, a, cellfun (@(x) 4 + x, a, "UniformOutput", 0))
6587
00fad3bad2a5 [project @ 2007-04-26 20:23:31 by dbateman]
dbateman
parents: 5590
diff changeset
101 %! assert (i, {1 + 2*j; 2 + 2*j++})
00fad3bad2a5 [project @ 2007-04-26 20:23:31 by dbateman]
dbateman
parents: 5590
diff changeset
102 %! endfor
16681
d3619d4d267c recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents: 16213
diff changeset
103
17309
5a65b2cc9508 test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents: 16937
diff changeset
104 ## 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
105 ## 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
106 %!test
d3619d4d267c recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents: 16213
diff changeset
107 %! 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
108 %! 'foo';
d3619d4d267c recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents: 16213
diff changeset
109 %! endfor
d3619d4d267c recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents: 16213
diff changeset
110 %! assert (i, 5);
17311
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
111
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
112 %!test
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
113 %! parfor i = 1
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
114 %! __printf_assert__ ("%d", i);
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
115 %! 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
116 %! __printf_assert__ ("\n");
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
117 %! assert (__prog_output_assert__ ("1"));
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:4
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 %! 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__ ("1234"));
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
125