octave-patch-tracker
[Top][All Lists]
Advanced

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

[Octave-patch-tracker] [patch #7649] new function narginchk


From: Carnë Draug
Subject: [Octave-patch-tracker] [patch #7649] new function narginchk
Date: Fri, 28 Oct 2011 16:42:57 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20110929 Iceweasel/3.5.16 (like Firefox/3.5.16)

URL:
  <http://savannah.gnu.org/patch/?7649>

                 Summary: new function narginchk
                 Project: GNU Octave
            Submitted by: carandraug
            Submitted on: Fri 28 Oct 2011 04:42:56 PM GMT
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Hi

I'm submitting a new function to octave which has been added to matlab in the
version 2011b (I asked in ##matlab and seems it's not present in 2011a).

It's a ridiculously simple thing but if someone codes is ever dependent on it,
it's already here. I asked to get some corner cases tested with the following
code in matlab


function test_min_only (varargin)
  narginchk (3)
  disp ('only minargs is ok')
end

function test_same (varargin)
  narginchk (3, 3)
  disp ('min and max can be equal')
end

function test_inf (varargin)
  narginchk (3, inf)
  disp ('can use inf as max')
end

function test_zero (varargin)
  narginchk (0, 3)
  disp ('can use zero as min')
end

function test_zero_both (varargin)
  narginchk (0, 0)
  disp ('can use zero as both min and max')
end

function test_negative (varargin)
  narginchk (-1, 3)
  disp ('min can be negative')
end

test_min_only (1, 2, 3)   # fails
test_same (1, 2, 3)       # works
test_inf (1, 2, 3)        # works
test_zero (1, 2, 3)       # works
test_zero_both ()         # works
test_negative (1, 2, 3)   # works




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 28 Oct 2011 04:42:56 PM GMT  Name: narginchk.diff  Size: 3kB   By:
carandraug

<http://savannah.gnu.org/patch/download.php?file_id=24232>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?7649>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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