Mercurial > hg > octave-lyh
diff test/test_recursion.m @ 5590:1ad66ea35fe5
[project @ 2006-01-06 00:24:05 by jwe]
author | jwe |
---|---|
date | Fri, 06 Jan 2006 00:24:06 +0000 |
parents | |
children | 93c65f2a5668 |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/test/test_recursion.m @@ -0,0 +1,24 @@ +%% Automatically generated from DejaGNU files + +%% test/octave.test/recursion/recursion-1.m +%!function y = f (x) +%! if (x == 1) +%! y = x; +%! return; +%! else +%! y = x * f (x-1); +%! endif +%!test +%! assert(f (5),120); + +%% test/octave.test/recursion/recursion-2.m +%!function y = f (x) +%! if (x == 1) +%! y = x; +%! return; +%! else +%! y = f (x-1) * x; +%! endif +%!test +%! assert(f (5),120); +