annotate scripts/general/nargoutchk.m @ 19833:9fc020886ae9

maint: Clean up m-files to follow Octave coding conventions. Try to trim long lines to < 80 chars. Use '##' for single line comments. Use '(...)' around tests for if/elseif/switch/while. Abut cell indexing operator '{' next to variable. Abut array indexing operator '(' next to variable. Use space between negation operator '!' and following expression. Use two newlines between endfunction and start of %!test or %!demo code. Remove unnecessary parens grouping between short-circuit operators. Remove stray extra spaces (typos) between variables and assignment operators. Remove stray extra spaces from ends of lines.
author Rik <rik@octave.org>
date Mon, 23 Feb 2015 14:54:39 -0800
parents 4197fc428c7d
children 7503499a252b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19068
diff changeset
1 ## Copyright (C) 2008-2015 Bill Denney
14138
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.
19068
be8a12acb20a Deprecate nargchk in favor of narginchk.
Rik <rik@octave.org>
parents: 17744
diff changeset
41 ## @seealso{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
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
53 ## to guess if the caller is expecting a value (old syntax)
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
54 ## or none (new syntax).
13858
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
55
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
56 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
57
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
58 if (minargs > maxargs)
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
59 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
60 elseif (nargin == 3)
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
61 outtype = "string";
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
62 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
63 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
64 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
65 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
66 endif
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
67
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
68 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
69 if (nargs < minargs)
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
70 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
71 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
72 elseif (nargs > maxargs)
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
73 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
74 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
75 endif
7658
1ce6460aebdf nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff changeset
76
13858
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
77 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
78 msg = msg.message;
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
79 elseif (isempty (msg.message))
19068
be8a12acb20a Deprecate nargchk in favor of narginchk.
Rik <rik@octave.org>
parents: 17744
diff changeset
80 ## Compatibility: Matlab returns a 0x1 empty struct when nargoutchk passes
13858
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
81 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
82 endif
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
83
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
84 elseif (nargout == 0 && nargin == 2)
7658
1ce6460aebdf nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff changeset
85
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
86 if (! isnumeric (minargs) || ! isscalar (minargs))
13858
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
87 error ("minargs must be a numeric scalar");
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
88 elseif (! isnumeric (maxargs) || ! isscalar (maxargs))
13858
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
89 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
90 elseif (minargs > maxargs)
15202
f3b5cadfd6d5 fix missing semicolons in various .m files
John W. Eaton <jwe@octave.org>
parents: 14363
diff changeset
91 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
92 endif
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
93
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
94 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
95
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
96 if (args < minargs)
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
97 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
98 elseif (args > maxargs)
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
99 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
100 endif
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
101
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
102 else
55ab001af1b8 Made nargoutchk compatible with matlab 2011 but keeping backwards compatibility
Carnë Draug <carandraug+dev@gmail.com>
parents: 12881
diff changeset
103 print_usage;
7658
1ce6460aebdf nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff changeset
104 endif
1ce6460aebdf nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff changeset
105
1ce6460aebdf nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff changeset
106 endfunction
1ce6460aebdf nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff changeset
107
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
108
12865
a4d1581f9e72 Return correct struct for nargchk, nargoutchk (Bug #33808).
Rik <octave@nomad.inbox5.com>
parents: 12705
diff changeset
109 %!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
110 %! 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
111 %! 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
112 %! "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
113 %! 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
114 %! "identifier", "Octave:nargoutchk:too-many-outputs");
7658
1ce6460aebdf nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff changeset
115 %!assert (nargoutchk (0, 1, 0), "")
1ce6460aebdf nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff changeset
116 %!assert (nargoutchk (0, 1, 1), "")
1ce6460aebdf nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff changeset
117 %!assert (nargoutchk (1, 1, 0), "not enough output arguments")
1ce6460aebdf nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff changeset
118 %!assert (nargoutchk (0, 1, 2), "too many output arguments")
1ce6460aebdf nargoutchk.m, validatestring.m, addtodate.m: new functions
bill@denney.ws
parents:
diff changeset
119 %!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
120 ## Struct outputs
14363
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, 0, "struct"), stnul)
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
122 %!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
123 %!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
124 %!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
125