Mercurial > octave-nkf
comparison test/index.tst @ 16073:1c8234f0b642
Fix bounds-checking in diagonal matrices (bug #38357)
* ov-base-diag.cc (octave_base_diag<DMT, MT>::do_index_op): Call
checkelem instead of elem in the (scalar, scalar) indexing case.
* index.tst: Add tests.
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Wed, 20 Feb 2013 16:37:02 -0500 |
parents | 1af8d21608b7 |
children | b1283d4c06c2 |
comparison
equal
deleted
inserted
replaced
16072:ac672925fc98 | 16073:1c8234f0b642 |
---|---|
208 %!shared x | 208 %!shared x |
209 %! x = 1:5; | 209 %! x = 1:5; |
210 %!error <attempted to use a complex scalar as an index> x(i) | 210 %!error <attempted to use a complex scalar as an index> x(i) |
211 %!error <attempted to use a complex scalar as an index> x(j) | 211 %!error <attempted to use a complex scalar as an index> x(j) |
212 %!error <attempted to use a complex scalar as an index> x(1+i) | 212 %!error <attempted to use a complex scalar as an index> x(1+i) |
213 | |
214 ## bug #38357 | |
215 %!shared d, dd | |
216 %! d = diag ([1, 2, 3]); | |
217 %! dd = diag ([1, 2, 3], 6, 3); | |
218 %!assert (d(1), 1); | |
219 %!assert (dd(1), 1); | |
220 %!assert (d(3, 3), 3); | |
221 %!assert (dd(3, 3), 3); | |
222 %!assert (d(2), 0); | |
223 %!assert (dd(2), 0); | |
224 %!assert (dd(6,1), 0); | |
225 %!error d(6,6); | |
226 %!error dd(6,6); | |
227 %!error d(3,6); | |
228 %!error dd(3,6); | |
229 |