Mercurial > hg > octave-nkf
comparison src/pt-eval.cc @ 12833:9f0f2c226053
codesprint: new tests for functions in pt-eval.cc
* pt-eval.cc (Fmax_recursion_depth, Fsilent_functions): New tests.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 16 Jul 2011 17:29:00 -0400 |
parents | 12df7854fa7c |
children | 359153d26cc1 |
comparison
equal
deleted
inserted
replaced
12832:03f125c0fb7b | 12833:9f0f2c226053 |
---|---|
1200 @end deftypefn") | 1200 @end deftypefn") |
1201 { | 1201 { |
1202 return SET_INTERNAL_VARIABLE (max_recursion_depth); | 1202 return SET_INTERNAL_VARIABLE (max_recursion_depth); |
1203 } | 1203 } |
1204 | 1204 |
1205 /* | |
1206 %!error (max_recursion_depth (1, 2)); | |
1207 %!test | |
1208 %! orig_val = max_recursion_depth (); | |
1209 %! old_val = max_recursion_depth (2*orig_val); | |
1210 %! assert (orig_val, old_val); | |
1211 %! assert (max_recursion_depth (), 2*orig_val); | |
1212 %! max_recursion_depth (orig_val); | |
1213 %! assert (max_recursion_depth (), orig_val); | |
1214 */ | |
1215 | |
1205 DEFUN (silent_functions, args, nargout, | 1216 DEFUN (silent_functions, args, nargout, |
1206 "-*- texinfo -*-\n\ | 1217 "-*- texinfo -*-\n\ |
1207 @deftypefn {Built-in Function} {@var{val} =} silent_functions ()\n\ | 1218 @deftypefn {Built-in Function} {@var{val} =} silent_functions ()\n\ |
1208 @deftypefnx {Built-in Function} {@var{old_val} =} silent_functions (@var{new_val})\n\ | 1219 @deftypefnx {Built-in Function} {@var{old_val} =} silent_functions (@var{new_val})\n\ |
1209 Query or set the internal variable that controls whether internal\n\ | 1220 Query or set the internal variable that controls whether internal\n\ |
1212 within a function body that are not terminated with a semicolon.\n\ | 1223 within a function body that are not terminated with a semicolon.\n\ |
1213 @end deftypefn") | 1224 @end deftypefn") |
1214 { | 1225 { |
1215 return SET_INTERNAL_VARIABLE (silent_functions); | 1226 return SET_INTERNAL_VARIABLE (silent_functions); |
1216 } | 1227 } |
1228 | |
1229 /* | |
1230 %!error (silent_functions (1, 2)); | |
1231 %!test | |
1232 %! orig_val = silent_functions (); | |
1233 %! old_val = silent_functions (! orig_val); | |
1234 %! assert (orig_val, old_val); | |
1235 %! assert (silent_functions (), ! orig_val); | |
1236 %! silent_functions (orig_val); | |
1237 %! assert (silent_functions (), orig_val); | |
1238 */ |