Mercurial > hg > octave-lyh
annotate test/slice.tst @ 17179:c3bd7314643c
doc: Periodic spellcheck of documentation.
* doc/interpreter/doccheck/aspell-octave.en.pws: Add new words to
Octave-specific dictionary.
* scripts/miscellaneous/edit.m: Use @nospell macro to stop spellchecking code
samples.
* scripts/image/imread.m, scripts/image/imwrite.m,
scripts/linear-algebra/cond.m, scripts/plot/orient.m: Periodic spellcheck of
documentation.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 04 Aug 2013 13:22:53 -0700 |
parents | b1283d4c06c2 |
children | c3c1ebfaa7dc |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
14131
diff
changeset
|
1 ## Copyright (C) 2007-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 | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
19 %!function x = set_slice (size, dim, slice) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
20 %! x = ones (size); |
6480 | 21 %! switch dim |
22 %! case 11 | |
23 %! x(slice) = 2; | |
24 %! case 21 | |
25 %! x(slice, :) = 2; | |
26 %! case 22 | |
27 %! x(:, slice) = 2; | |
28 %! case 31 | |
29 %! x(slice, :, :) = 2; | |
30 %! case 32 | |
31 %! x(:, slice, :) = 2; | |
32 %! case 33 | |
33 %! x(:, :, slice) = 2; | |
34 %! otherwise | |
16213
b1283d4c06c2
test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
35 %! error ("invalid dim, '%d'", dim); |
6480 | 36 %! endswitch |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
37 %!endfunction |
6480 | 38 |
39 ## size = [2 0] | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
40 %!assert (set_slice ([2 0], 11, []), zeros ([2 0])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
41 %!error id=Octave:invalid-resize set_slice ([2 0], 11, 1) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
42 %!error id=Octave:invalid-resize set_slice ([2 0], 11, 2) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
43 %!error id=Octave:invalid-resize set_slice ([2 0], 11, 3) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
44 %!assert (set_slice ([2 0], 21, []), zeros ([2 0])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
45 %!assert (set_slice ([2 0], 21, 1), zeros ([2 0])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
46 %!assert (set_slice ([2 0], 21, 2), zeros ([2 0])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
47 %!assert (set_slice ([2 0], 21, 3), zeros ([3 0])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
48 %!assert (set_slice ([2 0], 22, []), zeros ([2 0])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
49 %!assert (set_slice ([2 0], 22, 1), [2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
50 %!assert (set_slice ([2 0], 22, 2), [0 0;2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
51 %!assert (set_slice ([2 0], 22, 3), [0 0;0 0;2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
52 %!assert (set_slice ([2 0], 31, []), zeros ([2 0])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
53 %!assert (set_slice ([2 0], 31, 1), zeros ([2 0])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
54 %!assert (set_slice ([2 0], 31, 2), zeros ([2 0])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
55 %!assert (set_slice ([2 0], 31, 3), zeros ([3 0])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
56 %!assert (set_slice ([2 0], 32, []), zeros ([2 0])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
57 %!assert (set_slice ([2 0], 32, 1), [2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
58 %!assert (set_slice ([2 0], 32, 2), [0 0;2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
59 %!assert (set_slice ([2 0], 32, 3), [0 0;0 0;2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
60 %!assert (set_slice ([2 0], 33, []), zeros ([2 0])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
61 %!assert (set_slice ([2 0], 33, 1), zeros ([2 0])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
62 %!assert (set_slice ([2 0], 33, 2), zeros ([2 0 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
63 %!assert (set_slice ([2 0], 33, 3), zeros ([2 0 3])) |
6480 | 64 |
65 ## size = [0 2] | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
66 %!assert (set_slice ([0 2], 11, []), zeros ([0 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
67 %!assert (set_slice ([0 2], 11, 1), 2) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
68 %!assert (set_slice ([0 2], 11, 2), [0, 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
69 %!assert (set_slice ([0 2], 11, 3), [0, 0, 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
70 %!assert (set_slice ([0 2], 21, []), zeros ([0 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
71 %!assert (set_slice ([0 2], 21, 1), [2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
72 %!assert (set_slice ([0 2], 21, 2), [0 0;2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
73 %!assert (set_slice ([0 2], 21, 3), [0 0;0 0;2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
74 %!assert (set_slice ([0 2], 22, []), zeros ([0 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
75 %!assert (set_slice ([0 2], 22, 1), zeros ([0 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
76 %!assert (set_slice ([0 2], 22, 2), zeros ([0 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
77 %!assert (set_slice ([0 2], 22, 3), zeros ([0 3])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
78 %!assert (set_slice ([0 2], 31, []), zeros ([0 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
79 %!assert (set_slice ([0 2], 31, 1), [2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
80 %!assert (set_slice ([0 2], 31, 2), [0 0;2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
81 %!assert (set_slice ([0 2], 31, 3), [0 0;0 0;2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
82 %!assert (set_slice ([0 2], 32, []), zeros ([0 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
83 %!assert (set_slice ([0 2], 32, 1), zeros ([0 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
84 %!assert (set_slice ([0 2], 32, 2), zeros ([0 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
85 %!assert (set_slice ([0 2], 32, 3), zeros ([0 3])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
86 %!assert (set_slice ([0 2], 33, []), zeros ([0 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
87 %!assert (set_slice ([0 2], 33, 1), zeros ([0 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
88 %!assert (set_slice ([0 2], 33, 2), zeros ([0 2 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
89 %!assert (set_slice ([0 2], 33, 3), zeros ([0 2 3])) |
6480 | 90 |
91 ## size = [2 1] | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
92 %!assert (set_slice ([2 1], 11, []), ones ([2 1])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
93 %!assert (set_slice ([2 1], 11, 1), [2 1]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
94 %!assert (set_slice ([2 1], 11, 2), [1 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
95 %!assert (set_slice ([2 1], 11, 3), [1 1 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
96 %!assert (set_slice ([2 1], 11, 4), [1 1 0 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
97 %!assert (set_slice ([2 1], 21, []), ones ([2 1])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
98 %!assert (set_slice ([2 1], 21, 1), [2 1]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
99 %!assert (set_slice ([2 1], 21, 2), [1 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
100 %!assert (set_slice ([2 1], 21, 3), [1 1 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
101 %!assert (set_slice ([2 1], 21, 4), [1 1 0 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
102 %!assert (set_slice ([2 1], 22, []), ones ([2 1])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
103 %!assert (set_slice ([2 1], 22, 1), [2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
104 %!assert (set_slice ([2 1], 22, 2), [1 1;2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
105 %!assert (set_slice ([2 1], 22, 3), [1 1;0 0;2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
106 %!assert (set_slice ([2 1], 31, []), ones ([2 1])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
107 %!assert (set_slice ([2 1], 31, 1), [2 1]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
108 %!assert (set_slice ([2 1], 31, 2), [1 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
109 %!assert (set_slice ([2 1], 31, 3), [1 1 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
110 %!assert (set_slice ([2 1], 31, 4), [1 1 0 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
111 %!assert (set_slice ([2 1], 32, []), ones ([2 1])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
112 %!assert (set_slice ([2 1], 32, 1), [2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
113 %!assert (set_slice ([2 1], 32, 2), [1 1;2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
114 %!assert (set_slice ([2 1], 32, 3), [1 1;0 0;2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
115 %!assert (set_slice ([2 1], 33, []), ones ([2 1])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
116 %!assert (set_slice ([2 1], 33, 1), [2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
117 %!assert (set_slice ([2 1], 33, 2), reshape ([1 1 2 2],[2 1 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
118 %!assert (set_slice ([2 1], 33, 3), reshape ([1 1 0 0 2 2],[2 1 3])) |
6480 | 119 |
120 ## size = [1 2] | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
121 %!assert (set_slice ([1 2], 11, []), full (ones ([1 2]))) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
122 %!assert (set_slice ([1 2], 11, 1), [2 1]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
123 %!assert (set_slice ([1 2], 11, 2), [1 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
124 %!assert (set_slice ([1 2], 11, 3), [1 1 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
125 %!assert (set_slice ([1 2], 11, 4), [1 1 0 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
126 %!assert (set_slice ([1 2], 21, []), full (ones ([1 2]))) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
127 %!assert (set_slice ([1 2], 21, 1), [2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
128 %!assert (set_slice ([1 2], 21, 2), [1 1;2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
129 %!assert (set_slice ([1 2], 21, 3), [1 1;0 0;2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
130 %!assert (set_slice ([1 2], 22, []), full (ones ([1 2]))) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
131 %!assert (set_slice ([1 2], 22, 1), [2 1]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
132 %!assert (set_slice ([1 2], 22, 2), [1 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
133 %!assert (set_slice ([1 2], 22, 3), [1 1 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
134 %!assert (set_slice ([1 2], 22, 4), [1 1 0 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
135 %!assert (set_slice ([1 2], 31, []), full (ones ([1 2]))) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
136 %!assert (set_slice ([1 2], 31, 1), [2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
137 %!assert (set_slice ([1 2], 31, 2), [1 1;2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
138 %!assert (set_slice ([1 2], 31, 3), [1 1;0 0;2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
139 %!assert (set_slice ([1 2], 32, []), full (ones ([1 2]))) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
140 %!assert (set_slice ([1 2], 32, 1), [2 1]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
141 %!assert (set_slice ([1 2], 32, 2), [1 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
142 %!assert (set_slice ([1 2], 32, 3), [1 1 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
143 %!assert (set_slice ([1 2], 32, 4), [1 1 0 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
144 %!assert (set_slice ([1 2], 33, []), full (ones ([1 2]))) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
145 %!assert (set_slice ([1 2], 33, 1), [2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
146 %!assert (set_slice ([1 2], 33, 2), reshape ([1 1 2 2],[1 2 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
147 %!assert (set_slice ([1 2], 33, 3), reshape ([1 1 0 0 2 2],[1 2 3])) |
6480 | 148 |
149 ## size = [2 2] | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
150 %!assert (set_slice ([2 2], 11, []), ones ([2 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
151 %!assert (set_slice ([2 2], 11, 1), [2 1;1 1]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
152 %!assert (set_slice ([2 2], 11, 2), [1 1;2 1]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
153 %!assert (set_slice ([2 2], 11, 3), [1 2;1 1]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
154 %!assert (set_slice ([2 2], 11, 4), [1 1;1 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
155 %!error id=Octave:invalid-resize set_slice ([2 2], 11, 5) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
156 %!error id=Octave:invalid-resize set_slice ([2 2], 11, 6) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
157 %!assert (set_slice ([2 2], 21, []), ones ([2 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
158 %!assert (set_slice ([2 2], 21, 1), [2 2;1 1]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
159 %!assert (set_slice ([2 2], 21, 2), [1 1;2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
160 %!assert (set_slice ([2 2], 21, 3), [1 1;1 1;2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
161 %!assert (set_slice ([2 2], 21, 4), [1 1;1 1;0 0;2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
162 %!assert (set_slice ([2 2], 22, []), ones ([2 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
163 %!assert (set_slice ([2 2], 22, 1), [2 2;1 1]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
164 %!assert (set_slice ([2 2], 22, 2), [1 1;2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
165 %!assert (set_slice ([ 2 2], 22, 3), [1 1;1 1;2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
166 %!assert (set_slice ([2 2], 22, 4), [1 1;1 1;0 0;2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
167 %!assert (set_slice ([2 2], 31, []), ones ([2 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
168 %!assert (set_slice ([2 2], 31, 1), [2 2;1 1]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
169 %!assert (set_slice ([2 2], 31, 2), [1 1;2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
170 %!assert (set_slice ( [2 2], 31, 3), [1 1;1 1;2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
171 %!assert (set_slice ([2 2], 31, 4), [1 1;1 1;0 0;2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
172 %!assert (set_slice ([2 2], 32, []), ones ([2 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
173 %!assert (set_slice ([2 2], 32, 1), [2 2;1 1]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
174 %!assert (set_slice ([2 2], 32, 2), [1 1;2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
175 %!assert (set_slice ([ 2 2], 32, 3), [1 1;1 1;2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
176 %!assert (set_slice ([2 2], 32, 4), [1 1;1 1;0 0;2 2]') |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
177 %!assert (set_slice ([2 2], 33, []), ones ([2 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
178 %!assert (set_slice ([2 2], 33, 1), [2 2;2 2]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
179 %!assert (set_slice ([2 2], 33, 2), reshape ([1 1 1 1 2 2 2 2],[2 2 2])) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
180 %!assert (set_slice ([ 2 2], 33, 3), reshape ([1 1 1 1 0 0 0 0 2 2 2 2],[2 2 3])) |