Mercurial > hg > octave-lyh
annotate scripts/general/nargoutchk.m @ 17420:95bfa04ab514
Fix bug in colorbar demo #24.
set() is broken from deep within listener hierarchy. Workaround it.
* scripts/plot/colorbar.m(update_colorbar_clim): Set axis limits in listener
and then jiggle the axis position to force a redraw.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 11 Sep 2013 16:05:40 -0700 |
parents | f3b5cadfd6d5 |
children |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13929
diff
changeset
|
1 ## Copyright (C) 2008-2012 Bill Denney |
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13929
diff
changeset
|
2 ## Copyright (C) 2012 Carnë Draug |
7658
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
3 ## |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
4 ## This file is part of Octave. |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
5 ## |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
6 ## Octave is free software; you can redistribute it and/or modify it |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
7 ## under the terms of the GNU General Public License as published by |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
8 ## the Free Software Foundation; either version 3 of the License, or (at |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
9 ## your option) any later version. |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
10 ## |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
11 ## Octave is distributed in the hope that it will be useful, but |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
14 ## General Public License for more details. |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
15 ## |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
16 ## You should have received a copy of the GNU General Public License |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
17 ## along with Octave; see the file COPYING. If not, see |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
18 ## <http://www.gnu.org/licenses/>. |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
19 |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
20 ## -*- texinfo -*- |
13858
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
21 ## @deftypefn {Function File} {} nargoutchk (@var{minargs}, @var{maxargs}) |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
22 ## @deftypefnx {Function File} {@var{msgstr} =} nargoutchk (@var{minargs}, @var{maxargs}, @var{nargs}) |
7658
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
23 ## @deftypefnx {Function File} {@var{msgstr} =} nargoutchk (@var{minargs}, @var{maxargs}, @var{nargs}, "string") |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
24 ## @deftypefnx {Function File} {@var{msgstruct} =} nargoutchk (@var{minargs}, @var{maxargs}, @var{nargs}, "struct") |
13858
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
25 ## Check for correct number of output arguments. |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
26 ## |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
27 ## On the first form, returns an error unless the number of arguments in its |
13929
9cae456085c2
Grammarcheck of documentation before 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents:
13860
diff
changeset
|
28 ## caller is between the values of @var{minargs} and @var{maxargs}. It does |
9cae456085c2
Grammarcheck of documentation before 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents:
13860
diff
changeset
|
29 ## nothing otherwise. Note that this function evaluates the value of |
13858
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
30 ## @code{nargout} on the caller so its value must have not been tampered with. |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
31 ## |
13929
9cae456085c2
Grammarcheck of documentation before 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents:
13860
diff
changeset
|
32 ## Both @var{minargs} and @var{maxargs} need to be a numeric scalar. Zero, Inf |
13858
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
33 ## and negative are all valid, and they can have the same value. |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
34 ## |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
35 ## For backward compatibility reasons, the other forms return an appropriate |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
36 ## error message string (or structure) if the number of outputs requested is |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
37 ## invalid. |
7658
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
38 ## |
8522
d65b33e55d40
nargchk.m: improve compatibility; new tests
Peter L. Sondergaard <peter@sonderport.dk>
parents:
7658
diff
changeset
|
39 ## This is useful for checking to see that the number of output |
d65b33e55d40
nargchk.m: improve compatibility; new tests
Peter L. Sondergaard <peter@sonderport.dk>
parents:
7658
diff
changeset
|
40 ## arguments supplied to a function is within an acceptable range. |
13852
e36817e2ee60
New function narginchk
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
41 ## @seealso{nargchk, narginchk, error, nargout, nargin} |
7658
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
42 ## @end deftypefn |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
43 |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
44 ## Author: Bill Denney <bill@denney.ws> |
13858
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
45 ## Author: Carnë Draug <carandraug+dev@gmail.com> |
7658
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
46 |
11470
eb9e0b597d61
Use common names for variables in documentation and code for a few more m-script files.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
47 function msg = nargoutchk (minargs, maxargs, nargs, outtype) |
7658
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
48 |
13858
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
49 ## before matlab's 2011b, nargoutchk would return an error message (just the |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
50 ## message in a string). With 2011b, it no longer returns anything, it simply |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
51 ## gives an error if the args number is incorrect. |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
52 ## To try to keep compatibility with both versions, check nargout and nargin |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
53 ## to guess if the caller is expecting a value (old syntax) or none (new syntax) |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
54 |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
55 if (nargout == 1 && (nargin == 3 || nargin == 4)) |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
56 |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
57 if (minargs > maxargs) |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
58 error ("nargoutchk: MINARGS must be <= MAXARGS"); |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
59 elseif (nargin == 3) |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
60 outtype = "string"; |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
61 elseif (! any (strcmpi (outtype, {"string" "struct"}))) |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
62 error ("nargoutchk: output type must be either string or struct"); |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
63 elseif (! (isscalar (minargs) && isscalar (maxargs) && isscalar (nargs))) |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
64 error ("nargoutchk: MINARGS, MAXARGS, and NARGS must be scalars"); |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
65 endif |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
66 |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
67 msg = struct ("message", "", "identifier", ""); |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
68 if (nargs < minargs) |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
69 msg.message = "not enough output arguments"; |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
70 msg.identifier = "Octave:nargoutchk:not-enough-outputs"; |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
71 elseif (nargs > maxargs) |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
72 msg.message = "too many output arguments"; |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
73 msg.identifier = "Octave:nargoutchk:too-many-outputs"; |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
74 endif |
7658
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
75 |
13858
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
76 if (strcmpi (outtype, "string")) |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
77 msg = msg.message; |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
78 elseif (isempty (msg.message)) |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
79 ## Compatability: Matlab returns a 0x1 empty struct when nargchk passes |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
80 msg = resize (msg, 0, 1); |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
81 endif |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
82 |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
83 elseif (nargout == 0 && nargin == 2) |
7658
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
84 |
13858
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
85 if (!isnumeric (minargs) || !isscalar (minargs)) |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
86 error ("minargs must be a numeric scalar"); |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
87 elseif (!isnumeric (maxargs) || !isscalar (maxargs)) |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
88 error ("maxargs must be a numeric scalar"); |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
89 elseif (minargs > maxargs) |
15202
f3b5cadfd6d5
fix missing semicolons in various .m files
John W. Eaton <jwe@octave.org>
parents:
14363
diff
changeset
|
90 error ("minargs cannot be larger than maxargs"); |
13858
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
91 endif |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
92 |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
93 args = evalin ("caller", "nargout;"); |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
94 |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
95 if (args < minargs) |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
96 error ("Not enough output arguments."); |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
97 elseif (args > maxargs) |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
98 error ("Too many output arguments."); |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
99 endif |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
100 |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
101 else |
55ab001af1b8
Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents:
12881
diff
changeset
|
102 print_usage; |
7658
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
103 endif |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
104 |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
105 endfunction |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
106 |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
107 |
12865
a4d1581f9e72
Return correct struct for nargchk, nargoutchk (Bug #33808).
Rik <octave@nomad.inbox5.com>
parents:
12705
diff
changeset
|
108 %!shared stnul, stmin, stmax |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
109 %! stnul = resize (struct ("message", "", "identifier", ""), 0, 1); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
110 %! stmin = struct ("message", "not enough output arguments", |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
111 %! "identifier", "Octave:nargoutchk:not-enough-outputs"); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
112 %! stmax = struct ("message", "too many output arguments", |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
113 %! "identifier", "Octave:nargoutchk:too-many-outputs"); |
7658
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
114 %!assert (nargoutchk (0, 1, 0), "") |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
115 %!assert (nargoutchk (0, 1, 1), "") |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
116 %!assert (nargoutchk (1, 1, 0), "not enough output arguments") |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
117 %!assert (nargoutchk (0, 1, 2), "too many output arguments") |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
118 %!assert (nargoutchk (0, 1, 2, "string"), "too many output arguments") |
1ce6460aebdf
nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff
changeset
|
119 ## Struct outputs |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
120 %!assert (nargoutchk (0, 1, 0, "struct"), stnul) |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
121 %!assert (nargoutchk (0, 1, 1, "struct"), stnul) |
12865
a4d1581f9e72
Return correct struct for nargchk, nargoutchk (Bug #33808).
Rik <octave@nomad.inbox5.com>
parents:
12705
diff
changeset
|
122 %!assert (nargoutchk (1, 1, 0, "struct"), stmin) |
a4d1581f9e72
Return correct struct for nargchk, nargoutchk (Bug #33808).
Rik <octave@nomad.inbox5.com>
parents:
12705
diff
changeset
|
123 %!assert (nargoutchk (0, 1, 2, "struct"), stmax) |
a4d1581f9e72
Return correct struct for nargchk, nargoutchk (Bug #33808).
Rik <octave@nomad.inbox5.com>
parents:
12705
diff
changeset
|
124 |