Mercurial > octave-nkf
annotate test/for.tst @ 17296:3a9efb68272d ss-3-7-6
snapshot 3.7.6
* configure.ac (OCTAVE_VERSION): Bump to 3.7.6.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 20 Aug 2013 15:17:54 -0400 |
parents | 57fad64de019 |
children | 5a65b2cc9508 |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
14131
diff
changeset
|
1 ## Copyright (C) 2006-2012 John W. Eaton |
7016 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
5590 | 19 %!test |
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); |
5590 | 22 %! end |
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 | 25 |
26 %!test | |
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 | 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 | 32 |
33 %!test | |
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 | 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(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 | 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 | 47 |
48 %!test | |
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 | 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 | 54 |
55 %!test | |
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 | 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 | 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(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 | 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 | 69 |
70 %!test | |
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 | 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 | 79 |
80 %!test | |
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 | 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 | 89 |
6587 | 90 %!test |
91 %! a = [1,3;2,4]; | |
92 %! j = 0; | |
93 %! for i = cat (3, a, 4 + a) | |
94 %! assert (i, [1;2] + 2*j++) | |
95 %! endfor | |
96 | |
97 %!test | |
98 %! a = {1,3;2,4}; | |
6602 | 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 | 101 %! assert (i, {1 + 2*j; 2 + 2*j++}) |
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 |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16213
diff
changeset
|
104 %% test parsing of single-quoted character string appearing at the |
d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
John W. Eaton <jwe@octave.org>
parents:
16213
diff
changeset
|
105 %% beginning of a for loop |
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); |