view test/bug-53579.tst @ 32059:bade9602c5a1

Validate M and N dimension inputs to sparse(). * sparse.cc (Fsparse): Use xidx_type_value() to extract an octave_idx_type for M and N inputs or throw an error. Remove call to get_dimensions(). Remove FIXME note about unreachable code. Update error messages to be specific about what is wrong with M or N inputs. * mk-sparse-tst.sh: Remove FIXME notes. Update BIST tests for M and N inputs.
author Rik <rik@octave.org>
date Wed, 26 Apr 2023 14:40:37 -0700
parents 332a6ccac881
children 13362cd35b72
line wrap: on
line source

%!function [raa, rbb, igaa, igbb] = sub1 (aa, bb)
%!  global aa bb;
%!  aa = 1;
%!  raa = aa;
%!  rbb = bb;
%!  igaa = isglobal ("aa");
%!  igbb = isglobal ("bb");
%!endfunction

%!test <*53579>
%! global aa bb;
%! assert (isglobal ("aa"));
%! assert (isglobal ("bb"));
%! aa = 3;
%! xx = 5;
%! [raa, rbb, igaa, igbb] = sub1 (aa, xx);
%! assert (raa, 1);
%! assert (rbb, []);
%! assert (igaa);
%! assert (igbb);
%! assert (xx, 5);
%! clear -global aa bb;  # cleanup after test