annotate test/struct.tst @ 30564:796f54d4ddbf stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021. In all .txi and .texi files except gpl.txi and gpl.texi in the doc/liboctave and doc/interpreter directories, change the copyright to "Octave Project Developers", the same as used for other source files. Update copyright notices for 2022 (not done since 2019). For gpl.txi and gpl.texi, change the copyright notice to be "Free Software Foundation, Inc." and leave the date at 2007 only because this file only contains the text of the GPL, not anything created by the Octave Project Developers. Add Paul Thomas to contributors.in.
author John W. Eaton <jwe@octave.org>
date Tue, 28 Dec 2021 18:22:40 -0500
parents 7854d5752dd2
children 332a6ccac881
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 ##
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
3 ## Copyright (C) 2006-2022 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26946
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: 5751
diff changeset
7 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5751
diff changeset
8 ## This file is part of Octave.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5751
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23880
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: 5751
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: 23880
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: 5751
diff changeset
14 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5751
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: 5751
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: 5751
diff changeset
19 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5751
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: 5751
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: 23880
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: 5751
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 %! s.a = 1;
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
28 %! c = fieldnames (s);
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
29 %! assert (iscell (c) && strcmp (c{1}, "a"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
30
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
31 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
32 %! s.a.b = 1;
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
33 %! c = fieldnames (s.a);
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
34 %! assert (iscell (c) && strcmp (c{1}, "b"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
35
21581
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
36 %!error <Invalid call to fieldnames> fieldnames ()
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
37
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
38 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
39 %! s.a = 1;
28564
1dd765e54265 fix tests for new argument number mismatch error message
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
40 %! fail ("fieldnames (s, 1)", "called with too many inputs");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
41
21581
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
42 %!error fieldnames (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
43
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
44 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
45 %! s.aaa = 1;
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
46 %! s.a = 2;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
47 %! assert (isfield (s, "a"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
48
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
49 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
50 %! s.aaa = 1;
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
51 %! s.a = 2;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
52 %! assert (!(isfield (s, "b")));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
53
21581
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
54 %!error <Invalid call to isfield> isfield ()
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
55
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
56 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
57 %! s.aaa = 1;
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
58 %! s.a = 2;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
59 %! fail ("isfield (s, 'a', 3);", "Invalid call to isfield");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
60
21317
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 20619
diff changeset
61 %!assert (isfield (1, "m") == 0)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
62
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
63 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
64 %! s.a = 2;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
65 %! assert (isfield (s, 2) == 0);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
66
20619
96163bdd2ea1 Fix assigning into structs with trailing singleton dimensions (bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
67 %!assert (isstruct (1), false)
96163bdd2ea1 Fix assigning into structs with trailing singleton dimensions (bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
68 %!assert (isstruct ([1, 2]), false)
96163bdd2ea1 Fix assigning into structs with trailing singleton dimensions (bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
69 %!assert (isstruct ([]), false)
96163bdd2ea1 Fix assigning into structs with trailing singleton dimensions (bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
70 %!assert (isstruct ([1, 2; 3, 4]), false)
96163bdd2ea1 Fix assigning into structs with trailing singleton dimensions (bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
71 %!assert (isstruct ("t"), false)
96163bdd2ea1 Fix assigning into structs with trailing singleton dimensions (bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
72 %!assert (isstruct ("test"), false)
96163bdd2ea1 Fix assigning into structs with trailing singleton dimensions (bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
73 %!assert (isstruct (["test"; "ing"]), false)
96163bdd2ea1 Fix assigning into structs with trailing singleton dimensions (bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
74 %!assert (isstruct ({1}), false)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
75
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
76 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
77 %! s.a = 1;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
78 %! assert (isstruct (s));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
79
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
80 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
81 %! s.a.b = 1;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
82 %! assert (isstruct (s.a));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
83
21581
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
84 %!error <Invalid call to isstruct> isstruct ()
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
85
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
86 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
87 %! s.a = 1;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
88 %! fail ("isstruct (s, 1)", "Invalid call to isstruct");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
89
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
90 ## increment element of matrix stored in struct array field
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
91 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
92 %! a = struct ("c", {[1, 2, 3], [4, 5, 6], [7, 8, 9]});
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
93 %! a(2).c(3)++;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
94 %! assert (a(2).c, [4, 5, 7]);
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
95
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
96 ## create struct array by assignment to cs-list
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
97 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
98 %! [a(1:2).x] = deal (1, 3);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
99 %! assert (a, struct ("x", {1, 3}));
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
100 %! assert ({a(1:2).x}, {1, 3});
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
101
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
102 ## assign to subrange of struct array field
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
103 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
104 %! b = struct ("name", {"a", "b", "c"; "d", "e", "f"}, "value", 100);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
105 %! [b(1:2, [1,3]).name] = deal ("aaa", "ddd", "ccc", "fff");
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
106 %! assert ({b.name}, {"aaa", "ddd", "b", "e", "ccc", "fff"});
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
107
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
108 ## index into nested struct arrays
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
109 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
110 %! a = struct ("name", {"a", "b", "c"; "d", "e", "f"}, "value", 0);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
111 %! a(2).value = a;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
112 %! assert (a(2).value(2,3).name, "f");
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
113
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
114 ## assign to subrange of field in nested struct array
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
115 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
116 %! b = struct ("name", {"a", "b", "c"; "d", "e", "f"}, "value", 0);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
117 %! b(3, 1).value = b;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
118 %! [b(3, 1).value(1, [1, 3]).name] = deal ("aaa", "ccc");
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
119 %! assert (size (b), [3, 3]);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
120 %! assert (b(3,1).value(1, 3).name, "ccc");
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
121
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
122 ## test 4-dimensional struct array
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
123 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
124 %! c(4, 4, 4, 4).name = "a";
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
125 %! c(3, 3, 3, 3).value = 1;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
126 %! assert (c(2,2,2,2), struct ("name", [], "value", []));
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
127
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
128 ## assign to subrange of field in 4D struct array
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
129 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
130 %! c(4, 4, 4, 4).name = "a";
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
131 %! c(3, 3, 3, 3).value = 1;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
132 %! [c([1, 3], 2, :, [3, 4]).value] = deal (1);
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16030
diff changeset
133 %! assert (length (find ([c.value] == 1)), 17);
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16030
diff changeset
134 %! assert (length (find ([c.value])), 17);
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
135
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
136 ## swap elements of struct array
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
137 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
138 %! b = struct ("name", {"a", "b", "c"; "d", "e", "f"}, "value", 0);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
139 %! [b([2, 1], [3, 1]).name] = deal (b([1, 2], [1, 2]).name);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
140 %! assert ({b.name}, {"e", "b", "b", "e", "d", "a"});
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
141
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
142 ## test internal ordering of struct array fields
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
143 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
144 %! c(4, 4, 4, 4).value = 3;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
145 %! c(1, 2, 3, 4).value = 2;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
146 %! c(3, 3, 3, 3).value = 1;
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16030
diff changeset
147 %! d = reshape ({c.value}, size (c));
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21317
diff changeset
148 %! assert ([d{4, 4, 4, 4}, d{1, 2, 3, 4}, d{3, 3, 3, 3}], [3, 2, 1]);
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
149
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
150 ## test assignment to mixed cs-list of field element subranges
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
151 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
152 %! b = struct ("name", {"a", "b", "c"; "d", "e", "f"}, "value", 100);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
153 %! [b(1:2, [1, 3]).name, b(2, 1:3).value] = ...
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
154 %! deal (1, 2, 3, 4, "5", "6", "7");
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
155 %! assert ({b.name}, {1, 2, "b", "e", 3, 4});
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
156 %! assert ({b.value}, {100, "5", 100, "6", 100, "7"});
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
157
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 27923
diff changeset
158 %!error <deal: nargin>
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 27923
diff changeset
159 %! [a(1:3).x] = deal ([1, 5], [3, 7], [8, 9]);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 27923
diff changeset
160 %! [a(2:3).x(2)] = deal (10, 11);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 27923
diff changeset
161
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
162 %!error <a cs-list cannot be further indexed>
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
163 %! [a(1:3).x] = deal ([1, 5], [3, 7], [8, 9]);
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 27923
diff changeset
164 %! [a(2:3).x(2)] = 1;
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
165
10588
c1111769f595 test_struct: update expected error message text
John W. Eaton <jwe@octave.org>
parents: 10399
diff changeset
166 %!error <a cs-list cannot be further indexed>
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
167 %! [a(1:3).x] = deal ([1, 5], [3, 7], [8, 9]);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
168 %! a(2:3).x(2);
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
169
10399
81bcdf5fd7a9 modernize failing tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10366
diff changeset
170 %!error id=Octave:index-out-of-bounds
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
171 %! a(1).x.x = 1;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
172 %! a(2).x;
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
173
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
174 %!error <invalid number of output arguments for constant expression>
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
175 %! a = struct ("value", {1, 2, 3, 4, 5});
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
176 %! [a(2:4).value] = 1;
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
177
24690
2ce26c4cb323 More descriptive error message for assignment to empty structure (bug #36003).
Joe Winegarden <joewino19@gmail.com>
parents: 24534
diff changeset
178 %!error <invalid dot name structure assignment>
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
179 %! c(4, 4, 4, 4).name = "a";
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
180 %! c(3, 3, 3, 3).value = 1;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
181 %! c([1, 3], 2, :, [3, 4]).value = 1;
8603
4c68e26e3ba1 Add tests to prevent regression of struct array indexing
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
182
9122
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
183 ## test lazy copying in structs: nested assignment to self
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
184 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
185 %! a.a = 1;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
186 %! a.b = a;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
187 %! a.b.c = a;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
188 %! assert (a.b.c.b, struct ("a", 1));
9122
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
189
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
190 ## test lazy copying in structs: indirect nested assignment to self
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
191 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
192 %! a.a = 1;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
193 %! a.b = 2;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
194 %! b.c = a;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
195 %! b.d = 3;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
196 %! c.d = b;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
197 %! c.e = 4;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
198 %! a.b = c;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
199 %! a.b.e = a;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
200 %! assert (a.b.e.b.d.c, struct ("a", 1, "b", 2));
9122
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
201
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
202 ## test lazy copying in structs: nested assignment via function
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
203 %!function aa = do_nest (a);
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
204 %! aa = a;
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
205 %! aa.b = a;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
206 %!endfunction
9122
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
207 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
208 %! a.c = 1;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
209 %! a = do_nest (a);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
210 %! a = do_nest (a);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
211 %! a = do_nest (a);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
212 %! assert (a.b.b.b, struct ("c", 1));
9122
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
213
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
214 ## test lazy copying in structs: nested assignment via function
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
215 %!function aa = do_nest (a);
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
216 %! aa = a;
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
217 %! aa.b = a;
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
218 %! aa.b.c = aa;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
219 %!endfunction
9122
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
220 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
221 %! a.c = 1;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
222 %! a = do_nest (a);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
223 %! a = do_nest (a);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
224 %! a = do_nest (a);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
225 %! assert (a.b.c.b.b.c.b.b.c.b, struct ("c", 1));
9122
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
226
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
227 ## test lazy copying in structs: nested assignment on different levels.
8ca06fd9c6ef test lazy copying in structures
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9112
diff changeset
228 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
229 %! a.b = 1;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
230 %! b.c = a;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
231 %! b.d.e = a;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
232 %! b.f.g.h = a;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
233 %! b.i.j.k.l = a;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
234 %! a.m = b;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
235 %! a.m.c.b = a;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
236 %! assert (a.m.c.b.m.i.j.k.l, struct ("b", 1));
9130
67fa54583fe8 Add test to prevent regression of empty struct assignment bug
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9122
diff changeset
237
67fa54583fe8 Add test to prevent regression of empty struct assignment bug
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9122
diff changeset
238 ## test indexed assignment into empty struct array
67fa54583fe8 Add test to prevent regression of empty struct assignment bug
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9122
diff changeset
239 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
240 %! s = resize (struct (), 3,2);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
241 %! s(3).foo = 42;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
242 %! assert (s(3), struct ("foo", 42));
9130
67fa54583fe8 Add test to prevent regression of empty struct assignment bug
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9122
diff changeset
243
23880
1b232c0c19e6 Empty indexing of a struct should return the entire struct (bug #51633).
Rik <rik@octave.org>
parents: 23220
diff changeset
244 ## empty index should return entire struct
26946
04e5cb5e2cb3 update bug status in tests
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
245 %!test <*51633>
23880
1b232c0c19e6 Empty indexing of a struct should return the entire struct (bug #51633).
Rik <rik@octave.org>
parents: 23220
diff changeset
246 %! x.a = 1:10;
1b232c0c19e6 Empty indexing of a struct should return the entire struct (bug #51633).
Rik <rik@octave.org>
parents: 23220
diff changeset
247 %! y = x;
1b232c0c19e6 Empty indexing of a struct should return the entire struct (bug #51633).
Rik <rik@octave.org>
parents: 23220
diff changeset
248 %! assert (! isempty (y));
1b232c0c19e6 Empty indexing of a struct should return the entire struct (bug #51633).
Rik <rik@octave.org>
parents: 23220
diff changeset
249 %! assert (y, x);
1b232c0c19e6 Empty indexing of a struct should return the entire struct (bug #51633).
Rik <rik@octave.org>
parents: 23220
diff changeset
250 %! z = x();
1b232c0c19e6 Empty indexing of a struct should return the entire struct (bug #51633).
Rik <rik@octave.org>
parents: 23220
diff changeset
251 %! assert (! isempty (z));
1b232c0c19e6 Empty indexing of a struct should return the entire struct (bug #51633).
Rik <rik@octave.org>
parents: 23220
diff changeset
252 %! assert (z, x);
1b232c0c19e6 Empty indexing of a struct should return the entire struct (bug #51633).
Rik <rik@octave.org>
parents: 23220
diff changeset
253 %! assert (z, y);
1b232c0c19e6 Empty indexing of a struct should return the entire struct (bug #51633).
Rik <rik@octave.org>
parents: 23220
diff changeset
254
20619
96163bdd2ea1 Fix assigning into structs with trailing singleton dimensions (bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
255 ## test assigning to multi-dim struct with trailing singleton dimensions,
26946
04e5cb5e2cb3 update bug status in tests
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
256 %!test <*35841>
20619
96163bdd2ea1 Fix assigning into structs with trailing singleton dimensions (bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
257 %! a(1,1,1).b(1) = 1;
96163bdd2ea1 Fix assigning into structs with trailing singleton dimensions (bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
258 %! a(1,1,1).b(1) = 2;
96163bdd2ea1 Fix assigning into structs with trailing singleton dimensions (bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
259 %! a(1,1,:).b(1) = 3;
96163bdd2ea1 Fix assigning into structs with trailing singleton dimensions (bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
260 %! assert (a(1,1,1).b(1) == 3);
96163bdd2ea1 Fix assigning into structs with trailing singleton dimensions (bug #35841)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 19697
diff changeset
261
10399
81bcdf5fd7a9 modernize failing tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10366
diff changeset
262 %!error id=Octave:index-out-of-bounds
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
263 %! s = resize (struct (),3,2);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
264 %! s(3).foo = 42;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
265 %! s(7);