changeset 12882:724bb6b7e3d5 stable

assert.m: Correctly compare empty structures. * assert.m: Correctly compare empty structures. Add tests for behavior.
author Rik <octave@nomad.inbox5.com>
date Mon, 25 Jul 2011 10:32:01 -0700
parents d5d3f04a645f
children 73e75ff9c31b
files scripts/testfun/assert.m
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/testfun/assert.m
+++ b/scripts/testfun/assert.m
@@ -125,9 +125,8 @@
               error ();
             endif
             if (empty)
-              v = cell (1, 0);
-            endif
-            if (normal)
+              v = {};
+            elseif (normal)
               v = {v};
             else
               v = v(:)';
@@ -307,13 +306,19 @@
 %!error assert (x,y)
 %!error assert (3, x);
 %!error assert (x, 3);
-
-## check usage statements
-%!error assert
-%!error assert(1,2,3,4,5)
+%!test
+%! # Empty structures
+%! x = resize (x, 0, 1);
+%! y = resize (y, 0, 1);
+%! assert (x, y);
 
 ## strings
 %!assert("dog","dog")
 %!error assert("dog","cat")
 %!error assert("dog",3);
 %!error assert(3,"dog");
+
+## check input validation
+%!error assert
+%!error assert (1,2,3,4,5)
+