annotate test/test_null_assign.m @ 8119:acfd80c08d60

make null assignment more Matlab-compatible
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 18 Sep 2008 16:58:27 -0400
parents
children 2bc8ec18b2ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8119
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
1 ## Copyright (C) 2008 Jaroslav Hajek
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
2 ##
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
3 ## This file is part of Octave.
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
4 ##
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
8 ## your option) any later version.
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
9 ##
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
13 ## General Public License for more details.
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
14 ##
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
18
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
19 %!test
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
20 %! a = 1:3; a(:) = []; assert (size (a), [0, 0])
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
21 %!test
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
22 %! a = 1:3; a(1:3) = []; assert (size (a), [1, 0])
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
23 %!test
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
24 %! a = (1:3).'; a(1:3) = []; assert (size (a), [0, 1])
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
25 %!test
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
26 %! a = ones (3); a(:,:) = []; assert (size (a), [0, 3])
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
27 %!test
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
28 %! a = ones (3); a(1:3,:) = []; assert (size (a), [0, 3])
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
29 %!test
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
30 %! a = ones (3); a(:,1:3) = []; assert (size (a), [3, 0])
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
31 %!test
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
32 %! a = ones (3); fail ("a(1:2,1:2) = []", ".*");
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
33 %!test
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
34 %! a = ones (3); fail ("a(1:3,1:3) = []", ".*");
acfd80c08d60 make null assignment more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
35