# HG changeset patch # User Rik # Date 1311615121 25200 # Node ID 724bb6b7e3d5a6729582acaa6b3a3da955667c05 # Parent d5d3f04a645fb868d3db36ace2b923af867bcb8b assert.m: Correctly compare empty structures. * assert.m: Correctly compare empty structures. Add tests for behavior. diff --git a/scripts/testfun/assert.m b/scripts/testfun/assert.m --- 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) +