diff scripts/general/issquare.m @ 7411:83a8781b529d

[project @ 2008-01-22 21:52:25 by jwe]
author jwe
date Tue, 22 Jan 2008 21:52:26 +0000
parents a1dbe9d80eee
children eb63fbe60fab
line wrap: on
line diff
--- a/scripts/general/issquare.m
+++ b/scripts/general/issquare.m
@@ -43,3 +43,32 @@
   endif
 
 endfunction
+
+%!assert(issquare (1));
+
+%!assert(!(issquare ([1, 2])));
+
+%!assert(!(issquare ([])));
+
+%!assert(issquare ([1, 2; 3, 4]) == 2);
+
+%!test
+%! warn_str_to_num = 0;
+%! assert(!(issquare ("t")));
+
+%!assert(!(issquare ("test")));
+
+%!test
+%! warn_str_to_num = 0;
+%! assert(!(issquare (["test"; "ing"; "1"; "2"])));
+
+%!test
+%! s.a = 1;
+%! assert(!(issquare (s)));
+
+%!assert(!(issquare ([1, 2; 3, 4; 5, 6])));
+
+%!error issquare ();
+
+%!error issquare ([1, 2; 3, 4], 2);
+