changeset 28629:af361aea02e0

allow tests to work when disable_range is true * ov-typeinfo.cc, diag-perm.tst, mk-conv-tst.sh: Fix tests to pass when disable_range is true.
author John W. Eaton <jwe@octave.org>
date Mon, 03 Aug 2020 17:07:38 -0400
parents 83172e1c77f2
children 35f974bab4c8
files libinterp/octave-value/ov-typeinfo.cc test/diag-perm.tst test/mk-conv-tst.sh
diffstat 3 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-typeinfo.cc	Tue Aug 11 15:20:01 2020 -0400
+++ b/libinterp/octave-value/ov-typeinfo.cc	Mon Aug 03 17:07:38 2020 -0400
@@ -942,7 +942,12 @@
 %!assert (typeinfo ([i, 2]), "complex matrix")
 %!assert (typeinfo (diag ([i, 2])), "complex diagonal matrix")
 
-%!assert (typeinfo (1:2), "range")
+%!test
+%! if (disable_range ())
+%!   assert (typeinfo (1:2), "matrix")
+%! else
+%!   assert (typeinfo (1:2), "range")
+%! endif
 
 %!assert (typeinfo (false), "bool")
 %!assert (typeinfo ([true, false]), "bool matrix")
--- a/test/diag-perm.tst	Tue Aug 11 15:20:01 2020 -0400
+++ b/test/diag-perm.tst	Mon Aug 03 17:07:38 2020 -0400
@@ -178,6 +178,8 @@
 %! assert (diag (D1D2), d1 .* d2);
 
 ## slicing
+## preserving diagonal matrix type is not possible if indices are
+## general matrix objects.
 %!test
 %! m = 13;
 %! n = 6;
@@ -185,7 +187,11 @@
 %! d = rand (mn, 1);
 %! D = diag (d, m, n);
 %! Dslice = D (1:(m-3), 1:(n-2));
-%! assert (typeinfo (Dslice), "diagonal matrix");
+%! if (disable_range ())
+%!   assert (typeinfo (Dslice), "matrix");
+%! else
+%!   assert (typeinfo (Dslice), "diagonal matrix");
+%! endif
 
 ## preserve dense matrix structure when scaling
 %!assert (typeinfo (rand (8) * (3 * eye (8))), "matrix")
--- a/test/mk-conv-tst.sh	Tue Aug 11 15:20:01 2020 -0400
+++ b/test/mk-conv-tst.sh	Mon Aug 03 17:07:38 2020 -0400
@@ -28,7 +28,7 @@
 cat <<EOF
 ## !!! DO NOT EDIT !!!
 ## THIS IS AN AUTOMATICALLY GENERATED FILE
-## modify build-conv-tests.sh to generate the tests you need.
+## modify mk-conv-tst.sh to generate the tests you need.
 
 
 %!shared r,dq,sq,b,bm,dm,cdm,fdm,fcdm,pm,sm,sbm,scm,s,m,cs,cm,fs,fm,fcs,fcm,i8s,i16s,i32s,i64s,i8m,i16m,i32m,i64m,ui8s,ui16s,ui32s,ui64s,ui8m,ui16m,ui32m,ui64m
@@ -71,7 +71,12 @@
 %! ui32m = uint32 (rand (5) * 10);
 %! ui64m = uint64 (rand (5) * 10);
 %!
-%!assert (typeinfo (r), "range")
+%!test
+%! if (disable_range ())
+%!   assert (typeinfo (r), "matrix")
+%! else
+%!   assert (typeinfo (r), "range")
+%! endif
 %!assert (typeinfo (dq), "string")
 %!assert (typeinfo (sq), "sq_string")
 %!assert (typeinfo (b), "bool")