changeset 29794:eece40ca8c2a stable

hist.m: improve regression tests (bug #60783) Addition to cset 5113ae64136b. * scripts/plot/draw/hist.m: Use non-random test matrix to avoid tolerance problems. Thanks to Markus for pointing me to this.
author Kai T. Ohlhus <k.ohlhus@gmail.com>
date Mon, 21 Jun 2021 15:33:39 +0900
parents 10292fb30c8f
children 98fa1d545c8d 2db3e5a10503
files scripts/plot/draw/hist.m
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/draw/hist.m	Sat May 01 15:17:28 2021 +0200
+++ b/scripts/plot/draw/hist.m	Mon Jun 21 15:33:39 2021 +0900
@@ -305,12 +305,12 @@
 %!assert <*42394> (isempty (hist (rand (10,2), 0:5, 1)), false)
 %!assert <*42394> (isempty (hist (rand (10,2), 0:5, [1 1])), false)
 %!test <*60783>
-%! [nn, xx] = hist (rand (10, 3), 5, 1);
-%! assert (sum (nn, 1), [1 1 1], 2*eps);
-%! [nn, xx] = hist (rand (10, 3), 5, [1 2 3]);
-%! assert (sum (nn, 1), [1 2 3], 2*eps);
-%! [nn, xx] = hist (rand (10, 3), 5, [1 2 3]');
-%! assert (sum (nn, 1), [1 2 3], 2*eps);
+%! [nn, xx] = hist (reshape (1:30, 10, 3), 5, 1);
+%! assert (sum (nn, 1), [1 1 1]);
+%! [nn, xx] = hist (reshape (1:30, 10, 3), 5, [1 2 3]);
+%! assert (sum (nn, 1), [1 2 3]);
+%! [nn, xx] = hist (reshape (1:30, 10, 3), 5, [1 2 3]');
+%! assert (sum (nn, 1), [1 2 3]);
 
 %!test <*47707>
 %! y = [1  9  2  2  9  3  8  9  1  7  1  1  3  2  4  4  8  2  1  9  4  1 ...