Mercurial > hg > octave-nkf
diff test/test_while.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_while.m @@ -0,0 +1,54 @@ +%% Automatically generated from DejaGNU files + +%% test/octave.test/while/while-1.m +%!test +%! i = 0; +%! while (eye (2)) +%! i++; +%! printf_assert ("%d\n", i); +%! endwhile; +%! assert(prog_output_assert("")); + +%% test/octave.test/while/while-2.m +%!test +%! i = 5; +%! while (--i) +%! printf_assert ("%d", i); +%! endwhile +%! printf_assert ("\n"); +%! assert(prog_output_assert("4321")); + +%% test/octave.test/while/while-3.m +%!test +%! i = 5; +%! while (i) +%! i--; +%! printf_assert ("%d", i); +%! endwhile +%! printf_assert ("\n"); +%! assert(prog_output_assert("43210")); + +%% test/octave.test/while/while-4.m +%!test +%! i = 0; +%! while (i++ < 20) +%! if (i > 2) +%! break; +%! endif +%! printf_assert ("%d", i); +%! endwhile; +%! printf_assert ("\n"); +%! assert(prog_output_assert("12")); + +%% test/octave.test/while/while-5.m +%!test +%! i = 0; +%! while (++i < 5) +%! if (i < 3) +%! continue; +%! endif +%! printf_assert ("%d", i); +%! endwhile +%! printf_assert ("\n"); +%! assert(prog_output_assert("34")); +