Mercurial > octave-nkf
comparison test/while.tst @ 16030:1af8d21608b7
rename all test files in the test directory from test_X.m to X.tst
* Use - instead of _ for .tst file names. Fix all file lists in
module.mk and Makefile.am files.
* __run_test_suite__.m: Adapt to new naming convention.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 09 Feb 2013 21:35:55 -0500 |
parents | test/test_while.m@5b2126a8c84f |
children | d3619d4d267c |
comparison
equal
deleted
inserted
replaced
16029:b8157404614f | 16030:1af8d21608b7 |
---|---|
1 ## Copyright (C) 2006-2012 John W. Eaton | |
2 ## | |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
19 %% test/octave.test/while/while-1.m | |
20 %!test | |
21 %! i = 0; | |
22 %! while (eye (2)) | |
23 %! i++; | |
24 %! __printf_assert__ ("%d\n", i); | |
25 %! endwhile | |
26 %! assert (__prog_output_assert__ ("")); | |
27 | |
28 %% test/octave.test/while/while-2.m | |
29 %!test | |
30 %! i = 5; | |
31 %! while (--i) | |
32 %! __printf_assert__ ("%d", i); | |
33 %! endwhile | |
34 %! __printf_assert__ ("\n"); | |
35 %! assert (__prog_output_assert__ ("4321")); | |
36 | |
37 %% test/octave.test/while/while-3.m | |
38 %!test | |
39 %! i = 5; | |
40 %! while (i) | |
41 %! i--; | |
42 %! __printf_assert__ ("%d", i); | |
43 %! endwhile | |
44 %! __printf_assert__ ("\n"); | |
45 %! assert (__prog_output_assert__ ("43210")); | |
46 | |
47 %% test/octave.test/while/while-4.m | |
48 %!test | |
49 %! i = 0; | |
50 %! while (i++ < 20) | |
51 %! if (i > 2) | |
52 %! break; | |
53 %! endif | |
54 %! __printf_assert__ ("%d", i); | |
55 %! endwhile | |
56 %! __printf_assert__ ("\n"); | |
57 %! assert (__prog_output_assert__ ("12")); | |
58 | |
59 %% test/octave.test/while/while-5.m | |
60 %!test | |
61 %! i = 0; | |
62 %! while (++i < 5) | |
63 %! if (i < 3) | |
64 %! continue; | |
65 %! endif | |
66 %! __printf_assert__ ("%d", i); | |
67 %! endwhile | |
68 %! __printf_assert__ ("\n"); | |
69 %! assert (__prog_output_assert__ ("34")); | |
70 |