comparison scripts/testfun/assert.m @ 18538:fcd87f68af4f

Deprecate nfields and replace with numfields. * NEWS: Announce deprecation of nfields and addition of new function numfields. * container.txi: Add numfields to the manual. * oct-map.cc (octave_map::cat): Change %!tests to use numfields. * ov-struct.cc (Fnumfields): Function renamed from nfields. * scripts/deprecated/nfields.m: Add m-file which warns about nfields deprecation. * scripts/deprecated/module.mk: Add nfields.m to build system. * fieldnames.m: Change seealso link to point to numfields. * __isequal__.m: Use numfields to simplify code. * imwrite.m: Replace 'isempty (fieldnames (fmt))' with 'numfields (fmt) > 0' for clarity. * imageIO.m: Replace 'isempty (fieldnames (fmt))' with 'numfields (fmt) > 0' for clarity. * importdata.m: Use numfields to simplify code. * assert.m: Use numfields to simplify code.
author Rik <rik@octave.org>
date Sun, 02 Mar 2014 12:56:11 -0800
parents 7994d3ce6e8e
children b83fca22bb4c
comparison
equal deleted inserted replaced
18537:f958e8cd6348 18538:fcd87f68af4f
146 err.observed{end+1} = "O"; 146 err.observed{end+1} = "O";
147 err.expected{end+1} = "E"; 147 err.expected{end+1} = "E";
148 err.reason{end+1} = ["Expected struct, but observed " class(cond)]; 148 err.reason{end+1} = ["Expected struct, but observed " class(cond)];
149 elseif (ndims (cond) != ndims (expected) 149 elseif (ndims (cond) != ndims (expected)
150 || any (size (cond) != size (expected)) 150 || any (size (cond) != size (expected))
151 || rows (fieldnames (cond)) != rows (fieldnames (expected))) 151 || numfields (cond) != numfields (expected))
152 152
153 err.index{end+1} = "."; 153 err.index{end+1} = ".";
154 err.observed{end+1} = ["O(" sprintf("%dx", size(cond))(1:end-1) ")"]; 154 err.observed{end+1} = ["O(" sprintf("%dx", size(cond))(1:end-1) ")"];
155 err.expected{end+1} = ["E(" sprintf("%dx", size(expected))(1:end-1) ")"]; 155 err.expected{end+1} = ["E(" sprintf("%dx", size(expected))(1:end-1) ")"];
156 err.reason{end+1} = "Structure sizes don't match"; 156 err.reason{end+1} = "Structure sizes don't match";