changeset 21575:bc9aa534bc29

maint: Clean up BIST tests so they don't produce warnings. * data.cc (Fhorzcat): Temporarily disable "num-to-str" warning for BIST tests. * luinc.cc (__luinc__): Move BIST tests to luinc.m. * luinc.m: Add BIST tests for luinc. * regexp.cc (Fregexp): Temporarily disable "regexp-lookbehind-limit" for BIST tests. * sqrtm.cc (Fsqrtm): Temporarily disable "sqrtm:SingularMatrix" for BIST tests. * __eigs__.cc, __init_fltk__.cc, __init_gnuplot__.cc: Add 'assert (1)' BIST test to mark internal functions as tested. * ov-range.cc (Fallow_noninteger_range_as_index: Temporarily disable "deprecated-syntax" for BIST tests. * quadv.m: Temporarily disable "divide-by-zero" warning for BIST tests. * imfinfo.m: Temporarily disable "GraphicsMagic-Quantum-Depth" for BIST tests.
author Rik <rik@octave.org>
date Fri, 01 Apr 2016 13:56:09 -0700
parents ae4d7dfea337
children 82092a17fa50
files libinterp/corefcn/data.cc libinterp/corefcn/luinc.cc libinterp/corefcn/regexp.cc libinterp/corefcn/sqrtm.cc libinterp/dldfcn/__eigs__.cc libinterp/dldfcn/__init_fltk__.cc libinterp/dldfcn/__init_gnuplot__.cc libinterp/octave-value/ov-range.cc scripts/deprecated/luinc.m scripts/general/quadv.m scripts/image/imfinfo.m
diffstat 11 files changed, 100 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/data.cc	Fri Apr 01 12:57:49 2016 -0400
+++ b/libinterp/corefcn/data.cc	Fri Apr 01 13:56:09 2016 -0700
@@ -2146,8 +2146,10 @@
 
 /*
 ## Test concatenation with all zero matrices
-%!assert (horzcat ("", 65*ones (1,10)), "AAAAAAAAAA")
-%!assert (horzcat (65*ones (1,10), ""), "AAAAAAAAAA")
+%!test
+%! warning ("off", "Octave:num-to-str", "local");
+%! assert (horzcat ("", 65*ones (1,10)), "AAAAAAAAAA");
+%! assert (horzcat (65*ones (1,10), ""), "AAAAAAAAAA");
 
 %!assert (class (horzcat (int64 (1), int64 (1))), "int64")
 %!assert (class (horzcat (int64 (1), int32 (1))), "int64")
@@ -2161,7 +2163,9 @@
 %!assert (class (horzcat (int64 (1), double (1))), "int64")
 %!assert (class (horzcat (int64 (1), cell (1))), "cell")
 %!assert (class (horzcat (int64 (1), true)), "int64")
-%!assert (class (horzcat (int64 (1), "a")), "char")
+%!test
+%! warning ("off", "Octave:num-to-str", "local");
+%! assert (class (horzcat (int64 (1), "a")), "char");
 
 %!assert (class (horzcat (int32 (1), int64 (1))), "int32")
 %!assert (class (horzcat (int32 (1), int32 (1))), "int32")
@@ -2175,7 +2179,9 @@
 %!assert (class (horzcat (int32 (1), double (1))), "int32")
 %!assert (class (horzcat (int32 (1), cell (1))), "cell")
 %!assert (class (horzcat (int32 (1), true)), "int32")
-%!assert (class (horzcat (int32 (1), "a")), "char")
+%!test
+%! warning ("off", "Octave:num-to-str", "local");
+%! assert (class (horzcat (int32 (1), "a")), "char");
 
 %!assert (class (horzcat (int16 (1), int64 (1))), "int16")
 %!assert (class (horzcat (int16 (1), int32 (1))), "int16")
@@ -2189,7 +2195,9 @@
 %!assert (class (horzcat (int16 (1), double (1))), "int16")
 %!assert (class (horzcat (int16 (1), cell (1))), "cell")
 %!assert (class (horzcat (int16 (1), true)), "int16")
-%!assert (class (horzcat (int16 (1), "a")), "char")
+%!test
+%! warning ("off", "Octave:num-to-str", "local");
+%! assert (class (horzcat (int16 (1), "a")), "char");
 
 %!assert (class (horzcat (int8 (1), int64 (1))), "int8")
 %!assert (class (horzcat (int8 (1), int32 (1))), "int8")
@@ -2203,7 +2211,9 @@
 %!assert (class (horzcat (int8 (1), double (1))), "int8")
 %!assert (class (horzcat (int8 (1), cell (1))), "cell")
 %!assert (class (horzcat (int8 (1), true)), "int8")
-%!assert (class (horzcat (int8 (1), "a")), "char")
+%!test
+%! warning ("off", "Octave:num-to-str", "local");
+%! assert (class (horzcat (int8 (1), "a")), "char");
 
 %!assert (class (horzcat (uint64 (1), int64 (1))), "uint64")
 %!assert (class (horzcat (uint64 (1), int32 (1))), "uint64")
@@ -2217,7 +2227,9 @@
 %!assert (class (horzcat (uint64 (1), double (1))), "uint64")
 %!assert (class (horzcat (uint64 (1), cell (1))), "cell")
 %!assert (class (horzcat (uint64 (1), true)), "uint64")
-%!assert (class (horzcat (uint64 (1), "a")), "char")
+%!test
+%! warning ("off", "Octave:num-to-str", "local");
+%! assert (class (horzcat (uint64 (1), "a")), "char");
 
 %!assert (class (horzcat (uint32 (1), int64 (1))), "uint32")
 %!assert (class (horzcat (uint32 (1), int32 (1))), "uint32")
@@ -2231,7 +2243,9 @@
 %!assert (class (horzcat (uint32 (1), double (1))), "uint32")
 %!assert (class (horzcat (uint32 (1), cell (1))), "cell")
 %!assert (class (horzcat (uint32 (1), true)), "uint32")
-%!assert (class (horzcat (uint32 (1), "a")), "char")
+%!test
+%! warning ("off", "Octave:num-to-str", "local");
+%! assert (class (horzcat (uint32 (1), "a")), "char");
 
 %!assert (class (horzcat (uint16 (1), int64 (1))), "uint16")
 %!assert (class (horzcat (uint16 (1), int32 (1))), "uint16")
@@ -2245,7 +2259,9 @@
 %!assert (class (horzcat (uint16 (1), double (1))), "uint16")
 %!assert (class (horzcat (uint16 (1), cell (1))), "cell")
 %!assert (class (horzcat (uint16 (1), true)), "uint16")
-%!assert (class (horzcat (uint16 (1), "a")), "char")
+%!test
+%! warning ("off", "Octave:num-to-str", "local");
+%! assert (class (horzcat (uint16 (1), "a")), "char");
 
 %!assert (class (horzcat (uint8 (1), int64 (1))), "uint8")
 %!assert (class (horzcat (uint8 (1), int32 (1))), "uint8")
@@ -2259,7 +2275,9 @@
 %!assert (class (horzcat (uint8 (1), double (1))), "uint8")
 %!assert (class (horzcat (uint8 (1), cell (1))), "cell")
 %!assert (class (horzcat (uint8 (1), true)), "uint8")
-%!assert (class (horzcat (uint8 (1), "a")), "char")
+%!test
+%! warning ("off", "Octave:num-to-str", "local");
+%! assert (class (horzcat (uint8 (1), "a")), "char");
 
 %!assert (class (horzcat (single (1), int64 (1))), "int64")
 %!assert (class (horzcat (single (1), int32 (1))), "int32")
@@ -2273,7 +2291,9 @@
 %!assert (class (horzcat (single (1), double (1))), "single")
 %!assert (class (horzcat (single (1), cell (1))), "cell")
 %!assert (class (horzcat (single (1), true)), "single")
-%!assert (class (horzcat (single (1), "a")), "char")
+%!test
+%! warning ("off", "Octave:num-to-str", "local");
+%! assert (class (horzcat (single (1), "a")), "char");
 
 %!assert (class (horzcat (double (1), int64 (1))), "int64")
 %!assert (class (horzcat (double (1), int32 (1))), "int32")
@@ -2287,7 +2307,9 @@
 %!assert (class (horzcat (double (1), double (1))), "double")
 %!assert (class (horzcat (double (1), cell (1))), "cell")
 %!assert (class (horzcat (double (1), true)), "double")
-%!assert (class (horzcat (double (1), "a")), "char")
+%!test
+%! warning ("off", "Octave:num-to-str", "local");
+%! assert (class (horzcat (double (1), "a")), "char");
 
 %!assert (class (horzcat (cell (1), int64 (1))), "cell")
 %!assert (class (horzcat (cell (1), int32 (1))), "cell")
@@ -2315,21 +2337,25 @@
 %!assert (class (horzcat (true, double (1))), "double")
 %!assert (class (horzcat (true, cell (1))), "cell")
 %!assert (class (horzcat (true, true)), "logical")
-%!assert (class (horzcat (true, "a")), "char")
-
-%!assert (class (horzcat ("a", int64 (1))), "char")
-%!assert (class (horzcat ("a", int32 (1))), "char")
-%!assert (class (horzcat ("a", int16 (1))), "char")
-%!assert (class (horzcat ("a", int8 (1))), "char")
-%!assert (class (horzcat ("a", int64 (1))), "char")
-%!assert (class (horzcat ("a", int32 (1))), "char")
-%!assert (class (horzcat ("a", int16 (1))), "char")
-%!assert (class (horzcat ("a", int8 (1))), "char")
-%!assert (class (horzcat ("a", single (1))), "char")
-%!assert (class (horzcat ("a", double (1))), "char")
-%!assert (class (horzcat ("a", cell (1))), "cell")
-%!assert (class (horzcat ("a", true)), "char")
-%!assert (class (horzcat ("a", "a")), "char")
+%!test
+%! warning ("off", "Octave:num-to-str", "local");
+%! assert (class (horzcat (true, "a")), "char");
+
+%!test
+%! warning ("off", "Octave:num-to-str", "local");
+%! assert (class (horzcat ("a", int64 (1))), "char");
+%! assert (class (horzcat ("a", int32 (1))), "char");
+%! assert (class (horzcat ("a", int16 (1))), "char");
+%! assert (class (horzcat ("a", int8 (1))), "char");
+%! assert (class (horzcat ("a", int64 (1))), "char");
+%! assert (class (horzcat ("a", int32 (1))), "char");
+%! assert (class (horzcat ("a", int16 (1))), "char");
+%! assert (class (horzcat ("a", int8 (1))), "char");
+%! assert (class (horzcat ("a", single (1))), "char");
+%! assert (class (horzcat ("a", double (1))), "char");
+%! assert (class (horzcat ("a", cell (1))), "cell");
+%! assert (class (horzcat ("a", true)), "char");
+%! assert (class (horzcat ("a", "a")), "char");
 
 %!assert (class (horzcat (cell (1), struct ("foo", "bar"))), "cell")
 
--- a/libinterp/corefcn/luinc.cc	Fri Apr 01 12:57:49 2016 -0400
+++ b/libinterp/corefcn/luinc.cc	Fri Apr 01 13:56:09 2016 -0700
@@ -332,20 +332,3 @@
   return retval;
 }
 
-/*
-%!testif HAVE_UMFPACK
-%! a = sparse ([1,2,0,0;0,1,2,0;1e-14,0,3,0;0,0,0,1]);
-%! [l,u] = luinc (a, 1e-10);
-%! assert (l*u, sparse ([1,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10);
-%! opts.droptol = 1e-10;
-%! [l,u] = luinc (a, opts);
-%! assert (l*u, sparse ([1,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10);
-
-%!testif HAVE_UMFPACK
-%! a = sparse ([1i,2,0,0;0,1,2,0;1e-14,0,3,0;0,0,0,1]);
-%! [l,u] = luinc (a, 1e-10);
-%! assert (l*u, sparse ([1i,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10);
-%! opts.droptol = 1e-10;
-%! [l,u] = luinc (a, opts);
-%! assert (l*u, sparse ([1i,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10);
-*/
--- a/libinterp/corefcn/regexp.cc	Fri Apr 01 12:57:49 2016 -0400
+++ b/libinterp/corefcn/regexp.cc	Fri Apr 01 13:56:09 2016 -0700
@@ -1495,7 +1495,9 @@
 %!assert (regexprep ({"abc","cba"}, {"b","a"}, {"?","!"}), {"!?c","c?!"})
 
 # Nasty lookbehind expression
-%!assert (regexprep ('x^(-1)+y(-1)+z(-1)=0', '(?<=[a-z]+)\(\-[1-9]*\)', '_minus1'),'x^(-1)+y_minus1+z_minus1=0')
+%!test
+%! warning ("off", "Octave:regexp-lookbehind-limit", "local");
+%! assert (regexprep ('x^(-1)+y(-1)+z(-1)=0', '(?<=[a-z]+)\(\-[1-9]*\)', '_minus1'),'x^(-1)+y_minus1+z_minus1=0');
 
 %!assert (regexprep ("\n", '\n', "X"), "X")
 %!assert (regexprep ("\n", "\n", "X"), "X")
--- a/libinterp/corefcn/sqrtm.cc	Fri Apr 01 12:57:49 2016 -0400
+++ b/libinterp/corefcn/sqrtm.cc	Fri Apr 01 13:56:09 2016 -0700
@@ -258,6 +258,7 @@
 
 ## The following two tests are from the reference in the docstring above.
 %!test
+%! warning ("off", "Octave:sqrtm:SingularMatrix", "local");
 %! x = [0 1; 0 0];
 %! assert (any (isnan (sqrtm (x))(:)));
 
--- a/libinterp/dldfcn/__eigs__.cc	Fri Apr 01 12:57:49 2016 -0400
+++ b/libinterp/dldfcn/__eigs__.cc	Fri Apr 01 13:56:09 2016 -0700
@@ -561,3 +561,8 @@
   err_disabled_feature ("eigs", "ARPACK");
 #endif
 }
+
+/*
+## No test needed for internal helper function.
+%!assert (1)
+*/
--- a/libinterp/dldfcn/__init_fltk__.cc	Fri Apr 01 12:57:49 2016 -0400
+++ b/libinterp/dldfcn/__init_fltk__.cc	Fri Apr 01 13:56:09 2016 -0700
@@ -1,6 +1,5 @@
 /*
 
-
 Copyright (C) 2007-2015 Shai Ayal
 Copyright (C) 2014-2015 Andreas Weber
 
@@ -2439,3 +2438,8 @@
   err_disabled_feature ("__init_fltk__", "OpenGL and FLTK");
 #endif
 }
+
+/*
+## No test needed for internal helper function.
+%!assert (1)
+*/
--- a/libinterp/dldfcn/__init_gnuplot__.cc	Fri Apr 01 12:57:49 2016 -0400
+++ b/libinterp/dldfcn/__init_gnuplot__.cc	Fri Apr 01 13:56:09 2016 -0700
@@ -1,4 +1,4 @@
-/*
+/*, , 
 
 Copyright (C) 2007-2015 John W. Eaton
 
@@ -227,3 +227,7 @@
   return retval;
 }
 
+/*
+## No test needed for internal helper function.
+%!assert (1)
+*/
--- a/libinterp/octave-value/ov-range.cc	Fri Apr 01 12:57:49 2016 -0400
+++ b/libinterp/octave-value/ov-range.cc	Fri Apr 01 13:56:09 2016 -0700
@@ -726,6 +726,7 @@
 /*
 %!test
 %! x = 0:10;
+%! warning ("off", "Octave:deprecated-function", "local");
 %! save = allow_noninteger_range_as_index ();
 %! warn_state = warning ("query", "Octave:noninteger-range-as-index");
 %! unwind_protect
--- a/scripts/deprecated/luinc.m	Fri Apr 01 12:57:49 2016 -0400
+++ b/scripts/deprecated/luinc.m	Fri Apr 01 13:56:09 2016 -0700
@@ -92,3 +92,20 @@
 
 endfunction
 
+
+%!testif HAVE_UMFPACK
+%! a = sparse ([1,2,0,0;0,1,2,0;1e-14,0,3,0;0,0,0,1]);
+%! [l,u] = luinc (a, 1e-10);
+%! assert (l*u, sparse ([1,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10);
+%! opts.droptol = 1e-10;
+%! [l,u] = luinc (a, opts);
+%! assert (l*u, sparse ([1,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10);
+
+%!testif HAVE_UMFPACK
+%! a = sparse ([1i,2,0,0;0,1,2,0;1e-14,0,3,0;0,0,0,1]);
+%! [l,u] = luinc (a, 1e-10);
+%! assert (l*u, sparse ([1i,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10);
+%! opts.droptol = 1e-10;
+%! [l,u] = luinc (a, opts);
+%! assert (l*u, sparse ([1i,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10);
+
--- a/scripts/general/quadv.m	Fri Apr 01 12:57:49 2016 -0400
+++ b/scripts/general/quadv.m	Fri Apr 01 13:56:09 2016 -0700
@@ -153,14 +153,18 @@
 %!assert (quadv (@sin, 0, pi), 2, 1e-5)
 
 ## Test weak singularities at the edge
-%!assert (quadv (@(x) 1 ./ sqrt (x), 0, 1), 2, 1e-5)
+%!test
+%! warning ("off", "Octave:divide-by-zero", "local");
+%! assert (quadv (@(x) 1 ./ sqrt (x), 0, 1), 2, 1e-5);
 
 ## Test vector-valued functions
 %!assert (quadv (@(x) [(sin (x)), (sin (2 * x))], 0, pi), [2, 0], 1e-5)
 
 ## Test matrix-valued functions
-%!assert (quadv (@(x) [ x, x, x; x, 1./sqrt(x), x; x, x, x ], 0, 1),
-%!        [0.5, 0.5, 0.5; 0.5, 2, 0.5; 0.5, 0.5, 0.5], 1e-5)
+%!test
+%! warning ("off", "Octave:divide-by-zero", "local");
+%! assert (quadv (@(x) [ x, x, x; x, 1./sqrt(x), x; x, x, x ], 0, 1),
+%!         [0.5, 0.5, 0.5; 0.5, 2, 0.5; 0.5, 0.5, 0.5], 1e-5);
 
 ## Test input validation
 %!error quadv ()
--- a/scripts/image/imfinfo.m	Fri Apr 01 12:57:49 2016 -0400
+++ b/scripts/image/imfinfo.m	Fri Apr 01 13:56:09 2016 -0700
@@ -159,9 +159,10 @@
   info = imageIO ("imfinfo", @__imfinfo__, "info", filename, varargin{:});
 endfunction
 
-## This test is the same as the similar one in imread. imfinfo must check
-## if file exists before calling __imfinfo_. This test confirm this.
+## This test is the same as the similar one in imread.  imfinfo must check
+## if file exists before calling __imfinfo_.  This BIST test confirms this.
 %!testif HAVE_MAGICK
+%! warning ("off", "Octave:GraphicsMagic-Quantum-Depth", "local");
 %! fmt = fmt_ori = imformats ("jpg");
 %! fmt.info = @true;
 %! error_thrown = false;