IDEAS home Printed from
MyIDEAS: Log in (now much improved!) to save this software component

FTEST: Octave function test routine

Listed author(s):
  • Paul Kienzle


Registered author(s):

    I wrote ftest, which extracts lines starting with ##! and evaluates them with eval(). It doesn't cope with syntax errors elegantly. E.g., usage: r = mod(x,y) Compute modulo function, handling negative number correctly; i.e., mod(-1,3) is 2, not -1 as rem(-1,3) returns. function r=mod(x,y) if nargin != 2, usage("r=mod(x,y)"); endif r = x - floor(x./y).*y; endfunction ! if mod(5,3) != 2, disp("mod fails for positive a"); endif ! if mod(-5,3) != 1, disp("mod fails for negative a"); endif ! if mod(0,3) != 0, disp("mod fails for a=0"); endif ! if !isempty(mod([],[])), disp("mod fails for empty"); endif ! if any(mod([-5 5 0],[3 3 3]) != [1 2 0]), ! disp("mod fails for columns"); endif ! if any(mod([-5 5 0]',[3 3 3]') != [1 2 0]'), ! disp("mod fails for rows"); endif ! if any(any(mod([-5 5; 0 3],[3 3 ; 3 1]) != [1 2 ; 0 0])), ! disp("mod fails for matrices"); endif

    If you experience problems downloading a file, check if you have the proper application to view it first. In case of further problems read the IDEAS help page. Note that these files are not on the IDEAS site. Please be patient as the files may be large.

    File URL:
    File Function: program code
    Download Restriction: no

    Software component provided by in its series Octave codes with number C042505.

    in new window

    Programming language: Octave
    Requires: Octave
    Date of creation: 16 Apr 2000
    Handle: RePEc:cod:octave:c042505
    Contact details of provider:

    This item is not listed on Wikipedia, on a reading list or among the top items on IDEAS.

    When requesting a correction, please mention this item's handle: RePEc:cod:octave:c042505. See general information about how to correct material in RePEc.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: ()

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If references are entirely missing, you can add them using this form.

    If the full references list an item that is present in RePEc, but the system did not link to it, you can help with this form.

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your profile, as there may be some citations waiting for confirmation.

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    This information is provided to you by IDEAS at the Research Division of the Federal Reserve Bank of St. Louis using RePEc data.