Mercurial > hg > octave-nkf
annotate test/test_logical_index.m @ 14983:a5f75de0dab1
Rename jit_function to jit_operation
* src/TEMPLATE-INST/Array-jit.cc: Rename jit_function to jit_operation.
* src/pt-jit.h: Rename jit_function to jit_operation.
* src/pt-jit.cc: Rename jit_function to jit_operation.
author | Max Brister <max@2bass.com> |
---|---|
date | Mon, 09 Jul 2012 12:32:42 -0500 |
parents | 72c96de7a403 |
children |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
14131
diff
changeset
|
1 ## Copyright (C) 2006-2012 John W. Eaton |
7016 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
5590 | 19 %!test |
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 | 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 | 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 | 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 | 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 | 73 |