octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ version of regexprep.cc


From: Paul Kienzle
Subject: Re: C++ version of regexprep.cc
Date: Tue, 2 May 2006 11:02:23 -0400


On May 2, 2006, at 10:39 AM, David Bateman wrote:

Paul Kienzle wrote:

On May 2, 2006, at 7:25 AM, David Bateman wrote:

John, do you want mat2cell committed as well?

mat2cell is a core function and it works like expected so the answer should be yes.
Yes, but I commit nothing without Johns say so.

Agreed.  My comment was for John.

%!test
%! x = 'abcdefghij';
%! c = mat2cell(x,1,[0,4,2,0,4,0]);
%! assert(c,{'','abcd','ef','','ghij',''})
Yes but in matlab size('c{1} is [1,0]!!! So it is the test that is in fact wrong. The resize function I recently added might be used here to change the test to

%! assert(c,{resize('',1,0),'abcd',ef',resize('',1,0),'ghij',resize('',1,0 )})

Hmmm... is this bug for bug compatibility?  What do the following do:

         cell2mat({'','abcd','ef','','gh'})
         cell2mat(mat2cell('abcdefgh',1,[0,4,2,0,2]))

Perhaps we should change isequal to test isempty on expected and result, and if both true then return true?

If you need finer control on the kind of empty you can use the following in your tests:

%! assert(size(expected),size(result))
%! assert(class(expected),class(result))

- Paul



reply via email to

[Prev in Thread] Current Thread [Next in Thread]