Mercurial > jwe > octave
changeset 12863:8f9702abe3e3
test: Add validation for allow_noninteger_range_as_index()
* ov-range.cc: Add validation for allow_noninteger_range_as_index()
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Tue, 19 Jul 2011 13:24:49 -0700 |
parents | a9d292ce5489 |
children | 213c791292a6 |
files | src/ov-range.cc |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ov-range.cc Sun Jul 17 18:14:41 2011 -0700 +++ b/src/ov-range.cc Tue Jul 19 13:24:49 2011 -0700 @@ -655,3 +655,16 @@ { return SET_INTERNAL_VARIABLE (allow_noninteger_range_as_index); } + +/* +%!test +%! x = 0:10; +%! save = allow_noninteger_range_as_index (0); +%! fail ('x(2.1:5)'); +%! assert (x(2:5), 1:4); +%! allow_noninteger_range_as_index (1); +%! assert (x(2.49:5), 1:3); +%! assert (x(2.5:5), 2:4); +%! assert (x(2.51:5), 2:4); +%! allow_noninteger_range_as_index (save); +*/