annotate test/index.tst @ 16215:6fe6ac8bbfdb

test: Remove trailing spaces from ends of lines in test/ directory. * test/bug-31371.tst, test/bug-36025/@testclass/testclass.m, test/build-sparse-tests.sh, test/classes/@CPrecedenceTester2/CPrecedenceTester2.m, test/classes/@CPrecedenceTester3/CPrecedenceTester3.m, test/classes/@Cork/click.m, test/classes/@Dork/Dork.m, test/classes/@Dork/display.m, test/classes/@Dork/gack.m, test/classes/@Gork/cork.m, test/classes/@Gork/gark.m, test/classes/@Gork/subsasgn.m, test/classes/@Pork/Pork.m, test/classes/@Pork/gurk.m, test/classes/@Snork/gick.m, test/classes/@Spork/geek.m, test/error.tst, test/func.tst, test/index.tst, test/io.tst, test/line-continue.tst, test/prefer.tst, test/switch.tst, test/system.tst, test/try.tst: Remove trailing spaces from ends of lines in test/ directory.
author Rik <rik@octave.org>
date Thu, 07 Mar 2013 10:02:13 -0800
parents b1283d4c06c2
children b81b9d079515
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
2 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
3 ## This file is part of Octave.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
4 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
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: 5781
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: 5781
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: 5781
diff changeset
8 ## your option) any later version.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
9 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
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: 5781
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
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: 5781
diff changeset
13 ## General Public License for more details.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
14 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
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: 5781
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: 5781
diff changeset
17 ## <http://www.gnu.org/licenses/>.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
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 %! a = [];
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
21 %! assert (isempty (a));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
22
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
23 %!shared a
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
24 %! a = 1;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
25 %!assert (a(1), 1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
26 %!assert (a(:), 1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
27 %!assert (a(:,:), 1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
28 %!assert (a(1,:), 1)
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16073
diff changeset
29 %!assert (a(:,1), 1)
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
30 %!assert (isempty (a(logical (0))))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
31 %!error a(-1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
32 %!error a(2)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
33 %!error a(2,:)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
34 %!error a(:,2)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
35 %!error a(-1,:)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
36 %!error a(:,-1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
37 %!error a([1,2,3])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
38 %!error a([1;2;3])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
39 %!error a([1,2;3,4])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
40 %!error a([0,1])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
41 %!error a([0;1])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
42 %!error a([-1,0])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
43 %!error a([-1;0])
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
44
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
45 %!shared a, a_prime, mid_a
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
46 %! a = [4,3,2,1];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
47 %! a_prime = [4;3;2;1];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
48 %! mid_a = [3,2];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
49
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
50 %!assert (a(1),4)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
51 %!assert (a(2),3)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
52 %!assert (all (a(:) == a_prime))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
53 %!assert (all (a(1,:) == a))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
54 %!assert (a(:,3),2)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
55 %!assert (all (a(:,:) == a))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
56 %!assert (all (a(logical ([0,1,1,0])) == mid_a))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
57 %!error a(0)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
58 %!error a(5)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
59 %!error a(0,1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
60 %!assert (isempty (a(logical (0),:)))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
61 %!error a(:,0)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
62 %!assert (isempty (a([])))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
63 %!assert (isempty (a([],:)))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
64 %!assert (isempty (a(:,[])))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
65
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
66 %!shared a, a_fvec, a_col_1, a_col_2, a_row_1, a_row_2
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
67 %! a = [1,2;3,4];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
68 %! a_fvec = [1;3;2;4];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
69 %! a_col_1 = [1;3];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
70 %! a_col_2 = [2;4];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
71 %! a_row_1 = [1,2];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
72 %! a_row_2 = [3,4];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
73
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
74 %!assert (all (all (a(:,:) == a)))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
75 %!assert (all (a(:) == a_fvec))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
76 %!error a(0)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
77 %!assert (a(2), 3)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
78
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
79 %% Additional tests
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
80
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
81 %!shared a, b
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
82 %! a = [1,2;3,4];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
83 %! b = a;
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
84 %! b(:,:,2) = [5,6;7,8];
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
85
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
86 %!assert (a(:), [1;3;2;4])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
87 %!assert (a(1:2), [1,3])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
88 %!assert (a(:,:), [1,2;3,4])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
89 %!assert (a(:,1), [1;3])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
90 %!assert (a(1,1), 1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
91 %!assert (a(1:2,1), [1;3])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
92 %!assert (a(:,:,1), [1,2;3,4])
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
93
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
94 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
95 %! c(:,:,1) = [1,2;3,4];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
96 %! c(:,:,2) = [1,2;3,4];
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
97 %! assert (a(:,:,[1,1]), c)
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
98
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
99 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
100 %! c(:,:,1,1) = [1,2;3,4];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
101 %! c(:,:,1,2) = [1,2;3,4];
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
102 %! assert (a(:,:,1,[1,1]), c)
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
103
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
104 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
105 %! c(:,:,1,1) = [1,2;3,4];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
106 %! c(:,:,2,1) = [1,2;3,4];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
107 %! c(:,:,1,2) = [1,2;3,4];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
108 %! c(:,:,2,2) = [1,2;3,4];
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
109 %! assert (a(:,:,[1,1],[1,1]), c)
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
110
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
111 %!assert (a(1,[]), zeros (1,0))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
112 %!assert (a(1,[],[1,1]), zeros (1,0,2))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
113 %!assert (a(1,1,[]), zeros (1,1,0))
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
114
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
115 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
116 %! c (1:10,1) = 1:10;
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
117 %! assert (c, [1:10]');
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
118
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
119 %!assert (b(:), [1; 3; 2; 4; 5; 7; 6; 8])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
120 %!assert (b(:,:), [1, 2, 5, 6; 3, 4, 7, 8])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
121 %!assert (b(:,1), [1;3])
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16073
diff changeset
122 %!assert (b(:,:,:), reshape ([1,3,2,4,5,7,6,8], [2,2,2]))
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
123 %!assert (b(:,1,1), [1;3])
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16073
diff changeset
124 %!assert (b(:,1,1,[1,1]),reshape ([1,3,1,3], [2,1,1,2]))
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
125 %!assert (b(1,3), 5)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
126 %!assert (b(1,[3,4]), [5,6])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
127 %!assert (b(1,1:4), [1,2,5,6])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
128 %!assert (b(1,[],:), zeros (1,0,2))
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16073
diff changeset
129 %!assert (b(1,[]), zeros (1,0))
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
130 %!assert (b(:,3), [5;7])
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
131 %!assert (b([1,2],3), [5;7])
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16073
diff changeset
132 %!assert (b(true (2,1), 3), [5;7])
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16073
diff changeset
133 %!assert (b(false (2,1), 3), zeros (0,1))
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16073
diff changeset
134 %!assert (b([],3), zeros (0,1))
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
135
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
136 %!shared x
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
137 %! # Dummy shared block to clear any previous definitions
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
138 %! x = 1;
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
139
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
140 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
141 %! a(1,:) = [1,3];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
142 %! assert (a, [1,3]);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
143
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
144 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
145 %! a(1,:) = [1;3];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
146 %! assert (a, [1,3]);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
147
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
148 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
149 %! a(:,1) = [1;3];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
150 %! assert (a, [1;3]);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
151
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
152 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
153 %! a = [1,2;3,4];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
154 %! b (1,:,:) = a;
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
155 %! assert (b, reshape (a, [1,2,2]));
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
156
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
157 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
158 %! a(1,1:4,2) = reshape (1:4, [1,1,4]);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
159 %! b(:,:,2) = 1:4;
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
160 %! assert (a, b);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
161
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
162 %!test
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
163 %! a(:,:,:) = 1:4;
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
164 %! assert (a, [1:4]);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
165
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
166 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
167 %! a(:,:,1) = 1:4;;
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
168 %! assert (a, [1:4]);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
169
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
170 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
171 %! a(:,:,1) = [1:4]';
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
172 %! assert (a, [1:4]');
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
173
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
174 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
175 %! a(:,:,1) = reshape (1:4,[1,1,4]);
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
176 %! assert (a, [1:4]');
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
177
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
178 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
179 %! a(:,1,:) = 1:4;
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
180 %! assert (a, reshape (1:4,[1,1,4]));
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
181
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
182 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
183 %! a(:,1,:) = [1:4]';
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
184 %! assert (a, [1:4]');
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
185
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
186 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
187 %! a(:,1,:) = reshape (1:4,[1,1,4]);;
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
188 %! assert (a, [1:4]');
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
189
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
190 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
191 %! a(1,:,:) = 1:4;
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
192 %! assert (a, reshape (1:4,[1,1,4]));
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
193
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
194 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
195 %! a(1,:,:) = [1:4]';
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
196 %! assert (a, [1:4]);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
197
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
198 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
199 %! a(1,:,:) = reshape (1:4,[1,1,4]);
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
200 %! assert (a, [1:4]);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
201
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
202 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
203 %! a(1,:,:,:) = reshape (1:4,[1,1,4]);
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
204 %! assert (a, reshape (1:4,[1,1,1,4]));
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
205
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
206 %!error (a(1:2,1:2) = 1:4)
14127
b5e819930fd5 Give friendlier error message when indexing with default i or j (bug #35157)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14126
diff changeset
207
b5e819930fd5 Give friendlier error message when indexing with default i or j (bug #35157)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14126
diff changeset
208 %!shared x
b5e819930fd5 Give friendlier error message when indexing with default i or j (bug #35157)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14126
diff changeset
209 %! x = 1:5;
b5e819930fd5 Give friendlier error message when indexing with default i or j (bug #35157)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14126
diff changeset
210 %!error <attempted to use a complex scalar as an index> x(i)
b5e819930fd5 Give friendlier error message when indexing with default i or j (bug #35157)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14126
diff changeset
211 %!error <attempted to use a complex scalar as an index> x(j)
b5e819930fd5 Give friendlier error message when indexing with default i or j (bug #35157)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14126
diff changeset
212 %!error <attempted to use a complex scalar as an index> x(1+i)
16073
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
213
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
214 ## bug #38357
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
215 %!shared d, dd
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
216 %! d = diag ([1, 2, 3]);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
217 %! dd = diag ([1, 2, 3], 6, 3);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
218 %!assert (d(1), 1);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
219 %!assert (dd(1), 1);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
220 %!assert (d(3, 3), 3);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
221 %!assert (dd(3, 3), 3);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
222 %!assert (d(2), 0);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
223 %!assert (dd(2), 0);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
224 %!assert (dd(6,1), 0);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
225 %!error d(6,6);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
226 %!error dd(6,6);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
227 %!error d(3,6);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
228 %!error dd(3,6);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
229