annotate test/index.tst @ 33603:ea261407cb9f bytecode-interpreter tip

maint: Merge default to bytecode-interpreter
author Arun Giridhar <arungiridhar@gmail.com>
date Sat, 18 May 2024 17:42:42 -0400
parents 2e484f9f1f18
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 32171
diff changeset
3 ## Copyright (C) 2006-2024 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
7 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
8 ## This file is part of Octave.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
13 ## (at your option) any later version.
7016
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 ## 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
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
18 ## GNU General Public License for more details.
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
19 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
20 ## 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
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
25
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
26 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
27 %! a = [];
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
28 %! assert (isempty (a));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
29
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
30 %!shared a
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
31 %! a = 1;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
32 %!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
33 %!assert (a(:), 1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
34 %!assert (a(:,:), 1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
35 %!assert (a(1,:), 1)
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16073
diff changeset
36 %!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
37 %!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
38 %!error a(-1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
39 %!error a(2)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
40 %!error a(2,:)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
41 %!error a(:,2)
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,:)
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)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
44 %!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
45 %!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
46 %!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
47 %!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
48 %!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
49 %!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
50 %!error a([-1;0])
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
51
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
52 %!shared a, a_prime, mid_a
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
53 %! a = [4,3,2,1];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
54 %! a_prime = [4;3;2;1];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
55 %! mid_a = [3,2];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
56
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
57 %!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
58 %!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
59 %!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
60 %!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
61 %!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
62 %!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
63 %!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
64 %!error a(0)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
65 %!error a(5)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
66 %!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
67 %!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
68 %!error a(:,0)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
69 %!assert (isempty (a([])))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
70 %!assert (isempty (a([],:)))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
71 %!assert (isempty (a(:,[])))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
72
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
73 %!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
74 %! a = [1,2;3,4];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
75 %! a_fvec = [1;3;2;4];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
76 %! a_col_1 = [1;3];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
77 %! a_col_2 = [2;4];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
78 %! a_row_1 = [1,2];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
79 %! a_row_2 = [3,4];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
80
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
81 %!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
82 %!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
83 %!error a(0)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
84 %!assert (a(2), 3)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
85
25807
cb775c73866d Don't print fractional part of an invalid NaN index.
Rik <rik@octave.org>
parents: 25680
diff changeset
86 ## Additional tests
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
87
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
88 %!shared a, b
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
89 %! a = [1,2;3,4];
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
90 %! b = a;
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
91 %! b(:,:,2) = [5,6;7,8];
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
92
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
93 %!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
94 %!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
95 %!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
96 %!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
97 %!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
98 %!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
99 %!assert (a(:,:,1), [1,2;3,4])
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
100
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
101 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
102 %! c(:,:,1) = [1,2;3,4];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
103 %! c(:,:,2) = [1,2;3,4];
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21317
diff changeset
104 %! assert (a(:,:,[1,1]), c);
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
105
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
106 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
107 %! c(:,:,1,1) = [1,2;3,4];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
108 %! c(:,:,1,2) = [1,2;3,4];
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21317
diff changeset
109 %! assert (a(:,:,1,[1,1]), c);
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
110
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
111 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
112 %! c(:,:,1,1) = [1,2;3,4];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
113 %! c(:,:,2,1) = [1,2;3,4];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
114 %! c(:,:,1,2) = [1,2;3,4];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
115 %! c(:,:,2,2) = [1,2;3,4];
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21317
diff changeset
116 %! assert (a(:,:,[1,1],[1,1]), c);
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
117
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
118 %!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
119 %!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
120 %!assert (a(1,1,[]), zeros (1,1,0))
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
121
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
122 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
123 %! c (1:10,1) = 1:10;
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
124 %! assert (c, [1:10]');
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
125
14131
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; 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
127 %!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
128 %!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
129 %!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
130 %!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
131 %!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
132 %!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
133 %!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
134 %!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
135 %!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
136 %!assert (b(1,[]), zeros (1,0))
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
137 %!assert (b(:,3), [5;7])
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
138 %!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
139 %!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
140 %!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
141 %!assert (b([],3), zeros (0,1))
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
142
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
143 %!shared x
17336
b81b9d079515 Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents: 16215
diff changeset
144 %! ## Dummy shared block to clear any previous definitions
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
145 %! x = 1;
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
146
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
147 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
148 %! a(1,:) = [1,3];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
149 %! assert (a, [1,3]);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
150
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
151 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
152 %! a(1,:) = [1;3];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
153 %! assert (a, [1,3]);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
154
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
155 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
156 %! a(:,1) = [1;3];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
157 %! assert (a, [1;3]);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
158
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
159 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
160 %! a = [1,2;3,4];
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
161 %! b (1,:,:) = a;
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
162 %! assert (b, reshape (a, [1,2,2]));
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
163
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
164 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
165 %! 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
166 %! b(:,:,2) = 1:4;
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
167 %! assert (a, b);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
168
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
169 %!test
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
170 %! a(:,:,:) = 1:4;
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
171 %! assert (a, [1:4]);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
172
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
173 %!test
31932
2e135e3cb1aa maint: replace double semicolon ';;' line ending with just ';'.
Rik <rik@octave.org>
parents: 31706
diff changeset
174 %! a(:,:,1) = 1:4;
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
175 %! assert (a, [1:4]);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
176
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
177 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
178 %! a(:,:,1) = [1:4]';
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
179 %! assert (a, [1:4]');
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
180
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
181 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
182 %! a(:,:,1) = reshape (1:4,[1,1,4]);
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
183 %! assert (a, [1:4]');
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
184
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
185 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
186 %! a(:,1,:) = 1:4;
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
187 %! assert (a, reshape (1:4,[1,1,4]));
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
188
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
189 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
190 %! a(:,1,:) = [1:4]';
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
191 %! assert (a, [1:4]');
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
192
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
193 %!test
31932
2e135e3cb1aa maint: replace double semicolon ';;' line ending with just ';'.
Rik <rik@octave.org>
parents: 31706
diff changeset
194 %! a(:,1,:) = reshape (1:4,[1,1,4]);
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
195 %! assert (a, [1:4]');
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
196
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
197 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
198 %! a(1,:,:) = 1:4;
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
199 %! assert (a, reshape (1:4,[1,1,4]));
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
200
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
201 %!test
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
202 %! a(1,:,:) = [1:4]';
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
203 %! assert (a, [1:4]);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
204
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
205 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
206 %! a(1,:,:) = reshape (1:4,[1,1,4]);
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
207 %! assert (a, [1:4]);
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
208
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
209 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14127
diff changeset
210 %! a(1,:,:,:) = reshape (1:4,[1,1,4]);
7646
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
211 %! assert (a, reshape (1:4,[1,1,1,4]));
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
212
ad16ea379d2f additional fixes for Array::assignN
David Bateman <dbateman@free.fr>
parents: 7642
diff changeset
213 %!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
214
16073
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
215 ## bug #38357
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
216 %!shared d, dd
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
217 %! 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
218 %! dd = diag ([1, 2, 3], 6, 3);
21317
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21174
diff changeset
219 %!assert (d(1), 1)
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21174
diff changeset
220 %!assert (dd(1), 1)
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21174
diff changeset
221 %!assert (d(3, 3), 3)
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21174
diff changeset
222 %!assert (dd(3, 3), 3)
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21174
diff changeset
223 %!assert (d(2), 0)
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21174
diff changeset
224 %!assert (dd(2), 0)
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21174
diff changeset
225 %!assert (dd(6,1), 0)
21581
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
226 %!error d(6,6)
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
227 %!error dd(6,6)
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
228 %!error d(3,6)
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
229 %!error dd(3,6)
16073
1c8234f0b642 Fix bounds-checking in diagonal matrices (bug #38357)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 16030
diff changeset
230
17642
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
231 ## bug 31287
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
232 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
233 %! y = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
234 %! x = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
235 %! x(false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
236 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
237
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
238 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
239 %! y = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
240 %! x = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
241 %! x(false,[]) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
242 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
243
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
244 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
245 %! y = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
246 %! x = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
247 %! x(false,[],false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
248 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
249
32171
4555f9918009 test: Rewrite BIST tests incorrectly using %!shared construct (bug #64531)
Rik <rik@octave.org>
parents: 32169
diff changeset
250 %!test
17642
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
251 %! y = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
252 %! x = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
253 %! x(false, 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
254 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
255
32171
4555f9918009 test: Rewrite BIST tests incorrectly using %!shared construct (bug #64531)
Rik <rik@octave.org>
parents: 32169
diff changeset
256 %!test
17642
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
257 %! y = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
258 %! x = ones (2, 2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
259 %! x(false, false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
260 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
261
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
262 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
263 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
264 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
265 %! x([], []) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
266 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
267
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
268 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
269 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
270 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
271 %! x([], []) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
272 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
273
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
274 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
275 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
276 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
277 %! x(1, []) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
278 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
279
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
280 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
281 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
282 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
283 %! x([], 1, []) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
284 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
285
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
286 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
287 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
288 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
289 %! x(1, [], 1, 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
290 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
291
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
292 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
293 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
294 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
295 %! x([], 1, 1) = [];
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 = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
300 %! x = 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 = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
307 %! x = sparse (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) = [];
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, ea2) = [];
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 %! ea2 = ones (3, 2, 0, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
330 %! x(1, ea2, 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
331 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
332
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
333 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
334 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
335 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
336 %! x(false, 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
337 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
338
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
339 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
340 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
341 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
342 %! x(false, 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
343 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
344
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
345 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
346 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
347 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
348 %! x(1, [], false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
349 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
350
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
351 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
352 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
353 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
354 %! x(false, false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
355 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
356
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
357 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
358 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
359 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
360 %! x(false, false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
361 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
362
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
363 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
364 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
365 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
366 %! x(false, [], false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
367 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
368
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
369 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
370 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
371 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
372 %! x([], false, false, false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
373 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
374
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
375 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
376 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
377 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
378 %! x(1, [], false, false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
379 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
380
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
381 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
382 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
383 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
384 %! x(:, false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
385 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
386
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
387 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
388 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
389 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
390 %! x(:, false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
391 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
392
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
393 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
394 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
395 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
396 %! x(false, :) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
397 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
398
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
399 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
400 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
401 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
402 %! x(false, :) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
403 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
404
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
405 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
406 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
407 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
408 %! x(false, :, [], 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
409 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
410
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
411 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
412 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
413 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
414 %! x(:, [], false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
415 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
416
32171
4555f9918009 test: Rewrite BIST tests incorrectly using %!shared construct (bug #64531)
Rik <rik@octave.org>
parents: 32169
diff changeset
417 %!test
17642
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
418 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
419 %! x = ones (2, 2);
21581
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
420 %!error x(1, 1, []) = []
17642
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
421
32171
4555f9918009 test: Rewrite BIST tests incorrectly using %!shared construct (bug #64531)
Rik <rik@octave.org>
parents: 32169
diff changeset
422 %!test
17642
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
423 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
424 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
425 %! x(false, false, 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
426 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
427
32171
4555f9918009 test: Rewrite BIST tests incorrectly using %!shared construct (bug #64531)
Rik <rik@octave.org>
parents: 32169
diff changeset
428 %!test
17642
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
429 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
430 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
431 %! x(false, false, []) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
432 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
433
32171
4555f9918009 test: Rewrite BIST tests incorrectly using %!shared construct (bug #64531)
Rik <rik@octave.org>
parents: 32169
diff changeset
434 %!test
17642
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
435 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
436 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
437 %! x(false, false, [], false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
438 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
439
32171
4555f9918009 test: Rewrite BIST tests incorrectly using %!shared construct (bug #64531)
Rik <rik@octave.org>
parents: 32169
diff changeset
440 %!test
17642
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
441 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
442 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
443 %! x(1, false, [], false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
444 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
445
32171
4555f9918009 test: Rewrite BIST tests incorrectly using %!shared construct (bug #64531)
Rik <rik@octave.org>
parents: 32169
diff changeset
446 %!test
17642
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
447 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
448 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
449 %! x(:, false, 1) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
450 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
451
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
452 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
453 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
454 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
455 %! x([]) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
456 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
457
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
458 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
459 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
460 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
461 %! x([]) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
462 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
463
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
464 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
465 %! y = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
466 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
467 %! x(:) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
468 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
469
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
470 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
471 %! y = sparse ([]);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
472 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
473 %! x(:) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
474 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
475
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
476 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
477 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
478 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
479 %! x(false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
480 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
481
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
482 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
483 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
484 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
485 %! x(false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
486 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
487
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
488 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
489 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
490 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
491 %! x([], false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
492 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
493
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
494 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
495 %! y = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
496 %! x = sparse (ones (2, 2));
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
497 %! x([], false) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
498 %! assert (x, y);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
499
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
500 %!test
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
501 %! y = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
502 %! x = ones (2, 2);
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
503 %! x([], false, :) = [];
7ed397c8ca68 improve compatibility of null assignment (bug #31287)
John W. Eaton <jwe@octave.org>
parents: 17336
diff changeset
504 %! assert (x, y);
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
505
32169
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
506 ## Test deletion of non-existent dimensions
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
507 %!test
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
508 %! x = ones (10, 10, 2);
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
509 %! x(:, :, 1) = [];
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
510 %! x(:, :, 1) = [];
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
511 %! assert (size (x), [10, 10, 0]);
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
512
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
513 %!test
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
514 %! x = ones (10, 10);
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
515 %! x(:,:,:, 1) = [];
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
516 %! assert (size (x), [10, 10, 1, 0]);
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
517
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
518 %!test
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
519 %! x = ones (10, 10);
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
520 %! try
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
521 %! x(:,:,2) = [];
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
522 %! catch
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
523 %! m = strfind (lasterr (), 'index out of bounds: value 2 out of bound 1');
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
524 %! assert (m > 0);
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
525 %! end_try_catch
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
526 %! assert (size (x), [10, 10]);
47cf72897a06 test: Add tests for deletion of non-existent dimensions.
Rik <rik@octave.org>
parents: 31932
diff changeset
527
25807
cb775c73866d Don't print fractional part of an invalid NaN index.
Rik <rik@octave.org>
parents: 25680
diff changeset
528 ## Test indexing of unnamed constants
20795
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
529 %!error <index \(0\): subscripts must be> 1(0)
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
530 %!error <index \(-1\): subscripts must be> 1(-1)
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
531 %!error <index \(_,0.5\): subscripts> {}(1,0.5)
25680
61f8d94f6bbb index.tst: Make tests case insensitive for NaN, NA, Inf values (bug #54385).
Rik <rik@octave.org>
parents: 25054
diff changeset
532 %!error <index \([Nn][aA][Nn],_\): subscripts> 1(NaN,1)
20795
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
533 %!error <index \(_,_,<cell....\[x8\]...\): subscripts> [](1,1,{},1,1,1,1,1,1,1,1)
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
534 %!error <index \(...\[x9\]...-1,_\): subscript> 1(1,1,1,1,1,1,1,1,1,-1,1)
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
535 %!error <index \(2\): out of bound 1> 1(2)
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
536 %!error <index \(1\): out of bound 0> [](1)
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
537 %!error <index \(-1\): subscripts> 1(1)(-1)(1)
28916
ec591c500fa4 maint: Use Octave convention of space after function name in test/.
Rik <rik@octave.org>
parents: 28004
diff changeset
538 %!error <index \(_,1\): out of bound 0 \(dimensions are 5x0\)> zeros (5,0)(3,1)
ec591c500fa4 maint: Use Octave convention of space after function name in test/.
Rik <rik@octave.org>
parents: 28004
diff changeset
539 %!error <index \(3,_\): out of bound 0 \(dimensions are 0x5\)> zeros (0,5)(3,1)
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
540 %!
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
541 %!shared abc
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
542 %! abc = [1, 2];
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
543 %! ## Test full matrices in variables
20795
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
544 %!error <abc\(3\): out of bound 2> abc([false, true, true])
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
545 %!error <abc\(-1\): subscripts> abc(-1)(1)(1)
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
546 %! ## xerror <index \(-1\): subscripts> abc(1)(-1)(1) ## why no 'xerror' test?
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
547
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
548 %!shared abc
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
549 %! abc = [1 2; 3 4];
20795
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
550 %!error <abc\(5\): out of bound 4> abc(5)
28004
403df0b32204 update out_of_range error messages
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
551 %!error <abc\(_,3\): out of bound 2 \(dimensions are 2x2\)> abc(2,3)
20795
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
552 %!error <abc\(_,_,0.5\): subscripts> exp (abc(2,3,0.5))
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
553
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
554 %!shared abc
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
555 %! abc = [1 2; 3 4]; abc(1,1,2) = 1;
20795
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
556 %!error <abc\(_,5\): out of bound 4> abc(2,5)
28004
403df0b32204 update out_of_range error messages
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
557 %!error <abc\(_,3,_\): out of bound 2 \(dimensions are 2x2x2\)> abc(2,3,2)
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
558 %!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: 19697
diff changeset
559 %!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: 19697
diff changeset
560 %!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: 19697
diff changeset
561 %!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: 19697
diff changeset
562
25807
cb775c73866d Don't print fractional part of an invalid NaN index.
Rik <rik@octave.org>
parents: 25680
diff changeset
563 ## Test diagonal matrices, and access of function results
28916
ec591c500fa4 maint: Use Octave convention of space after function name in test/.
Rik <rik@octave.org>
parents: 28004
diff changeset
564 %!error <index \(_,_,5\): out of bound 1 \(dimensions are 3x3\)> eye (3)(2,3,5)
ec591c500fa4 maint: Use Octave convention of space after function name in test/.
Rik <rik@octave.org>
parents: 28004
diff changeset
565 %!error <index \(-2,_\): subscripts> eye (4)(-2,3)
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
566
25807
cb775c73866d Don't print fractional part of an invalid NaN index.
Rik <rik@octave.org>
parents: 25680
diff changeset
567 ## Test cells
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
568 %!shared abc
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
569 %! abc = {1, 2; 3, 4};
20795
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
570 %!error <abc\(_,0.3,_\): subscripts> abc(2,0.3,5)
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
571 %!error <abc\(_,0.3,_\): subscripts> abc{2,0.3,5}
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
572 %!error <abc\(-2,_,_,_\): subscripts> abc{-2,1,1,1}
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
573 %!error <abc\(0,_,_,_\): subscripts> abc(0,1,1,1) = 1
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
574
25807
cb775c73866d Don't print fractional part of an invalid NaN index.
Rik <rik@octave.org>
parents: 25680
diff changeset
575 ## Test permutation matrices
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
576 %!shared abc
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
577 %! abc = eye(3)([3 1 2],:);
25680
61f8d94f6bbb index.tst: Make tests case insensitive for NaN, NA, Inf values (bug #54385).
Rik <rik@octave.org>
parents: 25054
diff changeset
578 %!error <abc\([Nn][aA][Nn]\): subscripts> abc(NA)
61f8d94f6bbb index.tst: Make tests case insensitive for NaN, NA, Inf values (bug #54385).
Rik <rik@octave.org>
parents: 25054
diff changeset
579 %!error <abc\(_,_,_,[Ii][nN][Ff],_\): subscripts> abc(1,1,1,Inf,1)
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
580
25807
cb775c73866d Don't print fractional part of an invalid NaN index.
Rik <rik@octave.org>
parents: 25680
diff changeset
581 ## Test sparse matrices
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
582 %!shared abc
28916
ec591c500fa4 maint: Use Octave convention of space after function name in test/.
Rik <rik@octave.org>
parents: 28004
diff changeset
583 %! abc = sparse (3,3);
20795
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
584 %!error <abc\(-1\): subscripts> abc(-1)
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
585 %!error <abc\(-1\): subscripts> abc(-1) = 1
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
586 %!error <abc\(-1,_\): subscripts> abc(-1,1)
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
587 %!error <abc\(-1,_\): subscripts> abc(-1,1) = 1
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
588 %!error <sparse indexing needs 1 or 2 indices> abc(0,0,0,0)
28004
403df0b32204 update out_of_range error messages
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
589 %!error <abc\(4,_\): out of bound 3 \(dimensions are 3x3\)> abc(4,1)
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
590
25807
cb775c73866d Don't print fractional part of an invalid NaN index.
Rik <rik@octave.org>
parents: 25680
diff changeset
591 ## Test ranges
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
592 %!shared abc
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
593 %! abc = 1:10;
20795
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
594 %!error <abc\(-1\): subscripts> abc(-1)
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
595 %!error <abc\(-1,_\): subscripts> abc(-1,1)
28004
403df0b32204 update out_of_range error messages
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
596 %!error <abc\(4,_\): out of bound 1 \(dimensions are 1x10\)> abc(4,1)
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
597
25807
cb775c73866d Don't print fractional part of an invalid NaN index.
Rik <rik@octave.org>
parents: 25680
diff changeset
598 ## Test complex
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
599 %!shared abc, z
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
600 %! abc = [1 2];
20795
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
601 %!error <abc\(0\+1i\): subscripts must be real> abc(i)
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
602 %! abc = [1 2; 3 4];
28916
ec591c500fa4 maint: Use Octave convention of space after function name in test/.
Rik <rik@octave.org>
parents: 28004
diff changeset
603 %!error <abc\(1\+0i\): subscripts must be real> abc(complex (1))
20795
ba2367658dc8 Use ':' rather than ';' in error messages from bad indexing (bug #46536).
Rik <rik@octave.org>
parents: 20542
diff changeset
604 %!error <abc\(1\+0.5i,_\): subscripts must be real> abc(1+0.5*i,3)
25807
cb775c73866d Don't print fractional part of an invalid NaN index.
Rik <rik@octave.org>
parents: 25680
diff changeset
605 %!error <abc\(_,0-2i\): subscripts must be real> abc(2,0-2*i)
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
606
25807
cb775c73866d Don't print fractional part of an invalid NaN index.
Rik <rik@octave.org>
parents: 25680
diff changeset
607 %!test <*35841>
21098
99d373870017 Fix assigning to trailing singletons for structs and cell (bug #39789, bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 20795
diff changeset
608 %! a(1,1,1).b(1) = 2;
99d373870017 Fix assigning to trailing singletons for structs and cell (bug #39789, bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 20795
diff changeset
609 %! a(1,1,1).b(1) = 3;
99d373870017 Fix assigning to trailing singletons for structs and cell (bug #39789, bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 20795
diff changeset
610
25807
cb775c73866d Don't print fractional part of an invalid NaN index.
Rik <rik@octave.org>
parents: 25680
diff changeset
611 %!test <*39789>
28916
ec591c500fa4 maint: Use Octave convention of space after function name in test/.
Rik <rik@octave.org>
parents: 28004
diff changeset
612 %! c = cell (1,1,1);
21098
99d373870017 Fix assigning to trailing singletons for structs and cell (bug #39789, bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 20795
diff changeset
613 %! c{1,1,1} = zeros(5, 2);
99d373870017 Fix assigning to trailing singletons for structs and cell (bug #39789, bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 20795
diff changeset
614 %! c{1,1,1}(:, 1) = 1;