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: David Bateman
Subject: Re: C++ version of regexprep.cc
Date: Tue, 02 May 2006 18:12:50 +0200
User-agent: Thunderbird 1.5 (Windows/20051201)

Paul Kienzle wrote:

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]))
They both return 'abcdefgh' in matlab and in octave.


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))
Your call.. At the moment I've adjusted the test to have a 1x0 string to test against...

D.



- Paul




reply via email to

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