octave-maintainers
[Top][All Lists]
Advanced

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

Re: ending function in tests


From: John W. Eaton
Subject: Re: ending function in tests
Date: Thu, 21 May 2020 17:07:31 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 5/21/20 4:24 PM, Marco Atzeri wrote:
Controlling the test results of odepkg

https://bitbucket.org/odepkg/odepkg/src/default/

with octave 5.2 on Cygwin I hit a strange error

***** end
!!!!! unknown test type!

the error is caused by ending functions with just "end"

%!function [ydot] = pendulum (vt, vy)
%!  ydot = [0.5*vy(length(vy)/2+1:end); -(2*5*9.806)*[zeros(length(vy)/4);ones(length(vy)/4)]];
%!end

of course replacing

    %!end
with
    %!endfunction

works, but also declaring a normal function with "end" works

function [ydot] = pendulum (vt, vy)
   ydot = [0.5*vy(length(vy)/2+1:end); -(2*5*9.806)*[zeros(length(vy)/4);ones(length(vy)/4)]];
end

as this maintain compatibility with Matlab.
Is this by design or should I open a bug ?

I think it is by design, to simplify the code that breaks the test chunks into parts. It's reasonable to expect "%!endfunction" to have only one purpose. But %!end could be the end of any block.

jwe



reply via email to

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