changeset 20881:7234cbd04292

magic.m:Fix failing tests after cset cdf08aacfd86
author Andreas Weber <andy.weber.aw@gmail.com>
date Sat, 12 Dec 2015 22:43:59 +0100
parents 40da964c3add
children 776c0b8c1d07
files scripts/special-matrix/magic.m
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/special-matrix/magic.m	Sat Dec 12 21:54:24 2015 +0100
+++ b/scripts/special-matrix/magic.m	Sat Dec 12 22:43:59 2015 +0100
@@ -35,6 +35,7 @@
     print_usage ();
   endif
 
+  n = fix (n);
   if (n < 1)
 
     A = [];
@@ -84,13 +85,11 @@
 %!   assert (norm(diff([sum(diag(A)),sum(diag(flipud(A))),sum(A),sum(A')])),0);
 %! endfor
 
+%!assert (isempty (magic (-1)))
 %!assert (isempty (magic (0)))
 %!assert (magic (1), 1)
+%!assert (magic (1.5), 1)
 
 ## Test input validation
 %!error magic ()
 %!error magic (1, 2)
-%!error <N must be a positive integer not equal to 2> magic (1.5)
-%!error <N must be a positive integer not equal to 2> magic (-1)
-%!error <N must be a positive integer not equal to 2> magic (2)
-