annotate test/test_logical_index.m @ 14131:c3309e1ec50d stable

test: Use Octave coding and spacing conventions for fixed test scripts * build_bc_overload_tests.sh, build_bc_overloads_expected.m, build_sparse_tests.sh, test_args.m, test_contin.m, test_diag_perm.m, test_error.m, test_eval-catch.m, test_for.m, test_func.m, test_global.m, test_if.m, test_index.m, test_io.m, test_logical_index.m, test_null_assign.m, test_parser.m, test_prefer.m, test_range.m, test_recursion.m, test_return.m, test_slice.m, test_struct.m, test_switch.m, test_system.m, test_transpose.m, test_try.m, test_unwind.m, test_while.m: Use Octave coding and spacing conventions for fixed test scripts.
author Rik <octave@nomad.inbox5.com>
date Sun, 01 Jan 2012 20:04:52 -0800
parents abbb07913e0a
children 72c96de7a403
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10399
diff changeset
1 ## Copyright (C) 2006-2011 John W. Eaton
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
2 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
3 ## This file is part of Octave.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
4 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
6 ## under the terms of the GNU General Public License as published by
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
8 ## your option) any later version.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
9 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
13 ## General Public License for more details.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
14 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
15 ## You should have received a copy of the GNU General Public License
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
17 ## <http://www.gnu.org/licenses/>.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5781
diff changeset
18
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
19 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
20 %! a = [];
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
21 %! fail ("a(0);");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
22
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
23 %!shared a
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
24 %! a = 2;
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
25 %!assert (a(1), 2);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
26 %!error id=Octave:index-out-of-bounds a(logical ([1,1]))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
27
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
28 %!shared a
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
29 %! a = [9,8,7,6];
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
30 %!assert (isempty (a(logical ([0,0,0,0]))))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
31 %!assert (a(logical ([1,1,1,1])), [9,8,7,6])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
32 %!assert (a(logical ([0,1,1,0])), [8,7])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
33 %!assert (a(logical ([1,1])), [9,8])
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
34
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
35 %!shared a
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
36 %! a = [9,8;7,6];
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
37 %!assert (isempty (a(logical ([0,0,0,0]))))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
38 %!assert (a(logical ([1,1,1,1])), [9,7,8,6])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
39 %!assert (a(logical ([0,1,1,0])), [7,8])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
40 %!assert (a(logical (0:1),logical (0:1)), 6)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
41 %!assert (a(logical (0:1),2:-1:1), [6,7])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
42 %!assert (a(logical (0:1),logical ([0,1])), 6)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
43 %!assert (a(logical (0:1),[2,1]), [6,7])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
44 %!assert (a(logical (0:1),:), [7,6])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
45 %!assert (a(logical (0:1),1), 7)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
46 %!assert (a(logical (0:1),logical ([1,1])), [7,6])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
47 %!assert (a(2:-1:1,logical (0:1)), [6;8])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
48 %!assert (a(2:-1:1,logical ([0,1])), [6;8])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
49 %!assert (a(2:-1:1,logical ([1,1])), [7,6;9,8])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
50 %!assert (a(logical ([0,1]),logical (0:1)), 6)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
51 %!assert (a(logical ([0,1]),2:-1:1), [6,7])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
52 %!assert (a(logical ([0,1]),logical ([0,1])), 6)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
53 %!assert (a(logical ([0,1]),[2,1]), [6,7])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
54 %!assert (a(logical ([0,1]),:), [7,6])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
55 %!assert (a(logical ([0,1]),1), 7)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
56 %!assert (a(logical ([0,1]),logical ([1,1])), [7,6])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
57 %!assert (a([2,1],logical (0:1)), [6;8])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
58 %!assert (a([2,1],logical ([0,1])), [6;8])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
59 %!assert (a([2,1],logical ([1,1])), [7,6;9,8])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
60 %!assert (a(:,logical (0:1)), [8;6])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
61 %!assert (a(:,logical ([0,1])), [8;6])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
62 %!assert (a(:,logical ([1,1])), [9,8;7,6])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
63 %!assert (a(1,logical (0:1)), 8)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
64 %!assert (a(1,logical ([0,1])), 8)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
65 %!assert (a(1,logical ([1,1])), [9,8])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
66 %!assert (a(logical ([1,1]),logical (0:1)), [8;6])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
67 %!assert (a(logical ([1,1]),2:-1:1), [8,9;6,7])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
68 %!assert (a(logical ([1,1]),logical ([0,1])), [8;6])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
69 %!assert (a(logical ([1,1]),[2,1]), [8,9;6,7])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
70 %!assert (a(logical ([1,1]),:), [9,8;7,6])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
71 %!assert (a(logical ([1,1]),1), [9;7])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 14125
diff changeset
72 %!assert (a(logical ([1,1]),logical ([1,1])), [9,8;7,6])
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
73