annotate test/index.tst @ 20614:10ec79b47808

use new string_value method to handle value extraction errors * __voronoi__.cc, chol.cc, colamd.cc, fftw.cc: Use new string_value method.
author John W. Eaton <jwe@octave.org>
date Thu, 08 Oct 2015 18:15:56 -0400
parents dd6345fd8a97
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: 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
17336
b81b9d079515 Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents: 16215
diff changeset
137 %! ## Dummy shared block to clear any previous definitions
7646
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
16073
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
208 ## bug #38357
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
209 %!shared d, dd
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
210 %! 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
211 %! 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
212 %!assert (d(1), 1);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
213 %!assert (dd(1), 1);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
214 %!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
215 %!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
216 %!assert (d(2), 0);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
217 %!assert (dd(2), 0);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
218 %!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
219 %!error d(6,6);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
220 %!error dd(6,6);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
221 %!error d(3,6);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
222 %!error dd(3,6);
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
223
17642
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
224 ## bug 31287
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
225 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
226 %! y = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
227 %! x = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
228 %! x(false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
229 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
230
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
231 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
232 %! y = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
233 %! x = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
234 %! x(false,[]) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
235 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
236
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
237 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
238 %! y = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
239 %! x = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
240 %! x(false,[],false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
241 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
242
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
243 %!shared x, y
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
244 %! y = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
245 %! x = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
246 %! x(false, 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
247 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
248
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
249 %!shared x, y
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
250 %! y = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
251 %! x = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
252 %! x(false, false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
253 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
254
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
255 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
256 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
257 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
258 %! x([], []) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
259 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
260
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
261 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
262 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
263 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
264 %! x([], []) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
265 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
266
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
267 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
268 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
269 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
270 %! x(1, []) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
271 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
272
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
273 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
274 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
275 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
276 %! x([], 1, []) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
277 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
278
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
279 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
280 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
281 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
282 %! x(1, [], 1, 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
283 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
284
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
285 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
286 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
287 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
288 %! x([], 1, 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
289 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
290
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
291 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
292 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
293 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
294 %! ea2 = ones (3, 2, 0, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
295 %! x(1, ea2) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
296 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
297
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
298 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
299 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
300 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
301 %! ea2 = ones (3, 2, 0, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
302 %! x(1, ea2) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
303 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
304
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
305 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
306 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
307 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
308 %! ea2 = ones (3, 2, 0, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
309 %! x([], 1, ea2) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
310 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
311
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
312 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
313 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
314 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
315 %! ea2 = ones (3, 2, 0, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
316 %! x(1, ea2, ea2) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
317 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
318
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
319 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
320 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
321 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
322 %! ea2 = ones (3, 2, 0, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
323 %! x(1, ea2, 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
324 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
325
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
326 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
327 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
328 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
329 %! x(false, 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
330 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
331
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
332 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
333 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
334 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
335 %! x(false, 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
336 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
337
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
338 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
339 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
340 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
341 %! x(1, [], false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
342 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
343
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
344 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
345 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
346 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
347 %! x(false, false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
348 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
349
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
350 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
351 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
352 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
353 %! x(false, false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
354 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
355
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
356 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
357 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
358 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
359 %! x(false, [], false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
360 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
361
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
362 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
363 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
364 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
365 %! x([], false, false, false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
366 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
367
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
368 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
369 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
370 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
371 %! x(1, [], false, false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
372 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
373
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
374 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
375 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
376 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
377 %! x(:, false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
378 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
379
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
380 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
381 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
382 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
383 %! x(:, false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
384 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
385
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
386 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
387 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
388 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
389 %! x(false, :) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
390 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
391
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
392 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
393 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
394 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
395 %! x(false, :) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
396 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
397
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
398 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
399 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
400 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
401 %! x(false, :, [], 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
402 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
403
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
404 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
405 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
406 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
407 %! x(:, [], false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
408 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
409
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
410 %!shared x, y
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
411 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
412 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
413 %!error x(1, 1, []) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
414
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
415 %!shared x, y
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
416 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
417 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
418 %! x(false, false, 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
419 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
420
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
421 %!shared x, y
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
422 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
423 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
424 %! x(false, false, []) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
425 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
426
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
427 %!shared x, y
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
428 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
429 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
430 %! x(false, false, [], false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
431 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
432
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
433 %!shared x, y
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
434 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
435 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
436 %! x(1, false, [], false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
437 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
438
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
439 %!shared x, y
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
440 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
441 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
442 %! x(:, false, 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
443 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
444
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
445 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
446 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
447 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
448 %! x([]) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
449 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
450
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
451 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
452 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
453 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
454 %! x([]) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
455 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
456
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
457 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
458 %! y = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
459 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
460 %! x(:) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
461 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
462
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
463 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
464 %! y = sparse ([]);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
465 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
466 %! x(:) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
467 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
468
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
469 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
470 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
471 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
472 %! x(false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
473 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
474
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
475 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
476 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
477 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
478 %! x(false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
479 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
480
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
481 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
482 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
483 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
484 %! x([], false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
485 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
486
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
487 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
488 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
489 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
490 %! x([], false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
491 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
492
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
493 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
494 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
495 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
496 %! x([], false, :) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
497 %! assert (x, y);
20574
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
498
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
499
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
500 ## Test indexing of unnamed constants
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
501 %!error <index \(0\); subscripts must be> 1(0)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
502 %!error <index \(-1\); subscripts must be> 1(-1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
503 %!error <index \(_,0.5\); subscripts> {}(1,0.5)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
504 %!error <index \(nan,_\); subscripts> 1(NaN,1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
505 %!error <index \(_,_,<cell....\[x8\]...\); subscripts> [](1,1,{},1,1,1,1,1,1,1,1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
506 %!error <index \(...\[x9\]...-1,_\); subscript> 1(1,1,1,1,1,1,1,1,1,-1,1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
507 %!error <index \(2\); out of bound 1> 1(2)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
508 %!error <index \(1\); out of bound 0> [](1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
509 %!error <index \(_,1\); but object has size 5x0> zeros(5,0)(3,1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
510 %!error <index \(3,_\); but object has size 0x5> zeros(0,5)(3,1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
511 %!error <index \(-1\); subscripts> 1(1)(-1)(1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
512 %!
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
513 %!shared abc
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
514 %! abc = [1, 2];
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
515 %! ## Test full matrices in variables
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
516 %!error <abc\(3\); out of bound 2> abc([false, true, true])
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
517 %!error <abc\(-1\); subscripts> abc(-1)(1)(1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
518 %! ## xerror <index \(-1\); subscripts> abc(1)(-1)(1) ## why no 'xerror' test?
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
519
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
520 %!shared abc
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
521 %! abc = [1 2; 3 4];
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
522 %!error <abc\(5\); out of bound 4> abc(5)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
523 %!error <abc\(_,3\); but abc has size 2x2> abc(2,3)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
524 %!error <abc\(_,_,0.5\); subscripts> exp (abc(2,3,0.5))
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
525
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
526 %!shared abc
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
527 %! abc = [1 2; 3 4]; abc(1,1,2) = 1;
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
528 %!error <abc\(_,5\); out of bound 4> abc(2,5)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
529 %!error <abc\(_,3,_\); but abc has size 2x2x2> abc(2,3,2)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
530 %!error <A\(..,I,..\) = \[\]: .* value 3 out of bound 2> abc(3,:) = []
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
531 %!error <A\(I\) = \[\]: .* value 50 out of bound 8> abc(3:50) = []
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
532 %!error <a null assignment can only have one non-colon index> abc(3,5) = []
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
533 %!error <=: nonconformant arguments \(op1 is 1x1, op2 is 1x5\)> abc(3,5) = 1:5
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
534
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
535 %! ## Test diagonal matrices, and access of function results
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
536 %!error <index \(_,_,5\); but object has size 3x3> eye(3)(2,3,5)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
537 %!error <index \(-2,_\); subscripts> eye(4)(-2,3)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
538
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
539 %! ## Test cells
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
540 %!shared abc
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
541 %! abc = {1, 2; 3, 4};
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
542 %!error <abc\(_,0.3,_\); subscripts> abc(2,0.3,5)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
543 %!error <abc\(_,0.3,_\); subscripts> abc{2,0.3,5}
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
544 %!error <abc\(-2,_,_,_\); subscripts> abc{-2,1,1,1}
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
545 %!error <abc\(0,_,_,_\); subscripts> abc(0,1,1,1) = 1
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
546
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
547 %! ## Test permutation matrices
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
548 %!shared abc
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
549 %! abc = eye(3)([3 1 2],:);
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
550 %!error <abc\(nan\); subscripts> abc(NA)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
551 %!error <abc\(_,_,_,inf,_\); subscripts> abc(1,1,1,Inf,1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
552
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
553 %! ## Test sparse matrices
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
554 %!shared abc
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
555 %! abc = sparse(3,3);
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
556 %!error <abc\(-1\); subscripts> abc(-1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
557 %!error <abc\(-1\); subscripts> abc(-1) = 1
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
558 %!error <abc\(-1,_\); subscripts> abc(-1,1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
559 %!error <abc\(-1,_\); subscripts> abc(-1,1) = 1
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
560 %!error <sparse indexing needs 1 or 2 indices> abc(0,0,0,0)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
561 %!error <abc\(4,_\); but abc has size 3x3> abc(4,1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
562
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
563 %! ## Test ranges
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
564 %!shared abc
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
565 %! abc = 1:10;
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
566 %!error <abc\(-1\); subscripts> abc(-1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
567 %!error <abc\(-1,_\); subscripts> abc(-1,1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
568 %!error <abc\(4,_\); but abc has size 1x10> abc(4,1)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
569
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
570 %! ## Test complex
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
571 %!shared abc, z
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
572 %! abc = [1 2];
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
573 %!error <abc\(0\+1i\); subscripts must be real> abc(i)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
574 %! abc = [1 2; 3 4];
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
575 %!error <abc\(1\+0i\); subscripts must be real> abc(complex(1))
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
576 %!error <abc\(1\+0.5i,_\); subscripts must be real> abc(1+0.5*i,3)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
577 %!error <abc\(_,0-2i\); subscripts must be real> abc(2,0-2*i)
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19731
diff changeset
578